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 listDec 10, 2024 05:59NoSIMD_C#NoSIMD_C#Score: 42,333Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 10, 2024 06:0042,256488,194,548408,838,00055,977,0002,441,216
2Dec 10, 2024 05:5942,273486,995,686420,005,00045,000,0002,469,888
3Dec 10, 2024 06:0242,280495,906,539410,074,00055,010,0002,383,872
4Dec 10, 2024 06:0042,301490,326,930419,377,00045,931,0002,453,504
5Dec 10, 2024 06:0242,333486,344,167397,715,00067,951,0002,441,216
6Dec 10, 2024 05:5942,338497,270,798402,754,00062,961,0002,457,600
7Dec 10, 2024 06:0042,358492,413,599411,943,00053,992,0002,297,856
8Dec 10, 2024 06:0242,465491,156,421419,101,00048,011,0002,449,408
9Dec 10, 2024 05:5942,547492,879,803410,015,00058,002,0002,441,216