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 30, 2026 01:38olliecrowolliecrowScore: 3,216Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 30, 2026 01:393,18550,338,96233,036,0002,002,0002,383,872
2Apr 30, 2026 01:393,19352,454,44133,119,0002,007,0002,387,968
3Apr 30, 2026 01:393,20256,885,03933,212,0002,012,0002,379,776
4Apr 30, 2026 01:393,21454,701,20733,395,0001,964,0002,383,872
5Apr 30, 2026 01:393,21652,587,25734,369,0001,010,0002,379,776
6Apr 30, 2026 01:393,22154,795,67134,427,0001,012,0002,326,528
7Apr 30, 2026 01:393,22455,828,29634,455,0001,013,0002,379,776
8Apr 30, 2026 01:393,22550,272,45134,472,0001,013,0002,326,528
9Apr 30, 2026 01:393,23154,796,91734,533,0001,015,0002,375,680