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 26, 2025 18:15Wookyung JeongWookyung JeongScore: 31,286Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 26, 2025 18:1531,228371,647,468323,478,00020,029,0002,277,376
2Sep 26, 2025 18:1531,253374,581,698325,792,00017,988,0002,367,488
3Sep 26, 2025 18:1531,267367,918,078321,942,00021,996,0002,334,720
4Sep 26, 2025 18:1531,285368,624,094328,134,00016,006,0002,392,064
5Sep 26, 2025 18:1531,286366,888,723322,136,00022,009,0002,375,680
6Sep 26, 2025 18:1531,336375,314,536325,711,00018,983,0002,310,144
7Sep 26, 2025 18:1531,341365,432,122318,768,00025,981,0002,412,544
8Sep 26, 2025 18:1531,366367,895,761323,026,00022,001,0002,314,240
9Sep 26, 2025 18:1531,429371,604,498324,732,00020,982,0002,469,888