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 21:38Andrew EpsteinAndrew EpsteinScore: 21,193Success
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 21:3921,169243,188,778231,698,0001,169,0002,117,632stderr
2Sep 26, 2026 21:3921,179243,729,521231,873,0001,099,0002,117,632stderr
3Sep 26, 2026 21:3921,182243,346,908231,905,0001,105,0002,117,632stderr
4Sep 26, 2026 21:3921,186243,309,697231,918,0001,132,0002,117,632stderr
5Sep 26, 2026 21:3921,193243,474,638232,035,0001,089,0002,117,632stderr
6Sep 26, 2026 21:3921,211243,756,452232,106,0001,222,0002,117,632stderr
7Sep 26, 2026 21:3921,231243,799,015232,383,0001,158,0002,117,632stderr
8Sep 26, 2026 21:3921,241244,051,120232,509,0001,142,0002,117,632stderr
9Sep 26, 2026 21:3921,806250,145,600238,783,0001,087,0002,117,632stderr