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 listSep 26, 2026 20:51Andrew EpsteinAndrew EpsteinScore: 37,267Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 26, 2026 20:5837,200419,476,343408,203,0001,005,0002,117,632stderr
2Sep 26, 2026 20:5837,230419,839,180408,527,0001,007,0002,117,632stderr
3Sep 26, 2026 20:5837,230419,872,652408,533,0001,002,0002,117,632stderr
4Sep 26, 2026 20:5837,257420,125,127408,643,0001,193,0002,117,632stderr
5Sep 26, 2026 20:5837,267420,231,069408,739,0001,208,0002,117,632stderr
6Sep 26, 2026 20:5837,273420,286,141408,810,0001,201,0002,117,632stderr
7Sep 26, 2026 20:5837,311420,762,108409,214,0001,213,0002,117,632stderr
8Sep 26, 2026 20:5837,342421,069,561409,550,0001,219,0002,117,632stderr
9Sep 26, 2026 20:5837,403421,761,721410,210,0001,228,0002,117,632stderr