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 10, 2025 21:25Aniruddha DebAniruddha DebScore: 5,009Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 10, 2025 21:254,99577,496,08753,942,000998,0002,433,024
2Aug 10, 2025 21:255,00178,198,21053,009,0002,000,0002,424,832
3Aug 10, 2025 21:255,00478,123,84554,049,0001,000,0002,269,184
4Aug 10, 2025 21:255,00573,824,88853,051,0002,001,0002,531,328
5Aug 10, 2025 21:255,00977,310,29455,100,00002,531,328
6Aug 10, 2025 21:255,01380,622,15554,142,0001,002,0002,428,928
7Aug 10, 2025 21:255,02082,071,50454,220,0001,004,0002,531,328
8Aug 10, 2025 21:255,02476,549,34154,265,0001,004,0002,531,328
9Aug 10, 2025 21:255,02781,352,67955,292,00002,437,120