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 listJun 20, 2021 14:50Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 07:35C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 07:35062,443,31152,588,0001,185,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 07:35062,074,25352,386,0001,165,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 07:35061,777,71752,160,0001,083,0002,138,112expected "2 ", got "0 "
4Jun 20, 2021 14:4411,851153,045,416128,359,0002,005,0002,330,624
5Jun 20, 2021 14:5011,863157,058,340128,482,0002,007,0002,510,848
6Jun 20, 2021 14:5011,864157,678,304128,497,0002,007,0002,506,752
7Jun 20, 2021 14:4411,869153,483,798128,553,0002,008,0002,510,848
8Jun 20, 2021 14:4211,870161,139,712128,563,0002,008,0002,514,944
9Jun 20, 2021 14:4211,871153,004,158128,569,0002,008,0002,510,848
10Jun 20, 2021 14:4211,873157,627,683128,593,0002,009,0002,330,624
11Jun 20, 2021 14:4211,875164,178,490128,619,0002,009,0002,330,624
12Jun 20, 2021 14:5011,875159,324,706128,615,0002,009,0002,330,624
13Jun 20, 2021 14:4411,876155,476,329129,634,0001,004,0002,310,144
14Jun 20, 2021 14:4211,880155,689,388129,670,0001,005,0002,330,624
15Jun 20, 2021 14:4411,880159,722,815129,672,0001,005,0002,502,656
16Jun 20, 2021 14:4411,880161,589,018128,667,0002,010,0002,330,624
17Jun 20, 2021 14:4211,881158,769,100128,698,0001,995,0002,326,528
18Jun 20, 2021 14:4211,887203,789,646130,759,91302,187,264
19Jun 20, 2021 14:5011,888195,924,078130,767,62702,191,360
20Jun 20, 2021 14:5011,889203,027,984130,774,21202,179,072
21Jun 20, 2021 14:5011,890153,958,076127,790,0002,995,0002,506,752
22Jun 20, 2021 14:4411,894162,658,144128,835,0001,997,0002,519,040
23Jun 20, 2021 14:4211,895163,646,080128,847,0001,997,0002,514,944
24Jun 20, 2021 14:4211,895157,537,324129,850,000998,0002,330,624
25Jun 20, 2021 14:4211,895159,038,933128,853,0001,997,0002,502,656
26Jun 20, 2021 14:5011,895155,501,624128,847,0001,997,0002,506,752
27Jun 20, 2021 14:5011,895155,131,209128,846,0001,997,0002,375,680
28Jun 20, 2021 14:4411,898155,366,345127,879,0002,997,0002,514,944
29Jun 20, 2021 14:4411,899154,145,733127,887,0002,997,0002,330,624
30Jun 20, 2021 14:5011,900164,822,090128,902,0001,998,0002,510,848
31Jun 20, 2021 14:4211,903198,248,267130,938,00002,179,072
32Jun 20, 2021 14:4411,903190,658,236130,930,63102,187,264
33Jun 20, 2021 14:5011,903159,345,479127,934,0002,998,0002,330,624
34Jun 20, 2021 14:4411,906198,247,638130,962,01102,187,264
35Jun 20, 2021 14:4411,910157,429,280129,012,0002,000,0002,510,848
36Jun 20, 2021 14:5011,915153,654,979129,062,0002,000,0002,506,752
37Jun 20, 2021 14:4411,916191,115,039131,076,45902,187,264
38Jun 20, 2021 14:4211,917196,554,101131,091,58102,183,168
39Jun 20, 2021 14:5011,917200,019,335131,087,65502,187,264