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 listMar 25, 2026 21:53Dominique GarmierDominique GarmierScore: 95,267Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Mar 26, 2026 12:5195,1511,076,456,1041,044,662,0001,999,0002,338,816
2Mar 26, 2026 12:5195,1531,078,023,3621,045,683,000999,0002,338,816
3Mar 25, 2026 21:5395,2531,071,398,5921,046,781,000999,0002,334,720
4Mar 25, 2026 21:5395,2671,075,026,1051,047,935,00002,330,624
5Mar 25, 2026 21:5395,3221,079,663,6931,046,547,0001,999,0002,338,816
6Mar 26, 2026 12:5195,5481,076,821,7831,051,025,00002,342,912