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 27, 2026 05:06olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:53C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:54019,650,1627,710,0001,011,0002,117,632expected "2 ", got "0 "
2Sep 8, 2026 03:54018,513,6577,586,0001,005,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 03:54018,711,9487,672,0001,028,0002,117,632expected "2 ", got "0 "
4Mar 27, 2026 05:063,13760,890,37333,489,0001,014,0002,396,160
5Mar 27, 2026 05:063,13756,697,81633,495,0001,015,0002,277,376
6Mar 27, 2026 05:063,13954,923,95133,515,0001,015,0002,396,160
7Mar 27, 2026 05:063,13958,231,77134,534,00002,277,376
8Mar 27, 2026 05:063,13960,666,21033,514,0001,015,0002,392,064
9Mar 27, 2026 05:063,14258,673,16534,563,00002,392,064
10Mar 27, 2026 05:063,14465,753,51034,580,00002,277,376
11Mar 27, 2026 05:063,14467,622,09634,580,00002,277,376
12Mar 27, 2026 05:063,14659,658,82734,604,00002,277,376
13Mar 27, 2026 05:063,14663,039,80133,593,0001,017,0002,277,376
14Mar 27, 2026 05:063,14766,728,23234,615,00002,404,352
15Mar 27, 2026 05:063,14863,383,36234,625,00002,396,160
16Mar 27, 2026 05:063,14865,689,19834,625,00002,277,376
17Mar 27, 2026 05:063,15065,302,74933,633,0001,019,0002,404,352
18Mar 27, 2026 05:063,15364,631,38533,692,000990,0002,400,256
19Mar 27, 2026 05:063,15361,955,01434,687,00002,404,352
20Mar 27, 2026 05:063,15463,124,28234,699,00002,277,376
21Mar 27, 2026 05:063,16461,297,32433,813,000994,0002,277,376
22Mar 27, 2026 05:063,16669,894,19332,841,0001,990,0002,277,376
23Mar 27, 2026 05:063,16867,208,65833,851,000995,0002,404,352
24Mar 27, 2026 05:063,16855,687,62533,856,000995,0002,277,376
25Mar 27, 2026 05:063,16963,505,17433,865,000996,0002,277,376
26Mar 27, 2026 05:063,17059,279,79432,882,0001,992,0002,404,352
27Mar 27, 2026 05:063,17259,440,91633,895,000996,0002,392,064