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 listDec 23, 2025 13:30Yehor BondarYehor BondarScore: 560,026Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 23, 2025 13:30552,4006,108,402,4536,045,418,00030,986,0002,523,136
2Dec 23, 2025 13:30554,8886,133,052,3536,068,778,00034,987,0002,265,088
3Dec 23, 2025 13:30555,9866,142,002,7416,076,872,00038,979,0002,277,376
4Dec 23, 2025 13:30556,0846,150,036,5496,089,936,00026,986,0002,523,136
5Dec 23, 2025 13:30560,0266,186,908,7476,121,306,00038,976,0002,277,376
6Dec 23, 2025 13:30561,8456,209,554,2796,153,308,00026,983,0002,277,376
7Dec 23, 2025 13:30562,6066,212,594,8046,141,693,00046,974,0002,277,376
8Dec 23, 2025 13:30563,9796,231,224,6246,171,793,00031,978,0002,289,664
9Dec 23, 2025 13:30568,3306,289,091,5576,213,660,00037,973,0002,277,376