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 16, 2021 21:34Andrey TsvetkovAndrey TsvetkovError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 8, 2026 17:31C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 8, 2026 17:31087,675,35469,107,0001,202,0002,138,112expected "2 ", got "0 "
2Sep 8, 2026 17:31089,712,70369,131,0001,166,0002,138,112expected "2 ", got "0 "
3Sep 8, 2026 17:31087,792,72269,254,0001,197,0002,138,112expected "2 ", got "0 "
4Jun 16, 2021 21:3412,254162,061,072133,796,000998,0002,330,624
5Jun 16, 2021 21:3412,260161,106,145131,861,0002,996,0002,330,624
6Jun 16, 2021 21:3412,262195,506,582134,877,11402,191,360
7Jun 16, 2021 21:3412,279159,165,404132,068,0003,001,0002,326,528
8Jun 16, 2021 21:3412,287157,621,740133,158,0002,002,0002,330,624
9Jun 16, 2021 21:3412,294157,939,000133,229,0002,003,0002,502,656
10Jun 16, 2021 21:3412,296158,590,957133,250,0002,003,0002,314,240
11Jun 16, 2021 21:3412,300157,305,255132,294,0003,006,0002,519,040
12Jun 16, 2021 21:3412,312158,766,443133,429,0002,006,0002,310,144
13Jun 16, 2021 21:3412,315159,047,900133,459,0002,006,0002,314,240
14Jun 16, 2021 21:3412,326199,076,080135,590,41402,187,264
15Jun 16, 2021 21:3412,330199,863,289135,625,07902,183,168