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 listNov 2, 2026 17:43Andrew EpsteinAndrew EpsteinScore: 51,126Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 2, 2026 17:4450,930570,093,186548,667,00011,572,0002,125,824stderr
2Nov 2, 2026 17:4450,973570,444,730548,958,00011,746,0002,125,824stderr
3Nov 2, 2026 17:4451,061571,055,875550,073,00011,605,0002,125,824stderr
4Nov 2, 2026 17:4451,077571,290,129550,401,00011,452,0002,125,824stderr
5Nov 2, 2026 17:4451,126572,280,347550,769,00011,625,0002,125,824stderr
6Nov 2, 2026 17:4451,151572,567,944550,517,00012,153,0002,125,824stderr
7Nov 2, 2026 17:4451,168572,743,506551,248,00011,605,0002,125,824stderr
8Nov 2, 2026 17:4451,195574,235,159551,664,00011,481,0002,125,824stderr
9Nov 2, 2026 17:4451,339582,026,341553,020,00011,718,0002,125,824stderr