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 listOct 16, 2026 22:33izotoffizotoffScore: 499,304Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 16, 2026 22:36497,6075,486,113,1565,370,604,000103,074,0002,138,112
2Oct 16, 2026 22:36497,6335,486,823,7975,372,926,000101,038,0002,138,112
3Oct 16, 2026 22:36497,6655,487,102,0295,371,267,000103,053,0002,183,168
4Oct 16, 2026 22:36498,3215,494,578,6895,378,457,000103,078,0002,138,112
5Oct 16, 2026 22:36499,3045,504,155,0035,385,231,000107,120,0002,150,400
6Oct 16, 2026 22:36499,3135,505,358,4675,389,194,000103,252,0002,138,112
7Oct 16, 2026 22:36499,5395,507,773,2265,389,890,000105,044,0002,150,400
8Oct 16, 2026 22:36501,3515,529,287,4245,410,813,000104,053,0002,138,112
9Oct 16, 2026 22:36501,9145,533,648,0675,415,963,000105,100,0002,138,112