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 5, 2026 20:55Josu San MartinJosu San MartinScore: 9,032Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 5, 2026 20:558,990122,185,44995,891,0002,996,0002,531,328
2Jan 5, 2026 20:558,995120,467,55396,946,0001,998,0002,531,328
3Jan 5, 2026 20:559,007118,913,27497,074,0002,001,0002,392,064
4Jan 5, 2026 20:559,028123,252,85997,301,0002,006,0002,531,328
5Jan 5, 2026 20:559,032128,799,48898,357,000993,0002,404,352
6Jan 5, 2026 20:559,039124,950,91597,423,0002,008,0002,531,328
7Jan 5, 2026 20:559,046119,939,51597,499,0002,010,0002,535,424
8Jan 5, 2026 20:559,048122,081,63698,528,0001,005,0002,535,424
9Jan 5, 2026 20:559,081122,539,15497,892,0001,997,0002,531,328