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
Date AuthorLanguageStatus Score
Feb 14, 2026 04:27olliecrowolliecrowCPPg++13.3.0Success3,560
Feb 14, 2026 04:19olliecrowolliecrowCPPg++13.3.0Success3,559
Feb 14, 2026 04:09olliecrowolliecrowCPPg++13.3.0Success3,559+14.92 RP
Feb 14, 2026 04:03olliecrowolliecrowCPPg++13.3.0Success4,349
Feb 14, 2026 03:36olliecrowolliecrowCPPg++13.3.0Success3,620
Feb 14, 2026 03:28olliecrowolliecrowCPPg++13.3.0Success3,730
Feb 14, 2026 03:16olliecrowolliecrowCPPg++13.3.0Success3,578+3.90 RP
Feb 14, 2026 02:43olliecrowolliecrowCPPg++13.3.0Success3,593
Feb 14, 2026 02:37olliecrowolliecrowCPPg++13.3.0Success3,604
Feb 14, 2026 02:27olliecrowolliecrowCPPg++13.3.0Success3,583+9.32 RP
Feb 14, 2026 02:21olliecrowolliecrowCPPg++13.3.0Success3,595+3.09 RP
Feb 14, 2026 02:16olliecrowolliecrowCPPg++13.3.0Success3,923
Feb 14, 2026 01:43olliecrowolliecrowCPPg++13.3.0Success3,599+1.54 RP
Feb 14, 2026 01:37olliecrowolliecrowCPPg++13.3.0Success3,752
Feb 14, 2026 01:31olliecrowolliecrowCPPg++13.3.0Success3,602
Feb 14, 2026 01:24olliecrowolliecrowCPPg++13.3.0Success3,659
Feb 14, 2026 01:16olliecrowolliecrowCPPg++13.3.0Success4,442
Feb 14, 2026 01:10olliecrowolliecrowCPPg++13.3.0Success3,604
Feb 14, 2026 01:00olliecrowolliecrowCPPg++13.3.0Success3,601+4.62 RP
Feb 14, 2026 00:50olliecrowolliecrowCPPg++13.3.0Success3,652
Feb 14, 2026 00:14olliecrowolliecrowCPPg++13.3.0Success3,623
Feb 14, 2026 00:10olliecrowolliecrowCPPg++13.3.0Success3,717
Feb 14, 2026 00:02olliecrowolliecrowCPPg++13.3.0Success3,607+20.60 RP
Feb 13, 2026 22:56olliecrowolliecrowCPPg++13.3.0Success3,776
Feb 13, 2026 22:44olliecrowolliecrowCPPg++13.3.0Success3,634+0.76 RP
Feb 13, 2026 22:40olliecrowolliecrowCPPclang++18.1.3Success3,986
Feb 13, 2026 22:32olliecrowolliecrowCPPg++13.3.0Success3,766
Feb 13, 2026 22:26olliecrowolliecrowCPPg++13.3.0Success3,636
Feb 13, 2026 22:17olliecrowolliecrowCPPg++13.3.0Success3,635+124.29 RP
Feb 13, 2026 21:46olliecrowolliecrowCPPg++13.3.0Success3,857
Feb 13, 2026 21:38olliecrowolliecrowCPPg++13.3.0Success4,141
Feb 13, 2026 21:01olliecrowolliecrowCPPg++13.3.0Success3,920
Feb 13, 2026 20:44olliecrowolliecrowCPPg++13.3.0Success3,807+56.05 RP
Feb 13, 2026 20:38olliecrowolliecrowCPPg++13.3.0Success3,890+61.28 RP
Feb 13, 2026 20:30olliecrowolliecrowCPPclang++18.1.3Success4,187
Feb 13, 2026 20:23olliecrowolliecrowCPPclang++18.1.3Success3,985+19.37 RP
Feb 13, 2026 20:17olliecrowolliecrowCPPclang++18.1.3Success4,272
Feb 13, 2026 20:10olliecrowolliecrowCPPclang++18.1.3Success4,579
Feb 13, 2026 19:42olliecrowolliecrowCPPclang++18.1.3Success4,016+0.62 RP
Feb 13, 2026 19:38olliecrowolliecrowCPPclang++18.1.3Success4,107
Feb 13, 2026 19:33olliecrowolliecrowCPPclang++18.1.3Success4,017+6.18 RP
Feb 13, 2026 19:12olliecrowolliecrowCPPclang++18.1.3Success4,027+46.59 RP
Feb 13, 2026 19:04olliecrowolliecrowCPPclang++18.1.3Error
Feb 13, 2026 18:49olliecrowolliecrowCPPclang++18.1.3Success4,165
Feb 13, 2026 18:32olliecrowolliecrowCPPclang++18.1.3Success4,104+20.02 RP
Feb 13, 2026 18:19olliecrowolliecrowCPPclang++18.1.3Success4,187
Feb 13, 2026 18:13olliecrowolliecrowCPPclang++18.1.3Success4,150
Feb 13, 2026 18:07olliecrowolliecrowCPPclang++18.1.3Success4,372
Feb 13, 2026 18:03olliecrowolliecrowCPPclang++18.1.3Success5,307
Feb 13, 2026 17:56olliecrowolliecrowCPPclang++18.1.3Success4,374
Feb 13, 2026 17:38olliecrowolliecrowCPPclang++18.1.3Success4,138+263.31 RP
Feb 13, 2026 17:17olliecrowolliecrowCPPclang++18.1.3Success4,874
Feb 13, 2026 17:11olliecrowolliecrowCPPg++13.3.0Success4,892
Feb 13, 2026 17:05olliecrowolliecrowCPPclang++18.1.3Success4,659
Feb 13, 2026 16:58olliecrowolliecrowCPPclang++18.1.3Success4,644+2.32 RP
Feb 13, 2026 16:51olliecrowolliecrowCPPclang++18.1.3Success4,649+94.23 RP
Feb 13, 2026 16:46olliecrowolliecrowCPPclang++18.1.3Success5,124
Feb 13, 2026 16:39olliecrowolliecrowCPPclang++18.1.3Success6,034
Feb 13, 2026 16:31olliecrowolliecrowCPPclang++18.1.3Success4,862+348.82 RP
Feb 13, 2026 15:53olliecrowolliecrowCPPclang++18.1.3Success5,855+41.55 RP
Feb 13, 2026 15:47olliecrowolliecrowCPPclang++18.1.3Success9,740
Feb 13, 2026 15:41olliecrowolliecrowCPPclang++18.1.3Success6,001+9.11 RP
Feb 13, 2026 15:33olliecrowolliecrowCPPg++13.3.0Success6,034+216.15 RP
Feb 13, 2026 15:28olliecrowolliecrowCPPg++13.3.0Success7,077
Feb 13, 2026 15:20olliecrowolliecrowCPPg++13.3.0Success6,939+14.39 RP
Feb 13, 2026 15:02olliecrowolliecrowCPPg++13.3.0Success7,009+352.28 RP
Feb 13, 2026 14:49olliecrowolliecrowCPPg++13.3.0Success9,932
Feb 13, 2026 14:42olliecrowolliecrowCPPclang++18.1.3Success9,307+46.29 RP
Feb 13, 2026 14:13olliecrowolliecrowCPPg++13.3.0Success9,726+684.13 RP
Feb 13, 2026 14:02olliecrowolliecrowCPPg++13.3.0Success57,786
Feb 3, 2026 22:07olliecrowolliecrowCPPg++13.3.0Success29,066+1.05 RP
Feb 3, 2026 22:07olliecrowolliecrowCPPg++13.3.0Success29,155+15.96 RP
Feb 3, 2026 22:07olliecrowolliecrowCPPg++13.3.0Success31,861
Feb 3, 2026 22:07olliecrowolliecrowCPPg++13.3.0Success30,578+327.03 RP
Jan 29, 2026 08:43Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,252+0.01 RP
Jan 29, 2026 08:41Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success121,069
Jan 29, 2026 08:22Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,265+0.08 RP
Jan 29, 2026 08:21Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success123,132
Jan 29, 2026 07:51Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,385+0.03 RP
Jan 29, 2026 07:49Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success121,300
Jan 28, 2026 23:04lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:59Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success129,454
Jan 28, 2026 22:54Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,638
Jan 28, 2026 22:52Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,811
Jan 28, 2026 22:52lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:50Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,653
Jan 28, 2026 22:49lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:48Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success123,951
Jan 28, 2026 22:47Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,671
Jan 28, 2026 22:44Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,650
Jan 28, 2026 22:42lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:41lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:40Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success120,539
Jan 28, 2026 22:34Aleksey ShvetsAleksey ShvetsGOgo1.24.12Error
Jan 28, 2026 22:31Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success122,882
Jan 28, 2026 22:18lipapipalipapipaCPPg++13.3.0Error
Jan 28, 2026 22:10Aleksey ShvetsAleksey ShvetsGOgo1.24.12Success121,213
Jan 28, 2026 22:10Aleksey ShvetsAleksey ShvetsGOgo1.25.6Success124,391
Jan 28, 2026 22:09Aleksey ShvetsAleksey ShvetsGOgo1.25.6Success121,654
Jan 28, 2026 22:08lipapipalipapipaCPPg++13.3.0Error