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 13:31Jin KimJin KimScore: 623,784Success
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 13:31605,1896,682,643,2726,617,099,00039,976,0002,277,376
2Sep 26, 2025 13:31616,4586,807,428,2516,740,060,00040,976,0002,277,376
3Sep 26, 2025 13:31620,2286,849,709,3376,784,537,00037,975,0002,285,568
4Sep 26, 2025 13:31623,7446,895,466,9886,825,206,00035,980,0002,285,568
5Sep 26, 2025 13:31623,7846,892,776,2436,835,644,00025,983,0002,277,376
6Sep 26, 2025 13:31625,3716,907,262,2226,834,114,00044,967,0002,285,568
7Sep 26, 2025 13:31626,3336,917,822,3976,849,691,00039,974,0002,277,376
8Sep 26, 2025 13:31627,5206,934,648,2606,867,739,00034,978,0002,355,200
9Sep 26, 2025 13:31638,2077,044,923,8816,977,305,00042,971,0002,277,376