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:17BenBenScore: 23,738Success
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:1823,643276,048,642167,052,00093,029,0002,424,832
2Apr 22, 2026 12:1823,662280,344,801167,188,00093,104,0002,457,600
3Apr 22, 2026 12:1823,700277,056,796166,812,00093,894,0002,387,968
4Apr 22, 2026 12:1823,717278,647,931165,928,00094,959,0002,293,760
5Apr 22, 2026 12:1823,738279,249,623167,076,00094,043,0002,453,504
6Apr 22, 2026 12:1823,747279,640,374166,138,00095,079,0002,322,432
7Apr 22, 2026 12:1823,787283,353,600166,783,00094,876,0002,498,560
8Apr 22, 2026 12:1823,798279,281,564166,859,00094,920,0002,498,560
9Apr 22, 2026 12:1823,840281,273,568167,158,00095,090,0002,293,760