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 listJan 6, 2026 23:03Josu San MartinJosu San MartinScore: 4,460Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 23:054,44673,053,63046,915,0001,996,0002,441,216
2Jan 6, 2026 23:024,45171,726,22746,963,0001,998,0002,437,120
3Jan 6, 2026 23:024,45279,242,82246,971,0001,998,0002,437,120
4Jan 6, 2026 23:034,45376,481,34446,981,0001,999,0002,441,216
5Jan 6, 2026 23:024,45672,958,56447,020,0002,000,0002,281,472
6Jan 6, 2026 23:114,45674,134,83547,014,0002,000,0002,281,472
7Jan 6, 2026 23:054,45773,330,58447,022,0002,000,0002,281,472
8Jan 6, 2026 23:044,45772,659,19347,029,0002,001,0002,281,472
9Jan 6, 2026 23:024,45871,301,87347,038,0002,001,0002,441,216
10Jan 6, 2026 23:114,45971,965,81347,046,0002,001,0002,281,472
11Jan 6, 2026 23:114,46074,050,47547,056,0002,002,0002,433,024
12Jan 6, 2026 23:044,46073,047,54447,061,0002,002,0002,441,216
13Jan 6, 2026 23:024,46071,054,15747,060,0002,002,0002,437,120
14Jan 6, 2026 23:044,46373,442,45547,094,0002,004,0002,433,024
15Jan 6, 2026 23:034,46671,526,36849,125,00002,437,120
16Jan 6, 2026 23:024,46673,679,96547,124,0002,005,0002,281,472
17Jan 6, 2026 23:024,46671,843,47047,120,0002,005,0002,433,024
18Jan 6, 2026 23:034,47277,767,57047,182,0002,007,0002,428,928
19Jan 6, 2026 23:024,47570,426,52247,213,0002,009,0002,281,472
20Jan 6, 2026 23:054,47671,859,43047,229,0002,009,0002,281,472
21Jan 6, 2026 23:024,48075,463,05748,270,0001,005,0002,437,120