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 listOct 29, 2025 23:23Abdulazizov M.Abdulazizov M.Score: 611,861Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 29, 2025 23:23605,9556,695,275,8526,636,525,00028,984,0002,277,376
2Oct 29, 2025 23:23610,3996,749,387,1016,690,411,00023,983,0002,510,848
3Oct 29, 2025 23:23610,9366,747,820,4556,680,325,00039,972,0002,265,088
4Oct 29, 2025 23:23611,6486,758,209,6986,678,162,00049,963,0002,281,472
5Oct 29, 2025 23:23611,8616,757,209,2836,709,478,00020,988,0002,277,376
6Oct 29, 2025 23:23612,1276,760,643,6286,699,416,00033,976,0002,519,040
7Oct 29, 2025 23:23613,6476,778,980,0806,712,136,00037,978,0002,285,568
8Oct 29, 2025 23:23620,5446,854,713,3346,797,007,00028,982,0002,277,376
9Oct 29, 2025 23:23657,5327,260,739,4937,196,872,00035,979,0002,277,376