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 listJan 6, 2026 03:48Josu San MartinJosu San MartinScore: 6,813Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 6, 2026 03:446,80697,918,53872,865,0001,996,0002,281,472
2Jan 6, 2026 03:486,806105,295,67572,872,0001,996,0002,437,120
3Jan 6, 2026 03:446,80999,885,97572,902,0001,997,0002,531,328
4Jan 6, 2026 03:446,810100,973,14372,917,0001,997,0002,277,376
5Jan 6, 2026 03:446,813101,450,66372,942,0001,998,0002,281,472
6Jan 6, 2026 03:446,813100,890,98572,943,0001,998,0002,441,216
7Jan 6, 2026 03:446,81397,095,88072,950,0001,998,0002,441,216
8Jan 6, 2026 03:446,815104,168,32572,962,0001,998,0002,281,472
9Jan 6, 2026 03:486,81999,073,65273,014,0002,000,0002,433,024
10Jan 6, 2026 03:446,82197,043,75573,026,0002,000,0002,281,472
11Jan 6, 2026 03:446,82198,419,12873,031,0002,000,0002,281,472
12Jan 6, 2026 03:486,82897,395,02773,108,0002,002,0002,281,472