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 21:20Josu San MartinJosu San MartinScore: 8,519Success
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 21:208,488121,853,39592,368,0001,004,0002,322,432
2Jan 5, 2026 20:598,490121,320,22292,385,0001,004,0002,322,432
3Jan 5, 2026 20:598,495117,793,60993,443,00002,326,528
4Jan 5, 2026 20:598,504117,463,65492,540,0001,005,0002,576,384
5Jan 5, 2026 20:598,513119,588,50891,632,0002,013,0002,572,288
6Jan 5, 2026 20:598,518116,467,44091,706,0001,993,0002,334,720
7Jan 5, 2026 21:208,519119,231,45392,699,0001,007,0002,326,528
8Jan 5, 2026 20:598,534122,303,38391,881,0001,997,0002,318,336
9Jan 5, 2026 20:598,539121,932,71191,934,0001,998,0002,572,288
10Jan 5, 2026 20:598,556114,345,60792,110,0002,002,0002,580,480
11Jan 5, 2026 20:598,557120,136,20592,124,0002,002,0002,568,192
12Jan 5, 2026 21:208,563117,549,44792,184,0002,004,0002,568,192