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 28, 2026 06:08olliecrowolliecrowScore: 3,236Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 28, 2026 06:083,22769,581,07134,481,0001,014,0002,285,568
2Mar 28, 2026 06:203,22857,766,02634,495,0001,014,0002,285,568
3Mar 28, 2026 06:073,22958,369,90835,518,00002,281,472
4Mar 28, 2026 06:203,22958,633,61534,508,0001,014,0002,510,848
5Mar 28, 2026 06:213,23059,992,41534,517,0001,015,0002,396,160
6Mar 28, 2026 06:083,23157,797,53234,523,0001,015,0002,400,256
7Mar 28, 2026 06:203,23155,311,58035,542,00002,285,568
8Mar 28, 2026 06:223,23264,637,91935,551,00002,404,352
9Mar 28, 2026 06:223,23258,995,50334,539,0001,015,0002,400,256
10Mar 28, 2026 06:093,23264,813,79034,534,0001,015,0002,408,448
11Mar 28, 2026 06:203,23258,665,84834,532,0001,015,0002,396,160
12Mar 28, 2026 06:193,23258,360,79534,540,0001,015,0002,285,568
13Mar 28, 2026 06:083,23465,702,45435,573,00002,285,568
14Mar 28, 2026 06:213,23457,314,50834,563,0001,016,0002,408,448
15Mar 28, 2026 06:083,23462,082,20935,576,00002,408,448
16Mar 28, 2026 06:213,23461,573,18134,559,0001,016,0002,285,568
17Mar 28, 2026 06:223,23455,015,20034,562,0001,016,0002,519,040
18Mar 28, 2026 06:213,23463,417,07934,553,0001,016,0002,285,568
19Mar 28, 2026 06:203,23461,318,87935,571,00002,400,256
20Mar 28, 2026 06:223,23562,058,66534,571,0001,016,0002,285,568
21Mar 28, 2026 06:093,23561,756,26934,574,0001,016,0002,400,256
22Mar 28, 2026 06:073,23662,858,90334,576,0001,016,0002,396,160
23Mar 28, 2026 06:193,23662,028,45535,591,00002,416,640
24Mar 28, 2026 06:093,23664,469,12135,593,00002,285,568
25Mar 28, 2026 06:223,23762,180,12635,604,00002,400,256
26Mar 28, 2026 06:083,23762,042,44234,585,0001,017,0002,285,568
27Mar 28, 2026 06:203,23862,504,33134,604,0001,017,0002,400,256
28Mar 28, 2026 06:213,23860,339,73034,606,0001,017,0002,285,568
29Mar 28, 2026 06:083,23965,483,30534,607,0001,017,0002,486,272
30Mar 28, 2026 06:203,23962,635,81035,631,00002,285,568
31Mar 28, 2026 06:193,23961,775,94434,616,0001,018,0002,400,256
32Mar 28, 2026 06:213,23964,111,29434,615,0001,018,0002,400,256
33Mar 28, 2026 06:193,24063,048,34734,620,0001,018,0002,400,256
34Mar 28, 2026 06:083,24063,539,04234,624,0001,018,0002,400,256
35Mar 28, 2026 06:213,24059,164,40235,636,00002,404,352
36Mar 28, 2026 06:213,24063,800,20334,624,0001,018,0002,285,568
37Mar 28, 2026 06:223,24161,564,91035,646,00002,285,568
38Mar 28, 2026 06:213,24161,253,89434,637,0001,018,0002,285,568
39Mar 28, 2026 06:193,24163,177,35234,630,0001,018,0002,285,568
40Mar 28, 2026 06:193,24265,062,28335,666,00002,285,568
41Mar 28, 2026 06:083,24360,412,57035,670,00002,408,448
42Mar 28, 2026 06:203,24361,744,81635,668,00002,400,256
43Mar 28, 2026 06:083,25863,645,79035,840,00002,400,256
44Mar 28, 2026 06:073,25863,259,94133,848,0001,991,0002,400,256
45Mar 28, 2026 06:203,25968,053,11835,847,00002,285,568