#K67482. Analyze Server Data

    ID: 32652 Type: Default 1000ms 256MiB

Analyze Server Data

Analyze Server Data

You are given performance logs for several servers. Each server has multiple log records, and each record contains three integers: the timestamp, the number of read operations, and the number of write operations performed at that time. Your task is to compute the total number of disk operations (read + write) for each server and then identify the server with the highest total operations. In the event of a tie, choose the server with the smallest index.

For a given server with \( n \) records, the total number of operations is computed as follows: \( \text{Total} = \sum_{i=1}^{n} (\text{read}_i + \text{write}_i) \).

inputFormat

The input is read from standard input and has the following format:

  • The first line contains an integer \( m \) representing the number of servers.
  • For each server, the first line contains an integer \( n_i \) indicating the number of log records for that server.
  • This is followed by \( n_i \) lines, each containing three space-separated integers: timestamp, read operations, and write operations.

outputFormat

For each server, output a line in the format: Server X: Y where X is the server number (starting from 1) and Y is the total number of operations for that server. After printing all servers' totals, output another line in the format: Top server: X with total operations Y, where X is the server number with the highest operations and Y is its total operations.

## sample
3
4
1 100 200
2 200 100
3 300 150
4 100 250
2
1 150 150
2 300 300
3
1 200 100
2 150 150
3 250 250
Server 1: 1450

Server 2: 900 Server 3: 1100 Top server: 1 with total operations 1450

</p>