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 listDec 23, 2025 13:29Yehor BondarYehor BondarScore: 477,701Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 23, 2025 13:29476,3045,270,534,4575,145,393,00093,952,0002,318,336
2Dec 23, 2025 13:29476,4375,277,321,7195,137,888,000102,917,0002,322,432
3Dec 23, 2025 13:29476,8065,273,026,9405,137,915,000106,956,0002,347,008
4Dec 23, 2025 13:29477,4785,281,806,1325,134,340,000117,915,0002,310,144
5Dec 23, 2025 13:29477,7015,288,687,0595,149,782,000104,934,0002,347,008
6Dec 23, 2025 13:29478,5135,299,837,8095,161,707,000101,934,0002,347,008
7Dec 23, 2025 13:29478,8725,298,375,8175,163,658,000103,932,0002,379,776
8Dec 23, 2025 13:29480,2205,311,449,3235,176,469,000105,948,0002,347,008
9Dec 23, 2025 13:29480,9885,320,912,7075,176,938,000113,932,0002,428,928