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 1, 2026 00:25Josu San MartinJosu San MartinScore: 9,894Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jan 1, 2026 00:259,849131,121,290107,331,0001,003,0002,289,664
2Jan 1, 2026 00:259,861131,194,474107,462,0001,004,0002,359,296
3Jan 1, 2026 01:109,861130,223,280108,466,00002,289,664
4Jan 1, 2026 01:109,864132,899,886108,506,00002,371,584
5Jan 1, 2026 00:259,893136,489,904107,823,000998,0002,359,296
6Jan 1, 2026 00:259,893135,085,681106,826,0001,996,0002,363,392
7Jan 1, 2026 00:259,894135,670,164106,833,0001,996,0002,371,584
8Jan 1, 2026 00:259,896137,147,513106,854,0001,997,0002,363,392
9Jan 1, 2026 00:259,898135,437,632106,882,0001,997,0002,367,488
10Jan 1, 2026 00:259,904140,811,349106,943,0001,998,0002,359,296
11Jan 1, 2026 01:109,911135,862,338108,021,0001,000,0002,359,296
12Jan 1, 2026 00:259,944132,790,645109,384,00002,289,664