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 listAug 16, 2026 11:53marko1597marko1597Score: 169,978Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 16, 2026 11:57169,4121,872,061,5671,862,483,0001,058,0002,121,728stderr
2Aug 16, 2026 11:57169,6451,875,356,1881,865,095,0001,001,0002,121,728stderr
3Aug 16, 2026 11:57169,9361,878,522,8851,868,278,0001,027,0002,121,728stderr
4Aug 16, 2026 11:57169,9671,878,190,1091,868,634,0001,003,0002,121,728stderr
5Aug 16, 2026 11:57169,9781,879,022,1601,868,729,0001,032,0002,121,728stderr
6Aug 16, 2026 11:57170,0341,879,942,4491,869,286,0001,097,0002,121,728stderr
7Aug 16, 2026 11:57170,1011,879,829,9231,870,116,0001,000,0002,121,728stderr
8Aug 16, 2026 11:57170,2271,881,019,4211,871,498,0001,007,0002,121,728stderr
9Aug 16, 2026 11:57170,3771,883,015,6161,873,149,0001,002,0002,121,728stderr