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 01:02olliecrowolliecrowScore: 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 01:023,13661,340,96933,487,0001,014,0002,396,160
2Mar 27, 2026 01:023,13764,458,15134,509,00002,400,256
3Mar 27, 2026 01:043,13961,069,67933,516,0001,015,0002,404,352
4Mar 27, 2026 01:023,13960,772,44834,533,00002,277,376
5Mar 27, 2026 01:043,14158,101,28733,537,0001,016,0002,277,376
6Mar 27, 2026 01:023,14255,647,78934,558,00002,277,376
7Mar 27, 2026 01:023,14259,540,86534,563,00002,277,376
8Mar 27, 2026 01:043,14359,494,08834,571,00002,277,376
9Mar 27, 2026 01:023,14356,580,97433,556,0001,016,0002,404,352
10Mar 27, 2026 01:023,14354,957,20533,559,0001,016,0002,277,376
11Mar 27, 2026 01:023,14360,043,25134,573,00002,510,848
12Mar 27, 2026 01:023,14356,549,07633,559,0001,016,0002,277,376
13Mar 27, 2026 01:043,14455,276,02533,566,0001,017,0002,277,376
14Mar 27, 2026 01:043,14460,837,25533,563,0001,017,0002,486,272
15Mar 27, 2026 01:043,14459,640,18734,582,00002,277,376
16Mar 27, 2026 01:043,14465,047,37933,563,0001,017,0002,392,064
17Mar 27, 2026 01:043,14558,586,25433,580,0001,017,0002,510,848
18Mar 27, 2026 01:043,14564,862,72133,582,0001,017,0002,387,968
19Mar 27, 2026 01:043,14561,968,23833,583,0001,017,0002,277,376
20Mar 27, 2026 01:043,14664,540,41033,586,0001,017,0002,277,376
21Mar 27, 2026 01:023,14659,373,23034,608,00002,277,376
22Mar 27, 2026 01:013,14760,882,56433,595,0001,018,0002,404,352
23Mar 27, 2026 01:013,14964,408,77534,639,00002,277,376
24Mar 27, 2026 01:013,14959,701,75533,626,0001,018,0002,277,376
25Mar 27, 2026 01:023,15064,328,08933,632,0001,019,0002,277,376
26Mar 27, 2026 01:023,15162,632,05133,637,0001,019,0002,277,376
27Mar 27, 2026 01:043,15159,089,64233,638,0001,019,0002,404,352
28Mar 27, 2026 01:043,15260,966,09634,672,00002,277,376
29Mar 27, 2026 01:023,15360,416,64634,685,00002,277,376
30Mar 27, 2026 01:043,15467,402,11933,677,0001,020,0002,277,376
31Mar 27, 2026 01:043,16760,979,87134,838,00002,277,376
32Mar 27, 2026 01:043,16862,582,89033,849,000995,0002,392,064
33Mar 27, 2026 01:043,16861,327,85532,854,0001,991,0002,400,256
34Mar 27, 2026 01:043,16963,228,77433,864,000996,0002,396,160
35Mar 27, 2026 01:043,16963,771,76033,860,000995,0002,277,376
36Mar 27, 2026 01:023,16962,280,35033,859,000995,0002,277,376
37Mar 27, 2026 01:043,17063,983,08032,880,0001,992,0002,277,376
38Mar 27, 2026 01:043,17063,424,98232,873,0001,992,0002,396,160
39Mar 27, 2026 01:023,17361,032,34133,910,000997,0002,277,376
40Mar 27, 2026 01:043,17357,760,44634,902,00002,400,256
41Mar 27, 2026 01:043,17455,831,62732,922,0001,995,0002,277,376
42Mar 27, 2026 01:043,17567,307,11133,924,000997,0002,490,368
43Mar 27, 2026 01:023,17665,143,76432,938,0001,996,0002,400,256
44Mar 27, 2026 01:023,17756,865,17833,944,000998,0002,400,256
45Mar 27, 2026 01:023,18057,540,92233,983,000999,0002,400,256