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 29, 2026 18:29olliecrowolliecrowScore: 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 29, 2026 18:263,15365,883,60934,685,00002,396,160
2Mar 29, 2026 18:303,15460,047,89633,671,0001,020,0002,400,256
3Mar 29, 2026 18:273,16764,208,22733,846,000995,0002,277,376
4Mar 29, 2026 18:263,16858,632,18432,857,0001,991,0002,482,176
5Mar 29, 2026 18:273,16963,714,36932,872,0001,992,0002,400,256
6Mar 29, 2026 18:293,17063,412,65132,878,0001,992,0002,396,160
7Mar 29, 2026 18:303,17066,060,65533,871,000996,0002,277,376
8Mar 29, 2026 18:263,17361,899,49133,909,000997,0002,277,376
9Mar 29, 2026 18:303,17362,742,23032,907,0001,994,0002,392,064
10Mar 29, 2026 18:293,17656,957,10932,938,0001,996,0002,392,064
11Mar 29, 2026 18:293,17759,087,55933,954,000998,0002,400,256
12Mar 29, 2026 18:273,18057,886,76933,986,000999,0002,392,064