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 20, 2026 03:23Yuriy LyfenkoYuriy LyfenkoScore: 3,230Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 20, 2026 03:233,21352,640,53534,333,0001,009,0002,269,184
2Mar 20, 2026 03:243,22358,809,42934,444,0001,013,0002,269,184
3Mar 20, 2026 03:243,22358,200,72734,437,0001,012,0002,437,120
4Mar 20, 2026 03:243,22360,443,30934,437,0001,012,0002,531,328
5Mar 20, 2026 03:323,22461,118,57234,455,0001,013,0002,531,328
6Mar 20, 2026 03:233,22567,847,51034,463,0001,013,0002,269,184
7Mar 20, 2026 03:323,22656,373,55634,475,0001,013,0002,531,328
8Mar 20, 2026 03:323,22659,568,24334,472,0001,013,0002,445,312
9Mar 20, 2026 03:233,22660,701,08834,468,0001,013,0002,437,120
10Mar 20, 2026 03:323,22654,763,72334,473,0001,013,0002,531,328
11Mar 20, 2026 03:243,22659,191,26434,475,0001,013,0002,531,328
12Mar 20, 2026 03:243,22653,725,41434,474,0001,013,0002,531,328
13Mar 20, 2026 03:243,22759,837,71034,483,0001,014,0002,531,328
14Mar 20, 2026 03:243,22758,070,02934,483,0001,014,0002,531,328
15Mar 20, 2026 03:233,22753,949,71934,478,0001,014,0002,437,120
16Mar 20, 2026 03:243,22960,953,43834,503,0001,014,0002,269,184
17Mar 20, 2026 03:243,22956,547,28634,500,0001,014,0002,269,184
18Mar 20, 2026 03:243,22956,065,22334,503,0001,014,0002,269,184
19Mar 20, 2026 03:243,23058,478,38634,520,0001,015,0002,269,184
20Mar 20, 2026 03:323,23062,999,27134,519,0001,015,0002,531,328
21Mar 20, 2026 03:233,23160,428,87734,529,0001,015,0002,527,232
22Mar 20, 2026 03:243,23258,927,14734,540,0001,015,0002,531,328
23Mar 20, 2026 03:233,23259,061,12334,535,0001,015,0002,531,328
24Mar 20, 2026 03:243,23365,693,73934,547,0001,016,0002,531,328
25Mar 20, 2026 03:243,23464,058,53834,559,0001,016,0002,269,184
26Mar 20, 2026 03:323,23560,707,68434,572,0001,016,0002,445,312
27Mar 20, 2026 03:323,23663,094,48134,576,0001,016,0002,527,232
28Mar 20, 2026 03:233,23666,661,79534,577,0001,016,0002,531,328
29Mar 20, 2026 03:233,23768,251,40934,592,0001,017,0002,531,328
30Mar 20, 2026 03:323,23857,250,35934,599,0001,017,0002,531,328
31Mar 20, 2026 03:243,23958,676,64734,616,0001,018,0002,531,328
32Mar 20, 2026 03:323,24061,530,28834,622,0001,018,0002,531,328
33Mar 20, 2026 03:243,24160,895,49134,633,0001,018,0002,531,328
34Mar 20, 2026 03:243,24166,598,45734,633,0001,018,0002,531,328
35Mar 20, 2026 03:243,24366,302,68734,655,0001,019,0002,437,120
36Mar 20, 2026 03:233,24659,634,97534,689,0001,020,0002,269,184