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 20, 2026 03:21Yuriy LyfenkoYuriy LyfenkoScore: 3,271Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 20, 2026 03:213,25766,898,88633,834,0001,990,0002,256,896
2Mar 20, 2026 03:213,26562,925,31234,918,000997,0002,383,872
3Mar 20, 2026 03:213,27062,998,24933,974,0001,998,0002,260,992
4Mar 20, 2026 03:213,27068,968,84833,975,0001,998,0002,383,872
5Mar 20, 2026 03:213,27168,521,73833,985,0001,999,0002,256,896
6Mar 20, 2026 03:213,27466,698,57134,009,0002,000,0002,256,896
7Mar 20, 2026 03:213,27663,517,54235,036,0001,001,0002,383,872
8Mar 20, 2026 03:213,28363,532,02534,106,0002,006,0002,519,040
9Mar 20, 2026 03:213,28467,632,34335,119,0001,003,0002,260,992