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 listMar 19, 2026 02:13Dominique GarmierDominique GarmierScore: 10,125Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 19, 2026 01:3010,077137,011,139110,844,00002,277,376
2Mar 19, 2026 01:3010,094137,188,509110,029,0001,000,0002,289,664
3Mar 19, 2026 01:3010,101141,360,498109,112,0002,002,0002,269,184
4Mar 19, 2026 01:3010,106136,413,469109,166,0002,003,0002,289,664
5Mar 19, 2026 01:3010,112134,549,079109,227,0002,004,0002,273,280
6Mar 19, 2026 02:1310,116144,476,626109,267,0002,004,0002,289,664
7Mar 19, 2026 01:3010,125138,084,500109,370,0002,006,0002,289,664
8Mar 19, 2026 01:3010,125137,578,919110,377,0001,003,0002,289,664
9Mar 19, 2026 01:3010,133142,176,445109,454,0002,008,0002,273,280
10Mar 19, 2026 02:1310,142140,872,544110,562,0001,005,0002,289,664
11Mar 19, 2026 02:1310,167142,635,672110,826,0001,007,0002,379,776
12Mar 19, 2026 01:3010,172139,093,326109,890,0001,998,0002,289,664