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 26, 2026 19:52TudyMTudyMScore: 17,492Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 26, 2026 19:5217,472208,042,435191,195,0001,001,0002,527,232
2Apr 26, 2026 19:5217,475207,550,873190,227,0002,002,0002,330,624
3Apr 26, 2026 19:5217,476212,400,379191,243,0001,001,0002,314,240
4Apr 26, 2026 19:5217,479212,087,215191,278,0001,001,0002,535,424
5Apr 26, 2026 19:5217,492212,115,222190,416,0002,004,0002,527,232
6Apr 26, 2026 19:5217,495213,500,223191,444,0001,002,0002,527,232
7Apr 26, 2026 19:5217,523208,439,981190,764,0001,997,0002,523,136
8Apr 26, 2026 19:5217,534212,129,544191,877,000999,0002,527,232
9Apr 26, 2026 19:5217,538212,737,877191,921,000999,0002,519,040