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, 2025 13:03Alex KentAlex KentScore: 437,417Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 31, 2025 13:03436,4864,832,698,2084,762,366,00038,978,0002,285,568
2Aug 31, 2025 13:03436,5504,828,695,6384,768,066,00033,979,0002,285,568
3Aug 31, 2025 13:03436,5894,833,189,3024,759,506,00042,977,0002,506,752
4Aug 31, 2025 13:03437,0544,841,616,0094,765,627,00041,970,0002,519,040
5Aug 31, 2025 13:03437,4174,836,764,5664,781,604,00029,984,0002,277,376
6Aug 31, 2025 13:03438,2684,849,546,5814,778,968,00041,982,0002,277,376
7Aug 31, 2025 13:03438,4774,847,974,7484,791,264,00031,981,0002,277,376
8Aug 31, 2025 13:03443,4214,910,527,2354,843,644,00033,983,0002,277,376
9Aug 31, 2025 13:03446,1264,936,469,4584,872,410,00034,981,0002,277,376