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 03:47olliecrowolliecrowScore: 3,152Success
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 03:473,13759,408,26033,493,0001,014,0002,277,376
2Mar 27, 2026 03:473,14256,930,52634,562,00002,277,376
3Mar 27, 2026 03:473,14262,301,02234,559,00002,277,376
4Mar 27, 2026 03:473,14258,211,47233,543,0001,016,0002,277,376
5Mar 27, 2026 03:473,14560,722,10133,583,0001,017,0002,396,160
6Mar 27, 2026 03:473,14565,723,46533,576,0001,017,0002,277,376
7Mar 27, 2026 03:473,14664,864,11634,606,00002,277,376
8Mar 27, 2026 03:473,14863,753,55734,632,00002,277,376
9Mar 27, 2026 03:473,14962,644,06433,625,0001,018,0002,392,064
10Mar 27, 2026 03:473,15059,964,66034,645,00002,396,160
11Mar 27, 2026 03:473,15060,069,57333,632,0001,019,0002,400,256
12Mar 27, 2026 03:473,15062,718,11033,634,0001,019,0002,277,376
13Mar 27, 2026 03:473,15264,718,57633,656,0001,019,0002,277,376
14Mar 27, 2026 03:473,15474,852,93034,694,00002,387,968
15Mar 27, 2026 03:473,15656,585,99533,694,0001,021,0002,396,160
16Mar 27, 2026 03:473,16759,803,71233,842,000995,0002,277,376
17Mar 27, 2026 03:473,16860,372,80334,849,00002,277,376
18Mar 27, 2026 03:473,16857,976,61333,822,0001,024,0002,482,176
19Mar 27, 2026 03:473,16955,832,19032,865,0001,991,0002,396,160
20Mar 27, 2026 03:473,17462,600,74532,917,0001,995,0002,387,968
21Mar 27, 2026 03:473,17456,894,37932,922,0001,995,0002,277,376
22Mar 27, 2026 03:473,17856,013,03032,962,0001,997,0002,387,968
23Mar 27, 2026 03:473,17960,191,24733,972,000999,0002,396,160
24Mar 27, 2026 03:473,18059,912,31333,983,000999,0002,412,544