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 listAug 5, 2022 22:02Eugene ZhydzetskiEugene ZhydzetskiError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 15:59C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 15:590119,465,955109,665,0001,178,0002,134,016expected "1 ", got "0 "
2Sep 7, 2026 15:590119,364,521109,493,0001,173,0002,134,016expected "1 ", got "0 "
3Sep 7, 2026 15:590119,306,466109,517,0001,164,0002,134,016expected "1 ", got "0 "
4Aug 5, 2022 22:0216,663204,793,172181,295,0002,003,0002,334,720
5Aug 5, 2022 22:0116,664244,562,986183,302,92302,203,648
6Aug 5, 2022 22:0216,668249,600,883183,348,11702,207,744
7Aug 5, 2022 22:0116,668206,840,204183,347,00002,334,720
8Aug 5, 2022 22:0116,671205,730,916182,375,0001,002,0002,531,328
9Aug 5, 2022 22:0116,671209,396,293182,374,0001,002,0002,334,720
10Aug 5, 2022 22:0216,673204,311,614182,401,0001,002,0002,334,720
11Aug 5, 2022 22:0116,674205,643,155181,408,0002,004,0002,363,392
12Aug 5, 2022 22:0116,681204,780,311183,487,00002,334,720
13Aug 5, 2022 22:0216,683244,209,023183,515,95502,211,840
14Aug 5, 2022 22:0116,684209,261,764182,527,0001,002,0002,334,720
15Aug 5, 2022 22:0216,685209,049,989182,534,0001,002,0002,535,424
16Aug 5, 2022 22:0116,686210,303,127183,542,00002,531,328
17Aug 5, 2022 22:0216,688221,461,202182,570,0001,003,0002,334,720
18Aug 5, 2022 22:0116,690257,881,188183,590,91802,207,744
19Aug 5, 2022 22:0116,694208,796,249182,633,0001,003,0002,281,472
20Aug 5, 2022 22:0216,695208,367,854182,641,0001,003,0002,334,720
21Aug 5, 2022 22:0116,697214,628,100180,668,0002,994,0002,334,720
22Aug 5, 2022 22:0216,698213,056,036183,678,00002,334,720
23Aug 5, 2022 22:0116,699248,914,515183,690,75602,207,744
24Aug 5, 2022 22:0216,703251,735,431183,729,67202,199,552
25Aug 5, 2022 22:0216,713211,392,184183,848,00002,281,472
26Aug 5, 2022 22:0216,714213,137,787181,858,0001,998,0002,535,424
27Aug 5, 2022 22:0216,740207,028,116181,141,0003,002,0002,330,624