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 30, 2026 14:30janwwwjanwwwScore: 2,483Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 30, 2026 14:312,47934,749,90027,269,000020,480
2Nov 30, 2026 14:312,47935,309,58927,272,000020,480
3Nov 30, 2026 14:312,48135,075,43227,297,000020,480
4Nov 30, 2026 14:312,48235,235,95727,308,000020,480
5Nov 30, 2026 14:312,48335,366,07127,316,000020,480
6Nov 30, 2026 14:312,48434,787,18927,324,000020,480
7Nov 30, 2026 14:312,48934,907,86527,387,000020,480
8Nov 30, 2026 14:312,49236,527,27227,414,000020,480
9Nov 30, 2026 14:312,52135,189,95627,737,000020,480