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 1, 2021 13:53 | 12,091 | 161,784,840 | 108,999,000 | 23,999,000 | 2,318,336 | ||
| 2 | May 2, 2021 16:06 | 12,094 | 158,006,832 | 111,026,000 | 22,005,000 | 2,334,720 | ||
| 3 | May 1, 2021 13:52 | 12,106 | 154,425,066 | 104,127,000 | 29,035,000 | 2,310,144 | ||
| 4 | May 2, 2021 16:06 | 12,111 | 158,655,862 | 105,179,000 | 28,047,000 | 2,322,432 | ||
| 5 | May 1, 2021 13:53 | 12,130 | 160,049,264 | 102,326,000 | 31,099,000 | 2,334,720 | ||
| 6 | May 2, 2021 16:06 | 12,131 | 156,330,809 | 101,338,000 | 32,107,000 | 2,420,736 | ||
| 7 | May 1, 2021 13:51 | 12,132 | 156,275,077 | 105,359,000 | 28,095,000 | 2,314,240 | ||
| 8 | May 2, 2021 16:06 | 12,133 | 156,012,708 | 101,352,000 | 32,111,000 | 2,322,432 | ||
| 9 | May 1, 2021 13:52 | 12,133 | 155,948,727 | 105,363,000 | 28,097,000 | 2,334,720 | ||
| 10 | May 1, 2021 13:53 | 12,136 | 155,852,776 | 103,387,000 | 30,112,000 | 2,330,624 | ||
| 11 | May 2, 2021 16:06 | 12,136 | 155,983,677 | 97,359,000 | 36,133,000 | 2,322,432 | ||
| 12 | May 1, 2021 13:53 | 12,138 | 155,422,095 | 102,397,000 | 31,120,000 | 2,334,720 | ||
| 13 | May 1, 2021 13:53 | 12,153 | 161,047,305 | 107,551,000 | 26,134,000 | 2,449,408 | ||
| 14 | May 1, 2021 13:51 | 12,156 | 158,202,684 | 104,560,000 | 29,156,000 | 2,334,720 | ||
| 15 | May 2, 2021 16:06 | 12,165 | 158,577,499 | 103,857,000 | 29,958,000 | 2,334,720 | ||
| 16 | May 1, 2021 13:51 | 12,165 | 160,349,828 | 94,866,000 | 38,945,000 | 2,334,720 | ||
| 17 | May 1, 2021 13:53 | 12,165 | 157,940,658 | 106,857,000 | 26,963,000 | 2,330,624 | ||
| 18 | May 1, 2021 13:52 | 12,166 | 161,391,589 | 100,867,000 | 32,956,000 | 2,289,664 | ||
| 19 | May 1, 2021 13:51 | 12,167 | 161,505,747 | 104,876,000 | 28,965,000 | 2,318,336 | ||
| 20 | May 1, 2021 13:51 | 12,167 | 160,731,264 | 102,878,000 | 30,963,000 | 2,334,720 | ||
| 21 | May 1, 2021 13:52 | 12,168 | 160,525,232 | 105,669,000 | 28,178,000 | 2,334,720 | ||
| 22 | May 1, 2021 13:51 | 12,170 | 160,225,592 | 97,909,000 | 35,966,000 | 2,334,720 | ||
| 23 | May 2, 2021 16:06 | 12,173 | 162,001,296 | 104,921,000 | 28,978,000 | 2,322,432 | ||
| 24 | May 1, 2021 13:52 | 12,174 | 160,811,150 | 107,927,000 | 25,982,000 | 2,334,720 | ||
| 25 | May 1, 2021 13:53 | 12,177 | 157,278,459 | 103,958,000 | 29,988,000 | 2,318,336 | ||
| 26 | May 1, 2021 13:52 | 12,180 | 161,957,024 | 101,985,000 | 31,995,000 | 2,334,720 | ||
| 27 | May 1, 2021 13:51 | 12,181 | 162,478,994 | 108,997,000 | 24,999,000 | 2,334,720 | ||
| 28 | May 1, 2021 13:53 | 12,184 | 159,656,686 | 97,016,000 | 37,006,000 | 2,322,432 | ||
| 29 | May 1, 2021 13:51 | 12,184 | 159,770,956 | 103,022,000 | 31,006,000 | 2,396,160 | ||
| 30 | May 1, 2021 13:52 | 12,191 | 161,871,750 | 101,080,000 | 33,026,000 | 2,387,968 | ||
| 31 | May 1, 2021 13:53 | 12,194 | 156,152,030 | 108,104,000 | 26,025,000 | 2,334,720 | ||
| 32 | May 1, 2021 13:52 | 12,195 | 155,376,431 | 103,109,000 | 31,032,000 | 2,334,720 | ||
| 33 | May 2, 2021 16:06 | 12,211 | 158,417,516 | 103,247,000 | 31,074,000 | 2,334,720 | ||
| 34 | May 2, 2021 16:06 | 12,257 | 162,754,437 | 104,870,000 | 29,962,000 | 2,314,240 | ||
| 35 | May 1, 2021 13:52 | 12,313 | 155,823,183 | 106,345,000 | 29,094,000 | 2,334,720 | ||
| 36 | May 1, 2021 13:51 | 12,485 | 170,828,154 | 114,280,000 | 23,056,000 | 2,318,336 |