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 25, 2026 18:23Charles CabergsCharles CabergsScore: 7,726Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 25, 2026 18:247,717102,949,96082,899,0001,997,0002,523,136stderr
2Apr 25, 2026 18:247,718101,993,54482,904,0001,997,0002,334,720stderr
3Apr 25, 2026 18:247,720102,992,71382,926,0001,998,0002,527,232stderr
4Apr 25, 2026 18:247,721107,750,04882,934,0001,998,0002,519,040stderr
5Apr 25, 2026 18:247,726109,662,84182,995,0001,999,0002,514,944stderr
6Apr 25, 2026 18:247,727105,278,55084,004,0001,000,0002,519,040stderr
7Apr 25, 2026 18:247,734102,191,92483,075,0002,001,0002,519,040stderr
8Apr 25, 2026 18:247,737104,753,46883,108,0002,002,0002,510,848stderr
9Apr 25, 2026 18:247,739101,402,14583,131,0002,003,0002,519,040stderr