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 29, 2024 12:06NoSIMD_C#NoSIMD_C#Score: 29,113Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 29, 2024 12:0628,981342,928,042268,825,00049,967,0002,310,144
2Nov 29, 2024 12:0629,058348,905,613274,690,00044,949,0002,424,832
3Nov 29, 2024 12:0629,087345,713,182271,967,00047,994,0002,441,216
4Nov 29, 2024 12:0629,101348,214,134258,093,00062,022,0002,445,312
5Nov 29, 2024 12:0629,113351,024,051272,354,00047,886,0002,441,216
6Nov 29, 2024 12:0629,184344,092,098272,175,00048,852,0002,486,272
7Nov 29, 2024 12:0629,310349,101,882270,501,00051,904,0002,441,216
8Nov 29, 2024 12:0629,498355,616,267272,559,00051,916,0002,441,216
9Nov 29, 2024 12:0630,335364,705,327274,095,00059,585,0002,306,048