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 27, 2026 22:20Andrew EpsteinAndrew EpsteinScore: 25,443Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 27, 2026 22:2225,373289,548,381277,898,0001,212,0002,117,632stderr
2Sep 27, 2026 22:2225,403289,851,467278,296,0001,137,0002,117,632stderr
3Sep 27, 2026 22:2225,416289,865,978278,419,0001,165,0002,117,632stderr
4Sep 27, 2026 22:2225,428290,099,402278,549,0001,165,0002,117,632stderr
5Sep 27, 2026 22:2225,443290,180,728278,652,0001,226,0002,117,632stderr
6Sep 27, 2026 22:2225,450290,285,430278,828,0001,130,0002,117,632stderr
7Sep 27, 2026 22:2225,505290,863,135279,304,0001,256,0002,117,632stderr
8Sep 27, 2026 22:2225,505290,844,911279,552,0001,003,0002,117,632stderr
9Sep 27, 2026 22:2225,507291,163,878279,376,0001,203,0002,117,632stderr