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 listJun 21, 2026 21:04A_ShamanA_ShamanScore: 41,046Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jun 21, 2026 21:0440,997459,982,454449,828,0001,140,0002,113,536
2Jun 21, 2026 21:0441,014460,131,175450,104,0001,056,0002,113,536
3Jun 21, 2026 21:0441,032460,358,606450,300,0001,061,0002,113,536
4Jun 21, 2026 21:0441,034460,415,523450,311,0001,069,0002,113,536
5Jun 21, 2026 21:0441,046460,671,722450,312,0001,203,0002,113,536
6Jun 21, 2026 21:0441,083460,954,034450,845,0001,078,0002,113,536
7Jun 21, 2026 21:0441,105461,183,067451,088,0001,075,0002,113,536
8Jun 21, 2026 21:0441,121461,499,059451,173,0001,168,0002,113,536
9Jun 21, 2026 21:0441,141461,613,634451,481,0001,070,0002,113,536