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 11:52NoSIMD_C#NoSIMD_C#Score: 29,275Success
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 11:5229,072341,898,565259,833,00059,961,0002,441,216
2Nov 29, 2024 11:5229,092347,292,586282,015,00038,002,0002,310,144
3Nov 29, 2024 11:5229,108344,020,633267,159,00053,031,0002,297,856
4Nov 29, 2024 11:5229,128347,963,616256,528,00063,882,0002,433,024
5Nov 29, 2024 11:5229,275345,045,954276,019,00046,003,0002,449,408
6Nov 29, 2024 11:5229,304349,901,492266,459,00055,886,0002,424,832
7Nov 29, 2024 11:5229,323348,227,412275,618,00046,935,0002,469,888
8Nov 29, 2024 11:5229,590359,302,402266,586,00058,908,0002,347,008
9Nov 29, 2024 11:5229,876354,014,003276,690,00051,941,0002,437,120