Parse JSON 
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.canceledisfalseor absent
Source Code
Source code access is restricted. Log in to request access.
Challenge History
No challenges yet.
Run Statistics
| # | Date | Score | Wall Time | CPU User | CPU System | Memory | Error | |
|---|---|---|---|---|---|---|---|---|
| 1 | May 17, 2021 16:39 | 6,150 | 95,045,000 | 66,637,000 | 1,009,000 | 2,277,376 | ||
| 2 | May 17, 2021 16:39 | 6,151 | 92,518,440 | 67,660,000 | 0 | 2,371,584 | ||
| 3 | May 17, 2021 16:39 | 6,151 | 92,987,127 | 66,649,000 | 1,009,000 | 2,277,376 | ||
| 4 | May 17, 2021 16:40 | 6,152 | 94,866,873 | 66,667,000 | 1,010,000 | 2,371,584 | ||
| 5 | May 20, 2021 05:41 | 6,154 | 92,719,625 | 65,678,000 | 2,020,000 | 2,375,680 | ||
| 6 | May 20, 2021 05:41 | 6,158 | 123,362,767 | 67,736,504 | 0 | 2,207,744 | ||
| 7 | May 20, 2021 05:41 | 6,159 | 131,378,276 | 67,753,433 | 0 | 2,199,552 | ||
| 8 | May 17, 2021 16:40 | 6,159 | 92,160,118 | 67,749,000 | 0 | 2,375,680 | ||
| 9 | May 17, 2021 16:39 | 6,166 | 95,542,280 | 66,829,000 | 997,000 | 2,277,376 | ||
| 10 | May 17, 2021 16:38 | 6,167 | 97,508,195 | 65,838,000 | 1,995,000 | 2,367,488 | ||
| 11 | May 17, 2021 16:40 | 6,167 | 96,504,465 | 67,841,000 | 0 | 2,277,376 | ||
| 12 | May 17, 2021 16:38 | 6,168 | 94,245,109 | 66,855,000 | 997,000 | 2,277,376 | ||
| 13 | May 17, 2021 16:38 | 6,168 | 98,552,219 | 66,850,000 | 997,000 | 2,277,376 | ||
| 14 | May 17, 2021 16:39 | 6,168 | 91,690,470 | 65,849,000 | 1,995,000 | 2,277,376 | ||
| 15 | May 17, 2021 16:40 | 6,168 | 96,347,158 | 66,846,000 | 997,000 | 2,277,376 | ||
| 16 | May 17, 2021 16:40 | 6,168 | 95,790,301 | 66,847,000 | 997,000 | 2,371,584 | ||
| 17 | May 17, 2021 16:38 | 6,168 | 95,332,966 | 66,854,000 | 997,000 | 2,379,776 | ||
| 18 | May 20, 2021 05:41 | 6,168 | 93,372,162 | 67,845,000 | 0 | 2,371,584 | ||
| 19 | May 20, 2021 05:41 | 6,168 | 100,353,879 | 66,846,000 | 997,000 | 2,375,680 | ||
| 20 | May 17, 2021 16:40 | 6,169 | 102,516,781 | 64,861,000 | 2,993,000 | 2,277,376 | ||
| 21 | May 17, 2021 16:40 | 6,169 | 92,087,866 | 66,861,000 | 997,000 | 2,375,680 | ||
| 22 | May 17, 2021 16:38 | 6,169 | 94,749,650 | 65,864,000 | 1,995,000 | 2,371,584 | ||
| 23 | May 20, 2021 05:41 | 6,170 | 95,312,782 | 66,871,000 | 998,000 | 2,281,472 | ||
| 24 | May 20, 2021 05:41 | 6,171 | 97,564,292 | 65,888,000 | 1,996,000 | 2,277,376 | ||
| 25 | May 20, 2021 05:41 | 6,172 | 97,379,072 | 65,899,000 | 1,996,000 | 2,371,584 | ||
| 26 | May 17, 2021 16:39 | 6,172 | 97,849,126 | 65,893,000 | 1,996,000 | 2,371,584 | ||
| 27 | May 17, 2021 16:38 | 6,174 | 96,998,441 | 63,916,000 | 3,994,000 | 2,277,376 | ||
| 28 | May 17, 2021 16:38 | 6,177 | 94,638,621 | 65,954,000 | 1,998,000 | 2,367,488 | ||
| 29 | May 20, 2021 05:41 | 6,177 | 89,682,592 | 65,950,000 | 1,998,000 | 2,277,376 | ||
| 30 | May 17, 2021 16:38 | 6,178 | 98,836,571 | 65,961,000 | 1,998,000 | 2,379,776 | ||
| 31 | May 17, 2021 16:40 | 6,178 | 93,936,096 | 66,964,000 | 999,000 | 2,281,472 | ||
| 32 | May 17, 2021 16:39 | 6,180 | 96,079,558 | 65,979,000 | 1,999,000 | 2,277,376 | ||
| 33 | May 17, 2021 16:38 | 6,181 | 94,857,457 | 66,992,000 | 999,000 | 2,277,376 | ||
| 34 | May 20, 2021 05:41 | 6,185 | 100,060,408 | 66,032,000 | 2,000,000 | 2,277,376 | ||
| 35 | May 20, 2021 05:41 | 6,187 | 128,841,646 | 68,057,562 | 0 | 2,207,744 | ||
| 36 | May 17, 2021 16:39 | 6,191 | 94,050,823 | 65,096,000 | 3,004,000 | 2,277,376 | ||
| 37 | May 17, 2021 16:39 | 6,191 | 96,104,250 | 67,096,000 | 1,001,000 | 2,371,584 | ||
| 38 | May 17, 2021 16:40 | 6,191 | 94,183,492 | 66,098,000 | 2,002,000 | 2,367,488 | ||
| 39 | May 20, 2021 05:41 | 6,204 | 87,993,762 | 66,234,000 | 2,007,000 | 2,277,376 |