Parse JSON Sergey Svistunov

Compute the total amount of non-canceled external USD transactions from a stream of JSON records as fast as possible.

Input: 1 000 000 JSON records on STDIN, one per line. Each record has the following structure:

{
    "user_id": 0,
    "currency": "USD",
    "transactions": [
        {
            "amount": 0,
            "to_user_id": 0,
            "canceled": false
        }
    ]
}
Field Constraints
user_id Integer, max 10 000
currency One of "GBP", "USD", "RUB", "JPY", "CHF"
transactions Array, max 10 elements
amount Integer, max 1000
canceled Boolean; may be omitted when false

Field order is not guaranteed within any object.

Output: The total amount of all transactions where:

  • record.currency == "USD"
  • transaction.to_user_id != record.user_id (external)
  • transaction.canceled is false or absent
Back to listMay 22, 2021 17:14Yuriy LyfenkoYuriy LyfenkoError
Source Code

Source code access is restricted. Log in to request access.

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 06:43C#_user36.90CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 06:44060,060,505,03960,000,466,00042,043,00040,960Killed by timeout
2May 22, 2021 17:146,259103,881,18565,857,0002,993,0002,531,328
3May 22, 2021 17:146,261100,174,87766,877,0001,996,0002,334,720
4May 22, 2021 17:146,26296,930,14965,890,0002,995,0002,334,720
5May 22, 2021 17:146,27293,322,45465,993,0002,999,0002,527,232
6May 22, 2021 17:146,28094,669,09567,081,0002,002,0002,531,328
7May 22, 2021 17:146,28295,284,99066,097,0003,004,0002,334,720
8May 22, 2021 17:146,28595,759,59366,131,0003,005,0002,334,720
9May 22, 2021 17:146,28895,401,95767,165,0002,004,0002,531,328
10May 22, 2021 17:146,296137,710,47169,259,97002,183,168
11May 22, 2021 17:146,297137,667,11869,270,03202,199,552
12May 22, 2021 17:146,299123,645,57869,287,68702,179,072
13May 22, 2021 17:146,29993,960,61666,272,0003,012,0002,334,720