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 05:17Josu San MartinJosu San MartinScore: 6,369Success
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 05:096,34897,895,95169,828,00002,289,664
2Jan 6, 2026 05:096,35094,696,88368,852,000997,0002,367,488
3Jan 6, 2026 05:176,350104,741,83668,856,000997,0002,363,392
4Jan 6, 2026 05:176,35196,020,78268,862,000998,0002,289,664
5Jan 6, 2026 05:096,353100,172,09569,884,00002,363,392
6Jan 6, 2026 05:176,35397,894,93069,887,00002,289,664
7Jan 6, 2026 05:096,35894,109,60467,939,0001,998,0002,363,392
8Jan 6, 2026 05:096,36094,611,37668,963,000999,0002,289,664
9Jan 6, 2026 05:176,36495,554,45768,005,0002,000,0002,285,568
10Jan 6, 2026 05:096,36996,175,64269,058,0001,000,0002,289,664
11Jan 6, 2026 05:176,372102,038,91768,088,0002,002,0002,289,664
12Jan 6, 2026 05:176,37291,617,54268,095,0002,002,0002,355,200
13Jan 6, 2026 05:176,37494,084,26568,107,0002,003,0002,289,664
14Jan 6, 2026 05:176,39099,185,08669,289,0001,004,0002,289,664
15Jan 6, 2026 05:096,39294,836,70970,313,00002,289,664
16Jan 6, 2026 05:096,39292,309,48568,308,0002,009,0002,289,664
17Jan 6, 2026 05:096,39695,673,56369,351,0001,005,0002,289,664
18Jan 6, 2026 05:176,56996,592,52870,250,0002,007,0002,289,664