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 20, 2026 07:57Dominique GarmierDominique GarmierScore: 7,499Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 20, 2026 12:167,482112,327,35281,300,0001,003,0002,326,528
2Mar 20, 2026 07:577,484111,515,66580,320,0002,008,0002,326,528
3Mar 20, 2026 12:167,488110,475,08881,363,0001,004,0002,326,528
4Mar 20, 2026 03:157,496109,739,39281,452,0001,005,0002,330,624
5Mar 20, 2026 03:157,499112,684,03181,485,0001,005,0002,326,528
6Mar 20, 2026 07:577,501104,133,74281,508,0001,006,0002,502,656
7Mar 20, 2026 12:167,513113,839,88581,638,0001,007,0002,498,560
8Mar 20, 2026 07:577,539112,058,93480,934,0001,998,0002,293,760
9Mar 20, 2026 03:157,546108,083,82281,003,0002,000,0002,318,336