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 22, 2026 12:24Dominique GarmierDominique GarmierScore: 7,981Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Apr 22, 2026 12:257,965104,996,39086,617,0001,007,0002,326,528
2Apr 22, 2026 12:257,975108,457,14585,740,0001,993,0002,326,528
3Apr 22, 2026 12:257,978109,951,87685,774,0001,994,0002,322,432
4Apr 22, 2026 12:257,979103,380,19485,782,0001,994,0002,387,968
5Apr 22, 2026 12:257,981104,518,83785,797,0001,995,0002,326,528
6Apr 22, 2026 12:257,984107,767,76885,834,0001,996,0002,387,968
7Apr 22, 2026 12:257,987105,660,64385,866,0001,996,0002,383,872
8Apr 22, 2026 12:257,996109,046,06985,965,0001,999,0002,387,968
9Apr 22, 2026 12:258,002108,005,04387,031,0001,000,0002,392,064