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 20:53olliecrowolliecrowScore: 23,028Success
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 20:5622,975272,050,057250,736,0001,997,0002,531,328
2Apr 22, 2026 20:5623,001261,361,332251,018,0002,000,0002,375,680
3Apr 22, 2026 20:5623,010272,427,816251,119,0002,000,0002,510,848
4Apr 22, 2026 20:5623,020261,498,998250,218,0003,002,0002,371,584
5Apr 22, 2026 20:5623,028271,724,614251,306,0002,002,0002,527,232
6Apr 22, 2026 20:5623,042261,863,628252,471,0001,001,0002,359,296
7Apr 22, 2026 20:5623,046260,742,086252,509,0001,006,0002,359,296
8Apr 22, 2026 20:5623,068260,997,675251,756,0001,998,0002,359,296
9Apr 22, 2026 20:5623,123261,677,430251,352,0003,004,0002,355,200