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 listAug 13, 2025 22:56Aniruddha DebAniruddha DebScore: 3,920Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 13, 2025 22:583,90663,720,61541,967,000999,0002,428,928
2Aug 13, 2025 22:583,91267,740,23442,037,0001,000,0002,269,184
3Aug 13, 2025 22:563,91368,003,89842,040,0001,000,0002,428,928
4Aug 13, 2025 22:563,91362,449,65842,038,0001,000,0002,531,328
5Aug 13, 2025 23:013,91466,968,81542,058,0001,001,0002,531,328
6Aug 13, 2025 23:013,91564,034,21842,068,0001,001,0002,424,832
7Aug 13, 2025 22:583,91666,702,92042,074,0001,001,0002,433,024
8Aug 13, 2025 22:583,91962,112,30142,112,0001,002,0002,428,928
9Aug 13, 2025 23:013,91963,028,33342,111,0001,002,0002,531,328
10Aug 13, 2025 22:583,91967,717,41142,108,0001,002,0002,269,184
11Aug 13, 2025 22:583,92063,842,30242,115,0001,002,0002,424,832
12Aug 13, 2025 22:563,92069,502,58743,124,00002,531,328
13Aug 13, 2025 23:013,92068,619,77142,116,0001,002,0002,437,120
14Aug 13, 2025 23:013,92064,125,41341,115,0002,005,0002,428,928
15Aug 13, 2025 22:583,92266,737,45142,135,0001,003,0002,531,328
16Aug 13, 2025 23:013,92370,598,76741,143,0002,007,0002,269,184
17Aug 13, 2025 23:013,92765,286,62442,189,0001,004,0002,428,928
18Aug 13, 2025 22:583,92861,716,51342,204,0001,004,0002,531,328
19Aug 13, 2025 23:013,93062,371,56641,220,0002,010,0002,531,328
20Aug 13, 2025 22:563,93065,549,05042,227,0001,005,0002,420,736
21Aug 13, 2025 22:583,93362,979,13143,262,00002,424,832
22Aug 13, 2025 22:563,93367,678,49743,263,00002,531,328
23Aug 13, 2025 22:563,93471,611,01942,273,0001,006,0002,269,184
24Aug 13, 2025 23:013,93565,055,56243,282,00002,424,832
25Aug 13, 2025 22:563,93766,417,62043,303,00002,531,328
26Aug 13, 2025 22:563,93866,479,17243,321,00002,269,184
27Aug 13, 2025 22:563,94166,181,12443,356,00002,437,120