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 DebError
Source Code

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

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