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 22, 2021 22:29Yuriy LyfenkoYuriy LyfenkoError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 06:45C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 06:45029,108,89218,664,0001,165,0002,138,112expected "2 ", got "19 "
2Sep 8, 2026 06:45029,170,27518,618,0001,116,0002,138,112expected "2 ", got "19 "
3Sep 8, 2026 06:45029,021,48318,586,0001,147,0002,138,112expected "2 ", got "19 "
4May 22, 2021 22:296,28789,947,73367,156,0002,004,0002,334,720
5May 22, 2021 22:296,28892,441,72367,162,0002,004,0002,523,136
6May 22, 2021 22:296,30089,589,70766,283,0003,012,0002,334,720
7May 22, 2021 22:296,30396,090,09166,314,0003,014,0002,334,720
8May 22, 2021 22:296,31191,242,93766,399,0003,018,0002,318,336
9May 22, 2021 22:296,31192,366,45267,409,0002,012,0002,334,720
10May 22, 2021 22:296,314122,330,79469,457,32902,183,168
11May 22, 2021 22:296,31794,663,71868,477,0001,007,0002,334,720
12May 22, 2021 22:296,31993,958,31368,498,0001,007,0002,527,232
13May 22, 2021 22:296,32090,308,63668,508,0001,007,0002,334,720
14May 22, 2021 22:296,335133,426,12269,684,97902,191,360
15May 22, 2021 22:296,345134,122,14069,791,01502,183,168