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 listApr 22, 2026 14:16olliecrowolliecrowScore: 3,203Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 14:173,19349,575,18433,118,0002,007,0002,392,064
2Apr 22, 2026 14:173,19650,429,64133,148,0002,008,0002,461,696
3Apr 22, 2026 14:173,20055,075,96834,195,0001,005,0002,387,968
4Apr 22, 2026 14:173,20252,740,98734,222,0001,006,0002,383,872
5Apr 22, 2026 14:173,20359,111,93934,230,0001,006,0002,379,776
6Apr 22, 2026 14:173,20352,732,60434,231,0001,006,0002,478,080
7Apr 22, 2026 14:173,20551,526,32334,248,0001,007,0002,387,968
8Apr 22, 2026 14:173,20753,293,09634,270,0001,007,0002,383,872
9Apr 22, 2026 14:173,22455,335,87934,451,0001,013,0002,379,776