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 listMar 9, 2026 17:45Daniel MastalerzDaniel MastalerzScore: 7,057Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 9, 2026 17:457,043100,234,04676,463,0001,006,0002,277,376
2Mar 9, 2026 17:457,044104,549,78177,489,00002,535,424
3Mar 9, 2026 17:457,053108,051,13376,580,0001,007,0002,273,280
4Mar 9, 2026 17:457,056107,829,55776,611,0001,008,0002,289,664
5Mar 9, 2026 17:457,057105,214,01676,623,0001,008,0002,277,376
6Mar 9, 2026 17:457,063107,685,58577,697,00002,289,664
7Mar 9, 2026 17:457,074103,700,00575,820,0001,995,0002,289,664
8Mar 9, 2026 17:457,076104,573,32976,836,000997,0002,531,328
9Mar 9, 2026 17:457,087106,246,05175,963,0001,999,0002,289,664