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 04:31Josu San MartinJosu San MartinScore: 6,716Success
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 04:216,69797,602,53472,655,0001,009,0002,281,472
2Jan 6, 2026 04:256,71097,039,45871,811,0001,994,0002,281,472
3Jan 6, 2026 04:216,713103,591,75071,850,0001,995,0002,281,472
4Jan 6, 2026 04:316,71395,494,70571,849,0001,995,0002,433,024
5Jan 6, 2026 04:216,71497,388,73871,857,0001,996,0002,445,312
6Jan 6, 2026 04:216,715101,197,86471,864,0001,996,0002,433,024
7Jan 6, 2026 04:216,715102,350,89371,871,0001,996,0002,281,472
8Jan 6, 2026 04:256,71698,345,63471,878,0001,996,0002,281,472
9Jan 6, 2026 04:256,71898,372,18871,901,0001,997,0002,437,120
10Jan 6, 2026 04:316,720103,417,82171,923,0001,997,0002,281,472
11Jan 6, 2026 04:216,725101,954,48671,971,0001,999,0002,281,472
12Jan 6, 2026 04:216,73796,124,07172,106,0002,002,0002,281,472
13Jan 6, 2026 04:216,739100,619,10272,131,0002,003,0002,437,120
14Jan 6, 2026 04:216,782102,143,27973,592,0001,008,0002,281,472
15Jan 6, 2026 04:316,804106,086,07173,844,000997,0002,281,472