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 6, 2026 05:09Josu San MartinJosu San MartinScore: 6,399Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 05:096,37293,255,49369,094,0001,001,0002,359,296
2Jan 6, 2026 05:096,37393,076,61868,100,0002,002,0002,289,664
3Jan 6, 2026 05:096,38098,178,89169,174,0001,002,0002,289,664
4Jan 6, 2026 05:096,38294,950,62969,199,0001,002,0002,449,408
5Jan 6, 2026 05:096,38293,799,40969,195,0001,002,0002,289,664
6Jan 6, 2026 05:096,38596,313,78869,237,0001,003,0002,359,296
7Jan 6, 2026 05:096,39497,861,70370,331,00002,289,664
8Jan 6, 2026 05:096,39591,470,37670,346,00002,289,664
9Jan 6, 2026 05:096,39691,444,28469,346,0001,005,0002,363,392
10Jan 6, 2026 05:096,39994,211,19070,393,00002,465,792
11Jan 6, 2026 05:096,40398,715,62469,422,0001,006,0002,359,296
12Jan 6, 2026 05:096,40495,807,56669,441,0001,006,0002,289,664
13Jan 6, 2026 05:096,40693,048,35270,468,00002,363,392
14Jan 6, 2026 05:096,40792,570,25069,467,0001,006,0002,289,664
15Jan 6, 2026 05:096,41299,467,83769,525,0001,007,0002,359,296
16Jan 6, 2026 05:096,41696,827,98669,569,0001,008,0002,289,664
17Jan 6, 2026 05:096,437101,190,06269,810,000997,0002,367,488
18Jan 6, 2026 05:096,47894,079,02870,251,0001,003,0002,355,200