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 18, 2026 20:57lipapipalipapipaError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 11:16Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 11:17043,276,85931,915,0001,409,0002,170,880expected "406421604 ", got "5355870695688 "
2Sep 4, 2026 11:17043,061,98131,838,0001,295,0002,170,880expected "405068723 ", got "5196958684062 "
3Sep 4, 2026 11:17043,097,87031,933,0001,260,0002,179,072expected "403537303 ", got "5235613343747 "
4Mar 18, 2026 20:574,41682,202,57347,567,0001,012,0002,560,000
5Mar 18, 2026 20:574,42777,846,77346,714,0001,987,0002,560,000
6Mar 18, 2026 20:574,43377,022,77748,762,00002,560,000
7Mar 18, 2026 20:574,43677,197,57946,805,0001,991,0002,560,000
8Mar 18, 2026 20:574,43675,678,82447,802,000995,0002,306,048
9Mar 18, 2026 20:574,43676,076,27046,807,0001,991,0002,428,928
10Mar 18, 2026 20:574,43673,054,84147,804,000995,0002,445,312
11Mar 18, 2026 20:574,43676,227,21348,800,00002,560,000
12Mar 18, 2026 20:574,43778,678,74246,814,0001,992,0002,441,216