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 listNov 30, 2024 05:52NoSIMD_C#NoSIMD_C#Score: 29,064Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 30, 2024 05:5228,944342,663,241267,482,00050,901,0002,289,664
2Nov 30, 2024 05:5229,017348,372,672267,153,00052,029,0002,527,232
3Nov 30, 2024 05:5229,058349,871,462273,693,00045,948,0002,433,024
4Nov 30, 2024 05:5229,058346,431,957273,695,00045,948,0002,437,120
5Nov 30, 2024 05:5229,064346,231,445262,755,00056,946,0002,297,856
6Nov 30, 2024 05:5229,072343,655,439265,825,00053,964,0002,453,504
7Nov 30, 2024 05:5229,138349,229,231250,620,00069,894,0002,441,216
8Nov 30, 2024 05:5229,163349,917,093259,829,00060,959,0002,453,504
9Nov 30, 2024 05:5229,462346,576,981272,072,00052,013,0002,301,952