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 9, 2024 06:52NoSIMD_C#NoSIMD_C#Score: 33,859Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 9, 2024 05:0733,355388,752,159315,916,00050,986,0002,301,952
2Nov 9, 2024 05:0733,541398,227,376312,958,00055,992,0002,301,952
3Nov 9, 2024 05:0733,550399,176,729318,039,00051,006,0002,322,432
4Nov 9, 2024 05:0733,558395,332,056308,112,00061,022,0002,342,912
5Nov 9, 2024 05:0733,578395,395,088313,457,00055,903,0002,547,712
6Nov 9, 2024 06:5233,625396,469,080318,892,00050,982,0002,392,064
7Nov 9, 2024 05:0733,859403,310,137325,521,00046,930,0002,396,160
8Nov 9, 2024 06:5233,876402,609,645319,687,00052,948,0002,347,008
9Nov 9, 2024 05:0734,311407,326,407319,514,00057,912,0002,449,408
10Nov 9, 2024 05:0734,358403,859,879319,946,00057,990,0002,375,680
11Nov 9, 2024 05:0734,540406,462,938306,949,00072,988,0002,318,336
12Nov 9, 2024 06:5234,611411,499,209331,760,00048,964,0002,314,240