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 07:33olliecrowolliecrowScore: 3,149Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 27, 2026 07:333,13661,585,63534,495,00002,404,352
2Mar 27, 2026 07:333,13760,197,91433,491,0001,014,0002,277,376
3Mar 27, 2026 07:333,13955,315,09933,513,0001,015,0002,277,376
4Mar 27, 2026 07:333,14056,597,73033,524,0001,015,0002,277,376
5Mar 27, 2026 07:333,14060,596,07934,543,00002,387,968
6Mar 27, 2026 07:333,14256,160,82433,547,0001,016,0002,277,376
7Mar 27, 2026 07:333,14258,625,90133,550,0001,016,0002,396,160
8Mar 27, 2026 07:333,14263,232,96134,567,00002,277,376
9Mar 27, 2026 07:333,14462,538,44634,588,00002,396,160
10Mar 27, 2026 07:333,14464,017,12034,579,00002,277,376
11Mar 27, 2026 07:333,14564,264,38733,575,0001,017,0002,490,368
12Mar 27, 2026 07:333,14665,761,84234,608,00002,396,160
13Mar 27, 2026 07:333,14663,803,21234,611,00002,392,064
14Mar 27, 2026 07:333,14767,692,05033,598,0001,018,0002,277,376
15Mar 27, 2026 07:333,14763,988,12734,615,00002,396,160
16Mar 27, 2026 07:333,14966,358,65533,624,0001,018,0002,404,352
17Mar 27, 2026 07:333,14958,495,76833,618,0001,018,0002,396,160
18Mar 27, 2026 07:333,15159,233,03433,647,0001,019,0002,277,376
19Mar 27, 2026 07:333,15268,096,49733,657,0001,019,0002,392,064
20Mar 27, 2026 07:333,15463,041,26233,672,0001,020,0002,404,352
21Mar 27, 2026 07:333,16555,991,27132,827,0001,989,0002,408,448
22Mar 27, 2026 07:333,16762,165,38034,838,00002,277,376
23Mar 27, 2026 07:333,16859,625,52834,846,00002,400,256
24Mar 27, 2026 07:333,16863,416,22232,861,0001,991,0002,277,376
25Mar 27, 2026 07:333,16863,714,41832,853,0001,991,0002,277,376
26Mar 27, 2026 07:333,16965,693,82833,862,000995,0002,404,352
27Mar 27, 2026 07:333,16959,900,82333,860,000995,0002,392,064
28Mar 27, 2026 07:333,17356,638,42932,914,0001,994,0002,277,376
29Mar 27, 2026 07:333,17461,858,53932,919,0001,995,0002,277,376
30Mar 27, 2026 07:333,17659,352,79633,941,000998,0002,277,376