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
Mar 21, 2026 08:50olliecrowolliecrowRUSTrust-1.94.0Error
Mar 21, 2026 08:46olliecrowolliecrowRUSTrust-1.94.0Error
Mar 21, 2026 08:41olliecrowolliecrowCPPg++13.3.0Error
Mar 21, 2026 04:08Dominique GarmierDominique GarmierCPPclang++18.1.3Success30,179
Mar 20, 2026 19:40Dominique GarmierDominique GarmierGOgo1.26.1Success492,671
Mar 20, 2026 10:17Dominique GarmierDominique GarmierCPPg++13.3.0Success6,404
Mar 20, 2026 09:42Dominique GarmierDominique GarmierCPPg++13.3.0Success6,713
Mar 20, 2026 09:42Dominique GarmierDominique GarmierCPPg++13.3.0Success6,686
Mar 20, 2026 09:39Dominique GarmierDominique GarmierCPPg++13.3.0Success11,138
Mar 20, 2026 09:39Dominique GarmierDominique GarmierCPPg++13.3.0Success7,713
Mar 20, 2026 09:36Dominique GarmierDominique GarmierCPPg++13.3.0Success6,895
Mar 20, 2026 09:28Dominique GarmierDominique GarmierCPPg++13.3.0Success6,403+153.32 RP
Mar 20, 2026 09:14Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,100+17.63 RP
Mar 20, 2026 07:57Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,499
Mar 20, 2026 03:30Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,282
Mar 20, 2026 03:23Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,230+38.81 RP
Mar 20, 2026 03:21Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,271+15.81 RP
Mar 20, 2026 03:15Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,288+7.38 RP
Mar 20, 2026 03:01Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,319
Mar 20, 2026 02:54Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,332
Mar 20, 2026 02:38Dominique GarmierDominique GarmierCPPclang++18.1.3Success29,414
Mar 20, 2026 02:19olliecrowolliecrowCPPg++13.3.0Success3,234
Mar 20, 2026 02:18Yuriy LyfenkoYuriy LyfenkoCPPclang++18.1.3Success3,900
Mar 20, 2026 02:18Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,356
Mar 20, 2026 01:36Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,296+64.86 RP
Mar 20, 2026 00:41olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:39olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:35olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:31olliecrowolliecrowCPPg++13.3.0Success3,225
Mar 20, 2026 00:26Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,190+16.44 RP
Mar 20, 2026 00:20olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:17olliecrowolliecrowCPPg++13.3.0Success3,222
Mar 20, 2026 00:15olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:13olliecrowolliecrowCPPg++13.3.0Success3,224
Mar 20, 2026 00:12olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:09olliecrowolliecrowCPPg++13.3.0Success3,226
Mar 20, 2026 00:06olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:04olliecrowolliecrowCPPg++13.3.0Success3,228
Mar 20, 2026 00:02olliecrowolliecrowCPPg++13.3.0Error
Mar 20, 2026 00:01olliecrowolliecrowCPPg++13.3.0Success3,223
Mar 19, 2026 23:57olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:55olliecrowolliecrowCPPg++13.3.0Success3,221
Mar 19, 2026 23:51olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:48olliecrowolliecrowCPPg++13.3.0Success3,221
Mar 19, 2026 23:45olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:43olliecrowolliecrowCPPg++13.3.0Success3,219
Mar 19, 2026 23:41olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:40Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,276+34.08 RP
Mar 19, 2026 23:39olliecrowolliecrowCPPg++13.3.0Success3,211
Mar 19, 2026 23:37olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:34olliecrowolliecrowCPPg++13.3.0Success3,222
Mar 19, 2026 23:33olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:31olliecrowolliecrowCPPg++13.3.0Success3,219
Mar 19, 2026 23:29olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:29Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,461+4.12 RP
Mar 19, 2026 23:28olliecrowolliecrowCPPg++13.3.0Success3,224
Mar 19, 2026 23:25olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:24olliecrowolliecrowCPPg++13.3.0Success3,227
Mar 19, 2026 23:21olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:18olliecrowolliecrowCPPg++13.3.0Success3,218
Mar 19, 2026 23:14Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Success3,368+293.18 RP
Mar 19, 2026 23:14olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:10Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,484+1.25 RP
Mar 19, 2026 23:08olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:06olliecrowolliecrowCPPg++13.3.0Success3,224
Mar 19, 2026 23:05olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:03olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:02olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 23:01olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:59olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:59olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:58olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:58Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,491+22.60 RP
Mar 19, 2026 22:57olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:56olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:55olliecrowolliecrowCPPg++13.3.0Success3,222
Mar 19, 2026 22:54olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:53olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:52Dominique GarmierDominique GarmierCPPclang++18.1.3Success7,620+98.15 RP
Mar 19, 2026 22:51olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:50olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:48olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:47Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Error
Mar 19, 2026 22:47Yuriy LyfenkoYuriy LyfenkoCPPg++13.3.0Error
Mar 19, 2026 22:46olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:44Dominique GarmierDominique GarmierCPPclang++18.1.3Success8,256
Mar 19, 2026 22:44olliecrowolliecrowCPPg++13.3.0Success3,208
Mar 19, 2026 22:43olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:41olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:40Dominique GarmierDominique GarmierCPPclang++18.1.3Error
Mar 19, 2026 22:37Dominique GarmierDominique GarmierCPPclang++18.1.3Success8,236+23.14 RP
Mar 19, 2026 22:37Dominique GarmierDominique GarmierCPPclang++18.1.3Success8,396+191.04 RP
Mar 19, 2026 22:37olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 22:30olliecrowolliecrowCPPg++13.3.0Error
Mar 19, 2026 20:35olliecrowolliecrowGOgo1.26.1Error
Mar 19, 2026 20:31olliecrowolliecrowGOgo1.26.1Success23,215
Mar 19, 2026 20:17olliecrowolliecrowCSHARP9.0.14Error
Mar 19, 2026 20:13olliecrowolliecrowCSHARP9.0.14Error
Mar 19, 2026 20:12olliecrowolliecrowCSHARP9.0.14Error
Mar 19, 2026 20:09olliecrowolliecrowCSHARP9.0.14Error