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:20olliecrowolliecrowScore: 3,153Success
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:203,13955,610,57633,519,0001,015,0002,396,160
2Mar 27, 2026 03:203,14360,914,79234,568,00002,392,064
3Mar 27, 2026 03:203,14461,083,60833,562,0001,017,0002,277,376
4Mar 27, 2026 03:203,14660,759,21334,606,00002,277,376
5Mar 27, 2026 03:203,14760,116,16933,594,0001,018,0002,277,376
6Mar 27, 2026 03:203,14761,195,43333,597,0001,018,0002,396,160
7Mar 27, 2026 03:203,14860,081,98133,608,0001,018,0002,404,352
8Mar 27, 2026 03:203,14960,483,48933,625,0001,018,0002,277,376
9Mar 27, 2026 03:203,15163,879,91333,645,0001,019,0002,277,376
10Mar 27, 2026 03:203,15260,880,24933,652,0001,019,0002,277,376
11Mar 27, 2026 03:203,15360,333,24934,680,00002,277,376
12Mar 27, 2026 03:203,15766,019,35534,731,00002,277,376
13Mar 27, 2026 03:203,16662,728,84333,836,000995,0002,510,848
14Mar 27, 2026 03:203,16761,104,88133,842,000995,0002,277,376
15Mar 27, 2026 03:203,16760,331,52134,833,00002,400,256
16Mar 27, 2026 03:203,16867,546,95533,849,000995,0002,277,376
17Mar 27, 2026 03:203,16862,283,58233,858,000995,0002,277,376
18Mar 27, 2026 03:203,16964,481,71833,866,000996,0002,277,376
19Mar 27, 2026 03:203,17161,438,54333,886,000996,0002,277,376
20Mar 27, 2026 03:203,17155,388,15933,886,000996,0002,498,560
21Mar 27, 2026 03:203,18156,247,71333,990,000999,0002,400,256