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 08:49olliecrowolliecrowError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:38C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:38018,398,7918,561,00002,117,632expected "2 ", got "0 "
2Sep 8, 2026 07:38018,661,2437,674,0001,038,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 07:38018,631,8417,639,0001,024,0002,117,632expected "2 ", got "0 "
4Mar 27, 2026 08:493,13554,133,33133,467,0001,014,0002,277,376
5Mar 27, 2026 08:493,14160,088,83833,534,0001,016,0002,277,376
6Mar 27, 2026 08:493,14257,140,62534,558,00002,277,376
7Mar 27, 2026 08:493,14364,050,89134,576,00002,404,352
8Mar 27, 2026 08:493,14364,190,65133,561,0001,017,0002,400,256
9Mar 27, 2026 08:493,14463,059,70033,565,0001,017,0002,404,352
10Mar 27, 2026 08:493,14661,365,96734,603,00002,490,368
11Mar 27, 2026 08:493,14659,169,83433,587,0001,017,0002,277,376
12Mar 27, 2026 08:493,14760,388,43533,604,0001,018,0002,277,376
13Mar 27, 2026 08:493,14860,056,49034,626,00002,277,376
14Mar 27, 2026 08:493,14861,814,90034,629,00002,387,968
15Mar 27, 2026 08:493,15059,406,91633,633,0001,019,0002,277,376
16Mar 27, 2026 08:493,15159,312,49934,666,00002,408,448
17Mar 27, 2026 08:493,15163,329,85034,658,00002,277,376
18Mar 27, 2026 08:493,15363,765,77634,687,00002,277,376
19Mar 27, 2026 08:493,16560,450,48932,824,0001,989,0002,482,176
20Mar 27, 2026 08:493,16661,556,75932,834,0001,989,0002,277,376
21Mar 27, 2026 08:493,16758,936,52332,842,0001,990,0002,277,376
22Mar 27, 2026 08:493,16863,077,90633,853,000995,0002,277,376
23Mar 27, 2026 08:493,16960,009,49033,867,000996,0002,277,376
24Mar 27, 2026 08:493,16960,472,25533,865,000996,0002,392,064
25Mar 27, 2026 08:493,16966,099,26833,865,000996,0002,396,160
26Mar 27, 2026 08:493,17061,187,00532,877,0001,992,0002,277,376
27Mar 27, 2026 08:493,17063,424,91234,870,00002,400,256