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 listApr 28, 2026 00:14TudyMTudyMError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 09:34Tomislav Tunkovic12.64CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 09:35079,086,07462,984,0005,155,00016,384No answer to stdout. Died or killed?
2Apr 28, 2026 00:154,17262,747,90343,897,0001,995,0002,367,488
3Apr 28, 2026 00:154,17361,690,66943,909,0001,995,0002,306,048
4Apr 28, 2026 00:154,17561,250,35843,938,0001,997,0002,428,928
5Apr 28, 2026 00:154,17664,857,28243,949,0001,997,0002,363,392
6Apr 28, 2026 00:154,17867,336,98243,968,0001,998,0002,367,488
7Apr 28, 2026 00:154,18062,204,20343,990,0001,999,0002,367,488
8Apr 28, 2026 00:154,18569,041,98944,041,0002,001,0002,367,488
9Apr 28, 2026 00:154,18662,834,51844,051,0002,002,0002,371,584
10Apr 28, 2026 00:154,19761,709,06845,172,0001,003,0002,301,952