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 19:25olliecrowolliecrowScore: 3,169Success
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 19:273,14860,608,93233,612,0001,018,0002,400,256
2Mar 29, 2026 19:333,15162,126,86233,639,0001,019,0002,277,376
3Mar 29, 2026 19:293,15160,169,94234,658,00002,396,160
4Mar 29, 2026 19:333,15463,572,27034,699,00002,277,376
5Mar 29, 2026 19:343,15566,776,13234,710,00002,277,376
6Mar 29, 2026 19:293,15566,912,05433,688,0001,020,0002,396,160
7Mar 29, 2026 19:383,16567,030,32033,817,000994,0002,277,376
8Mar 29, 2026 19:313,16561,305,77534,820,00002,277,376
9Mar 29, 2026 19:253,16763,810,08432,849,0001,990,0002,277,376
10Mar 29, 2026 19:383,16759,646,47332,846,0001,990,0002,277,376
11Mar 29, 2026 19:283,16758,674,52634,842,00002,277,376
12Mar 29, 2026 19:283,16764,802,29434,837,00002,277,376
13Mar 29, 2026 19:283,16762,673,97333,847,000995,0002,392,064
14Mar 29, 2026 19:263,16763,319,54433,847,000995,0002,277,376
15Mar 29, 2026 19:403,16760,362,27532,849,0001,990,0002,277,376
16Mar 29, 2026 19:283,16862,112,90633,854,000995,0002,392,064
17Mar 29, 2026 19:383,16861,884,92834,848,00002,400,256
18Mar 29, 2026 19:383,16860,856,37033,856,000995,0002,277,376
19Mar 29, 2026 19:383,16865,391,67032,859,0001,991,0002,277,376
20Mar 29, 2026 19:343,16862,841,78333,851,000995,0002,277,376
21Mar 29, 2026 19:263,16860,158,92333,854,000995,0002,400,256
22Mar 29, 2026 19:273,16863,058,01533,853,000995,0002,404,352
23Mar 29, 2026 19:363,16960,912,37533,868,000996,0002,277,376
24Mar 29, 2026 19:383,16961,623,67333,863,000995,0002,404,352
25Mar 29, 2026 19:393,16960,152,97133,865,000996,0002,277,376
26Mar 29, 2026 19:293,16957,838,51233,835,0001,025,0002,404,352
27Mar 29, 2026 19:363,17060,656,89033,870,000996,0002,277,376
28Mar 29, 2026 19:403,17057,041,19934,872,00002,277,376
29Mar 29, 2026 19:273,17161,373,65032,891,0001,993,0002,277,376
30Mar 29, 2026 19:393,17161,747,98632,890,0001,993,0002,277,376
31Mar 29, 2026 19:273,17162,667,03334,886,00002,277,376
32Mar 29, 2026 19:393,17357,451,00032,914,0001,994,0002,400,256
33Mar 29, 2026 19:333,17361,269,17132,907,0001,994,0002,408,448
34Mar 29, 2026 19:283,17358,058,75533,911,000997,0002,277,376
35Mar 29, 2026 19:343,17359,003,79333,909,000997,0002,277,376
36Mar 29, 2026 19:273,17360,837,70632,908,0001,994,0002,277,376
37Mar 29, 2026 19:313,17363,638,21032,905,0001,994,0002,400,256
38Mar 29, 2026 19:283,17458,231,76233,914,000997,0002,277,376
39Mar 29, 2026 19:403,17562,818,97932,929,0001,995,0002,277,376
40Mar 29, 2026 19:313,17560,316,01033,927,000997,0002,277,376
41Mar 29, 2026 19:273,17756,609,68932,954,0001,997,0002,404,352
42Mar 29, 2026 19:363,18261,971,59434,006,0001,000,0002,400,256
43Mar 29, 2026 19:253,18253,446,21433,000,0002,000,0002,400,256
44Mar 29, 2026 19:253,18362,276,13933,008,0002,000,0002,277,376
45Mar 29, 2026 19:263,19357,022,33734,117,0001,003,0002,277,376