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:08TudyMTudyMScore: 4,417Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 28, 2026 00:094,38969,839,49746,273,0002,011,0002,371,584
2Apr 28, 2026 00:094,40967,627,84847,499,0001,010,0002,371,584
3Apr 28, 2026 00:094,41364,579,94847,542,0001,011,0002,367,488
4Apr 28, 2026 00:094,41371,026,45547,535,0001,011,0002,363,392
5Apr 28, 2026 00:094,41764,869,28247,578,0001,012,0002,301,952
6Apr 28, 2026 00:094,42364,995,23547,641,0001,013,0002,457,600
7Apr 28, 2026 00:094,42367,928,87445,614,0003,040,0002,371,584
8Apr 28, 2026 00:094,42468,558,71147,656,0001,013,0002,367,488
9Apr 28, 2026 00:094,43464,712,75546,788,0001,991,0002,371,584