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 listApr 25, 2026 06:46Charles CabergsCharles CabergsScore: 8,068Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 25, 2026 06:478,049110,488,16887,538,0001,006,0002,519,040stderr
2Apr 25, 2026 06:478,060107,369,58187,655,0001,007,0002,527,232stderr
3Apr 25, 2026 06:478,063104,986,93987,695,0001,007,0002,535,424stderr
4Apr 25, 2026 06:478,068107,093,38386,754,0001,994,0002,519,040stderr
5Apr 25, 2026 06:478,068103,191,28686,759,0001,994,0002,314,240stderr
6Apr 25, 2026 06:478,071104,729,44886,793,0001,995,0002,519,040stderr
7Apr 25, 2026 06:478,075107,322,43586,839,0001,996,0002,514,944stderr
8Apr 25, 2026 06:478,081107,786,09886,895,0001,997,0002,510,848stderr
9Apr 25, 2026 06:478,082104,491,43787,905,000998,0002,514,944stderr