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 listMay 20, 2021 05:41Sergey StreminSergey StreminError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 5, 2026 05:53Tomislav Tunkovic41.15CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 06:18010,956,0371,299,000028,672Exit with code 101: thread 'main' panicked at 'internal error: entered unreachable code', main.rs:202:14 note: run with `RUST_BACKTRACE=1` environment variable to display a backtracestderr
2May 17, 2021 16:396,15095,045,00066,637,0001,009,0002,277,376
3May 17, 2021 16:396,15192,518,44067,660,00002,371,584
4May 17, 2021 16:396,15192,987,12766,649,0001,009,0002,277,376
5May 17, 2021 16:406,15294,866,87366,667,0001,010,0002,371,584
6May 20, 2021 05:416,15492,719,62565,678,0002,020,0002,375,680
7May 20, 2021 05:416,158123,362,76767,736,50402,207,744
8May 20, 2021 05:416,159131,378,27667,753,43302,199,552
9May 17, 2021 16:406,15992,160,11867,749,00002,375,680
10May 17, 2021 16:396,16695,542,28066,829,000997,0002,277,376
11May 17, 2021 16:386,16797,508,19565,838,0001,995,0002,367,488
12May 17, 2021 16:406,16796,504,46567,841,00002,277,376
13May 17, 2021 16:386,16894,245,10966,855,000997,0002,277,376
14May 17, 2021 16:386,16895,332,96666,854,000997,0002,379,776
15May 17, 2021 16:386,16898,552,21966,850,000997,0002,277,376
16May 17, 2021 16:406,16896,347,15866,846,000997,0002,277,376
17May 17, 2021 16:406,16895,790,30166,847,000997,0002,371,584
18May 17, 2021 16:396,16891,690,47065,849,0001,995,0002,277,376
19May 20, 2021 05:416,168100,353,87966,846,000997,0002,375,680
20May 20, 2021 05:416,16893,372,16267,845,00002,371,584
21May 17, 2021 16:386,16994,749,65065,864,0001,995,0002,371,584
22May 17, 2021 16:406,16992,087,86666,861,000997,0002,375,680
23May 17, 2021 16:406,169102,516,78164,861,0002,993,0002,277,376
24May 20, 2021 05:416,17095,312,78266,871,000998,0002,281,472
25May 20, 2021 05:416,17197,564,29265,888,0001,996,0002,277,376
26May 17, 2021 16:396,17297,849,12665,893,0001,996,0002,371,584
27May 20, 2021 05:416,17297,379,07265,899,0001,996,0002,371,584
28May 17, 2021 16:386,17496,998,44163,916,0003,994,0002,277,376
29May 17, 2021 16:386,17794,638,62165,954,0001,998,0002,367,488
30May 20, 2021 05:416,17789,682,59265,950,0001,998,0002,277,376
31May 17, 2021 16:386,17898,836,57165,961,0001,998,0002,379,776
32May 17, 2021 16:406,17893,936,09666,964,000999,0002,281,472
33May 17, 2021 16:396,18096,079,55865,979,0001,999,0002,277,376
34May 17, 2021 16:386,18194,857,45766,992,000999,0002,277,376
35May 20, 2021 05:416,185100,060,40866,032,0002,000,0002,277,376
36May 20, 2021 05:416,187128,841,64668,057,56202,207,744
37May 17, 2021 16:396,19194,050,82365,096,0003,004,0002,277,376
38May 17, 2021 16:396,19196,104,25067,096,0001,001,0002,371,584
39May 17, 2021 16:406,19194,183,49266,098,0002,002,0002,367,488
40May 20, 2021 05:416,20487,993,76266,234,0002,007,0002,277,376