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 14, 2025 19:53Aniruddha DebAniruddha DebError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 17:38C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 17:39017,018,8477,632,0001,060,0002,117,632expected "2 ", got "0 "
2Sep 7, 2026 17:39017,083,8537,657,0001,057,0002,117,632expected "2 ", got "0 "
3Sep 7, 2026 17:39017,071,2107,650,0001,056,0002,117,632expected "2 ", got "0 "
4Aug 14, 2025 19:533,61267,755,84938,711,0001,018,0002,433,024
5Aug 14, 2025 19:533,62264,052,09439,839,00002,531,328
6Aug 14, 2025 19:533,62368,332,06039,848,00002,428,928
7Aug 14, 2025 19:533,62461,991,59638,870,000996,0002,424,832
8Aug 14, 2025 19:533,63159,101,47738,942,000998,0002,531,328
9Aug 14, 2025 19:533,63963,591,81239,033,0001,000,0002,428,928