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 27, 2026 18:11Victor MerckléVictor MerckléScore: 48,350Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 27, 2026 18:1148,307548,693,615529,380,0002,001,0002,347,008stderr
2Apr 27, 2026 18:1148,319548,820,928528,518,0002,997,0002,359,296stderr
3Apr 27, 2026 18:1148,338553,103,409528,725,0002,998,0002,322,432stderr
4Apr 27, 2026 18:1148,345549,815,870526,803,0004,998,0002,334,720stderr
5Apr 27, 2026 18:1148,350547,407,610528,860,0002,999,0002,428,928stderr
6Apr 27, 2026 18:1148,351550,589,595529,872,0001,999,0002,359,296stderr
7Apr 27, 2026 18:1148,395546,626,225529,354,0002,996,0002,359,296stderr
8Apr 27, 2026 18:1148,405553,957,155529,462,0002,996,0002,334,720stderr
9Apr 27, 2026 18:1148,882556,237,152534,710,0002,998,0002,355,200stderr