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 listJan 7, 2026 04:16Josu San MartinJosu San MartinScore: 3,608Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 7, 2026 04:123,59869,929,72738,563,0001,014,0002,281,472
2Jan 7, 2026 04:083,59967,291,48438,579,0001,015,0002,281,472
3Jan 7, 2026 04:083,59965,835,19638,579,0001,015,0002,281,472
4Jan 7, 2026 04:223,59965,322,98738,571,0001,015,0002,277,376
5Jan 7, 2026 04:083,60061,547,24538,585,0001,015,0002,441,216
6Jan 7, 2026 04:123,60165,316,73738,600,0001,015,0002,531,328
7Jan 7, 2026 04:123,60266,498,97938,607,0001,015,0002,445,312
8Jan 7, 2026 04:183,60369,394,21338,613,0001,016,0002,437,120
9Jan 7, 2026 04:123,60364,190,12838,621,0001,016,0002,281,472
10Jan 7, 2026 04:123,60367,681,67638,615,0001,016,0002,441,216
11Jan 7, 2026 04:193,60465,336,17138,625,0001,016,0002,433,024
12Jan 7, 2026 04:083,60464,958,16838,630,0001,016,0002,449,408
13Jan 7, 2026 04:083,60467,756,45638,626,0001,016,0002,433,024
14Jan 7, 2026 04:163,60764,027,08538,662,0001,017,0002,437,120
15Jan 7, 2026 04:223,60864,961,82138,674,0001,017,0002,281,472
16Jan 7, 2026 04:123,60870,247,93638,670,0001,017,0002,281,472
17Jan 7, 2026 04:223,60965,977,63738,683,0001,017,0002,281,472
18Jan 7, 2026 04:083,60964,493,95538,682,0001,017,0002,437,120
19Jan 7, 2026 04:083,61967,123,91638,818,000995,0002,428,928
20Jan 7, 2026 04:163,62166,977,68437,841,0001,991,0002,281,472
21Jan 7, 2026 04:123,62169,947,37538,840,000995,0002,441,216
22Jan 7, 2026 04:183,62169,290,78737,836,0001,991,0002,437,120
23Jan 7, 2026 04:183,62165,640,43637,844,0001,991,0002,281,472
24Jan 7, 2026 04:193,62164,994,52537,837,0001,991,0002,424,832
25Jan 7, 2026 04:123,62265,697,93637,851,0001,992,0002,445,312
26Jan 7, 2026 04:083,62267,610,84137,853,0001,992,0002,281,472
27Jan 7, 2026 04:083,62271,863,31037,850,0001,992,0002,433,024
28Jan 7, 2026 04:123,62367,954,17538,855,000996,0002,281,472
29Jan 7, 2026 04:163,62366,569,28237,864,0001,992,0002,281,472
30Jan 7, 2026 04:193,62363,672,68237,862,0001,992,0002,277,376