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 01:36Yuriy LyfenkoYuriy LyfenkoScore: 3,296Success
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 02:193,27863,320,32134,059,0002,003,0002,256,896
2Mar 20, 2026 01:333,28361,525,63334,108,0002,006,0002,519,040
3Mar 20, 2026 01:333,28662,239,67734,134,0002,007,0002,383,872
4Mar 20, 2026 02:193,28664,047,70935,143,0001,004,0002,387,968
5Mar 20, 2026 01:333,28762,870,49634,149,0002,008,0002,375,680
6Mar 20, 2026 02:193,28763,388,56734,144,0002,008,0002,519,040
7Mar 20, 2026 01:333,28860,895,91634,161,0002,009,0002,506,752
8Mar 20, 2026 02:193,28965,957,43834,172,0002,010,0002,375,680
9Mar 20, 2026 02:193,29169,836,91134,187,0002,011,0002,519,040
10Mar 20, 2026 01:333,29270,760,10934,198,0002,011,0002,256,896
11Mar 20, 2026 01:363,29665,716,23135,247,0001,007,0002,392,064
12Mar 20, 2026 01:363,29767,340,23434,256,0002,015,0002,260,992
13Mar 20, 2026 01:333,30163,391,69836,311,00002,260,992
14Mar 20, 2026 02:193,30163,347,75835,304,0001,008,0002,519,040
15Mar 20, 2026 02:193,30262,429,12036,324,00002,502,656
16Mar 20, 2026 01:333,30657,116,93436,366,00002,519,040
17Mar 20, 2026 01:333,30860,044,62936,384,00002,383,872
18Mar 20, 2026 01:333,31159,465,63935,415,0001,011,0002,383,872
19Mar 20, 2026 02:193,31458,126,19535,439,0001,012,0002,506,752
20Mar 20, 2026 02:193,31659,769,55736,472,00002,465,792
21Mar 20, 2026 01:363,31857,277,72636,503,00002,519,040