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 15:20Wookyung JeongWookyung JeongScore: 116,430Success
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 15:20116,1271,307,098,8251,139,459,000137,934,0002,338,816
2Sep 26, 2025 15:20116,2321,304,252,4151,135,601,000142,949,0002,375,680
3Sep 26, 2025 15:20116,3811,310,377,4771,142,282,000137,913,0002,473,984
4Sep 26, 2025 15:20116,3821,307,300,3591,145,285,000134,915,0002,347,008
5Sep 26, 2025 15:20116,4301,308,793,1801,132,763,000147,969,0002,285,568
6Sep 26, 2025 15:20116,6361,311,743,9541,124,122,000158,875,0002,486,272
7Sep 26, 2025 15:20116,6371,316,245,4991,131,122,000151,882,0002,433,024
8Sep 26, 2025 15:20116,7971,311,833,8271,149,790,000134,975,0002,424,832
9Sep 26, 2025 15:20117,8721,327,802,4561,166,636,000129,959,0002,433,024