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 30, 2026 22:28olliecrowolliecrowScore: 3,170Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 30, 2026 22:303,15066,078,52133,634,0001,019,0002,396,160
2Mar 30, 2026 22:273,15260,506,75234,674,00002,277,376
3Mar 30, 2026 22:343,15263,512,47234,674,00002,277,376
4Mar 30, 2026 22:353,15361,361,82633,665,0001,020,0002,387,968
5Mar 30, 2026 22:323,15360,862,86433,664,0001,020,0002,277,376
6Mar 30, 2026 22:293,15565,919,56633,680,0001,020,0002,400,256
7Mar 30, 2026 22:363,15559,207,83834,701,00002,387,968
8Mar 30, 2026 22:353,16562,636,31632,825,0001,989,0002,506,752
9Mar 30, 2026 22:353,16560,604,24532,829,0001,989,0002,277,376
10Mar 30, 2026 22:333,16761,466,49033,847,000995,0002,277,376
11Mar 30, 2026 22:313,16862,224,62532,854,0001,991,0002,400,256
12Mar 30, 2026 22:373,16864,134,83033,854,000995,0002,277,376
13Mar 30, 2026 22:303,16966,527,60132,867,0001,991,0002,400,256
14Mar 30, 2026 22:283,16966,110,39933,867,000996,0002,400,256
15Mar 30, 2026 22:313,16963,671,82333,864,000996,0002,396,160
16Mar 30, 2026 22:333,16960,524,75134,858,00002,400,256
17Mar 30, 2026 22:323,16965,699,95633,864,000996,0002,387,968
18Mar 30, 2026 22:323,16960,187,97632,872,0001,992,0002,400,256
19Mar 30, 2026 22:293,17061,430,73033,877,000996,0002,400,256
20Mar 30, 2026 22:363,17059,578,53333,875,000996,0002,277,376
21Mar 30, 2026 22:363,17064,283,78733,872,000996,0002,392,064
22Mar 30, 2026 22:273,17155,555,49632,885,0001,993,0002,400,256
23Mar 30, 2026 22:293,17159,787,31434,882,00002,510,848
24Mar 30, 2026 22:293,17255,723,37333,893,000996,0002,269,184
25Mar 30, 2026 22:343,17457,307,46433,912,000997,0002,277,376
26Mar 30, 2026 22:293,17456,965,54233,920,000997,0002,404,352
27Mar 30, 2026 22:293,17459,761,11733,914,000997,0002,277,376
28Mar 30, 2026 22:333,17660,043,77332,936,0001,996,0002,281,472
29Mar 30, 2026 22:273,17658,259,24633,935,000998,0002,277,376
30Mar 30, 2026 22:373,17660,907,25633,941,000998,0002,277,376
31Mar 30, 2026 22:343,17758,749,86533,947,000998,0002,498,560
32Mar 30, 2026 22:313,17863,231,28532,965,0001,997,0002,396,160
33Mar 30, 2026 22:283,17957,651,97833,967,000999,0002,510,848
34Mar 30, 2026 22:373,18357,709,11733,008,0002,000,0002,277,376
35Mar 30, 2026 22:283,18559,562,04233,036,0002,002,0002,400,256
36Mar 30, 2026 22:303,18659,768,93833,040,0002,002,0002,396,160