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 listSep 27, 2025 07:12Wookyung JeongWookyung JeongScore: 31,462Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 27, 2025 07:1231,431370,288,067323,761,00021,983,0002,502,656
2Sep 27, 2025 07:1231,444371,267,535323,895,00021,992,0002,367,488
3Sep 27, 2025 07:1231,447370,130,716321,928,00023,994,0002,351,104
4Sep 27, 2025 07:1231,452372,496,991323,975,00021,998,0002,277,376
5Sep 27, 2025 07:1231,462367,628,948318,075,00028,006,0002,355,200
6Sep 27, 2025 07:1231,471369,825,028321,168,00025,013,0002,404,352
7Sep 27, 2025 07:1231,473366,627,484327,194,00019,011,0002,494,464
8Sep 27, 2025 07:1231,520373,267,731322,737,00023,980,0002,519,040
9Sep 27, 2025 07:1231,526368,014,780325,804,00020,987,0002,338,816