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 listMar 18, 2026 20:57lipapipalipapipaScore: 4,436Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 18, 2026 20:574,41682,202,57347,567,0001,012,0002,560,000
2Mar 18, 2026 20:574,42777,846,77346,714,0001,987,0002,560,000
3Mar 18, 2026 20:574,43377,022,77748,762,00002,560,000
4Mar 18, 2026 20:574,43677,197,57946,805,0001,991,0002,560,000
5Mar 18, 2026 20:574,43675,678,82447,802,000995,0002,306,048
6Mar 18, 2026 20:574,43676,076,27046,807,0001,991,0002,428,928
7Mar 18, 2026 20:574,43673,054,84147,804,000995,0002,445,312
8Mar 18, 2026 20:574,43676,227,21348,800,00002,560,000
9Mar 18, 2026 20:574,43778,678,74246,814,0001,992,0002,441,216