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:11Wookyung JeongWookyung JeongScore: 36,803Success
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:1136,781437,436,395380,613,00023,975,0002,400,256
2Sep 26, 2025 18:1136,792429,141,854375,732,00028,979,0002,424,832
3Sep 26, 2025 18:1136,793426,955,438377,747,00026,981,0002,342,912
4Sep 26, 2025 18:1136,798427,835,597376,791,00027,984,0002,371,584
5Sep 26, 2025 18:1136,803433,295,879379,844,00024,989,0002,396,160
6Sep 26, 2025 18:1136,806427,880,430374,875,00029,990,0002,351,104
7Sep 26, 2025 18:1136,808428,788,625384,890,00019,994,0002,441,216
8Sep 26, 2025 18:1136,813427,183,718380,943,00023,996,0002,277,376
9Sep 26, 2025 18:1136,891430,085,165373,822,00031,984,0002,314,240