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 23, 2026 14:20Charles CabergsCharles CabergsScore: 7,958Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 23, 2026 14:207,936107,511,64986,298,0001,003,0002,523,136stderr
2Apr 23, 2026 14:207,942106,190,05586,358,0001,004,0002,519,040stderr
3Apr 23, 2026 14:207,947103,234,64686,417,0001,004,0002,519,040stderr
4Apr 23, 2026 14:207,950105,233,61985,448,0002,010,0002,498,560stderr
5Apr 23, 2026 14:207,958111,950,05385,534,0002,012,0002,514,944stderr
6Apr 23, 2026 14:207,961101,452,35186,565,0001,006,0002,523,136stderr
7Apr 23, 2026 14:207,964103,846,19185,600,0002,014,0002,326,528stderr
8Apr 23, 2026 14:207,964103,673,83486,601,0001,006,0002,523,136stderr
9Apr 23, 2026 14:207,966106,254,59685,622,0002,014,0002,519,040stderr