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

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:15C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:16018,602,2477,728,0001,022,0002,113,536expected "2 ", got "0 "
2Sep 8, 2026 07:16018,565,6807,625,0001,017,0002,117,632expected "2 ", got "0 "
3Sep 8, 2026 07:16018,535,1097,642,0001,012,0002,113,536expected "2 ", got "0 "
4Mar 27, 2026 08:323,13856,313,78333,505,0001,015,0002,277,376
5Mar 27, 2026 08:323,14253,087,55833,544,0001,016,0002,277,376
6Mar 27, 2026 08:323,14255,702,03934,567,00002,396,160
7Mar 27, 2026 08:323,14363,041,42233,555,0001,016,0002,404,352
8Mar 27, 2026 08:323,14358,361,19733,555,0001,016,0002,404,352
9Mar 27, 2026 08:323,14462,919,04734,586,00002,400,256
10Mar 27, 2026 08:323,14465,654,66333,565,0001,017,0002,277,376
11Mar 27, 2026 08:323,14462,654,08033,568,0001,017,0002,277,376
12Mar 27, 2026 08:323,14561,053,11234,595,00002,277,376
13Mar 27, 2026 08:323,14664,001,81833,590,0001,017,0002,277,376
14Mar 27, 2026 08:323,14665,650,40834,606,00002,277,376
15Mar 27, 2026 08:323,14861,909,56734,631,00002,404,352
16Mar 27, 2026 08:323,15063,238,98333,627,0001,019,0002,408,448
17Mar 27, 2026 08:323,15060,612,83533,634,0001,019,0002,494,464
18Mar 27, 2026 08:323,15260,716,07334,672,00002,408,448
19Mar 27, 2026 08:323,15567,004,68733,684,0001,020,0002,404,352
20Mar 27, 2026 08:323,16663,181,59733,829,000994,0002,277,376
21Mar 27, 2026 08:323,16866,657,03132,862,0001,991,0002,408,448
22Mar 27, 2026 08:323,16862,502,72232,854,0001,991,0002,277,376
23Mar 27, 2026 08:323,16864,255,98632,859,0001,991,0002,277,376
24Mar 27, 2026 08:323,16863,073,18133,858,000995,0002,400,256
25Mar 27, 2026 08:323,16961,237,25133,866,000996,0002,277,376
26Mar 27, 2026 08:323,16964,502,95633,863,000995,0002,277,376
27Mar 27, 2026 08:323,17156,492,47832,889,0001,993,0002,277,376