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,348Success
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,1721,307,084,4781,141,007,000136,880,0002,486,272
2Sep 26, 2025 15:20116,2581,308,106,7831,149,856,000128,983,0002,285,568
3Sep 26, 2025 15:20116,3051,305,907,4241,134,430,000144,927,0002,387,968
4Sep 26, 2025 15:20116,3241,302,984,9151,138,613,000140,952,0002,285,568
5Sep 26, 2025 15:20116,3481,306,127,6331,141,851,000137,982,0002,457,600
6Sep 26, 2025 15:20116,5081,312,174,2591,115,509,000166,075,0002,301,952
7Sep 26, 2025 15:20116,6011,310,166,3331,127,663,000154,953,0002,318,336
8Sep 26, 2025 15:20116,6411,308,222,6731,135,156,000147,890,0002,314,240
9Sep 26, 2025 15:20117,0611,317,655,9581,136,712,000150,961,0002,383,872