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 31, 2024 21:36Yuriy LyfenkoYuriy LyfenkoError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 03:57C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 03:57010,520,792797,000020,480No answer to stdout. Died or killed?
2Sep 8, 2026 03:57022,507,18711,468,0001,028,0002,113,536expected "2 ", got "0 "
3Sep 8, 2026 03:57022,534,31711,575,0001,017,0002,113,536expected "2 ", got "0 "
4Aug 31, 2024 21:363,82267,420,67141,046,0001,001,0002,265,088
5Aug 31, 2024 21:363,83471,242,37441,170,0001,004,0002,383,872
6Aug 31, 2024 21:353,84266,408,14540,252,0002,012,0002,527,232
7Aug 31, 2024 21:363,85963,206,35441,434,0001,010,0002,265,088
8Aug 31, 2024 21:363,86762,785,46641,529,0001,012,0002,392,064
9Aug 31, 2024 21:353,87070,335,03541,555,0001,013,0002,265,088
10Aug 31, 2024 21:353,87173,986,88041,565,0001,013,0002,265,088
11Aug 31, 2024 21:353,87269,076,05141,580,0001,014,0002,396,160
12Aug 31, 2024 21:353,87573,320,06942,630,00002,392,064
13Aug 31, 2024 21:353,87770,115,17541,637,0001,015,0002,396,160
14Aug 31, 2024 21:363,87868,842,37542,658,00002,527,232
15Aug 31, 2024 21:363,87872,674,64441,638,0001,015,0002,396,160
16Aug 31, 2024 21:353,87867,630,61041,640,0001,015,0002,387,968
17Aug 31, 2024 21:363,87967,929,28441,655,0001,015,0002,510,848
18Aug 31, 2024 21:363,88067,314,43941,663,0001,016,0002,527,232
19Aug 31, 2024 21:363,89374,194,90541,831,000995,0002,265,088
20Aug 31, 2024 21:363,89374,153,55741,832,000996,0002,265,088
21Aug 31, 2024 21:353,89371,919,77941,832,000996,0002,260,992
22Aug 31, 2024 21:363,89469,098,42040,840,0001,992,0002,265,088
23Aug 31, 2024 21:353,89471,398,26440,845,0001,992,0002,510,848
24Aug 31, 2024 21:353,89468,211,41540,847,0001,992,0002,527,232
25Aug 31, 2024 21:353,89578,482,97840,852,0001,992,0002,265,088
26Aug 31, 2024 21:353,90067,743,36641,903,000997,0002,265,088
27Aug 31, 2024 21:363,90067,925,09740,900,0001,995,0002,506,752