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 06:09olliecrowolliecrowScore: 3,154Success
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 06:093,13259,261,87233,436,0001,013,0002,404,352
2Mar 27, 2026 06:093,13559,551,32134,486,00002,277,376
3Mar 27, 2026 06:093,13856,736,26334,517,00002,482,176
4Mar 27, 2026 06:093,14060,266,10534,543,00002,396,160
5Mar 27, 2026 06:093,14060,694,43433,525,0001,015,0002,277,376
6Mar 27, 2026 06:093,14264,913,02133,544,0001,016,0002,392,064
7Mar 27, 2026 06:093,14461,352,15334,584,00002,277,376
8Mar 27, 2026 06:093,14463,160,69633,570,0001,017,0002,400,256
9Mar 27, 2026 06:093,14560,621,71533,578,0001,017,0002,396,160
10Mar 27, 2026 06:093,14563,806,22633,583,0001,017,0002,277,376
11Mar 27, 2026 06:093,14762,996,09134,614,00002,277,376
12Mar 27, 2026 06:093,15262,467,21833,653,0001,019,0002,277,376
13Mar 27, 2026 06:093,15465,116,56133,674,0001,020,0002,404,352
14Mar 27, 2026 06:093,15460,048,69333,669,0001,020,0002,408,448
15Mar 27, 2026 06:093,15567,712,66634,708,00002,392,064
16Mar 27, 2026 06:093,15662,011,59233,698,0001,021,0002,404,352
17Mar 27, 2026 06:093,16662,013,17732,835,0001,990,0002,404,352
18Mar 27, 2026 06:093,16761,243,13533,845,000995,0002,277,376
19Mar 27, 2026 06:093,16860,664,63732,857,0001,991,0002,400,256
20Mar 27, 2026 06:093,17059,237,10632,882,0001,992,0002,277,376
21Mar 27, 2026 06:093,17161,145,18132,889,0001,993,0002,277,376
22Mar 27, 2026 06:093,17362,332,47933,909,000997,0002,277,376
23Mar 27, 2026 06:093,17457,145,79832,915,0001,994,0002,486,272
24Mar 27, 2026 06:093,17560,852,53932,925,0001,995,0002,277,376