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 | Jun 2, 2021 18:51 | 3,843 | 73,612,730 | 42,276,000 | 0 | 2,527,232 | ||
| 2 | May 22, 2021 22:04 | 3,843 | 67,937,679 | 41,267,000 | 1,006,000 | 2,265,088 | ||
| 3 | May 24, 2021 19:30 | 3,854 | 63,479,788 | 41,386,000 | 1,009,000 | 2,265,088 | ||
| 4 | May 22, 2021 22:04 | 3,858 | 68,105,898 | 41,430,000 | 1,010,000 | 2,527,232 | ||
| 5 | May 29, 2021 14:52 | 3,875 | 76,454,160 | 41,615,000 | 1,015,000 | 2,396,160 | ||
| 6 | May 24, 2021 19:30 | 3,880 | 72,526,745 | 42,683,000 | 0 | 2,396,160 | ||
| 7 | May 24, 2021 19:30 | 3,889 | 67,978,040 | 40,794,000 | 1,989,000 | 2,506,752 | ||
| 8 | May 22, 2021 22:04 | 3,895 | 73,375,806 | 41,846,000 | 996,000 | 2,265,088 | ||
| 9 | May 22, 2021 22:04 | 3,897 | 72,322,036 | 40,873,000 | 1,993,000 | 2,527,232 | ||
| 10 | May 24, 2021 19:30 | 3,898 | 68,572,694 | 40,889,000 | 1,994,000 | 2,527,232 | ||
| 11 | Jun 2, 2021 18:51 | 3,898 | 73,699,001 | 41,880,000 | 997,000 | 2,400,256 | ||
| 12 | May 29, 2021 14:52 | 3,898 | 72,740,316 | 41,886,000 | 997,000 | 2,392,064 | ||
| 13 | May 24, 2021 19:30 | 3,899 | 69,110,254 | 41,892,000 | 997,000 | 2,527,232 | ||
| 14 | Jun 2, 2021 18:51 | 3,903 | 68,501,417 | 41,939,000 | 998,000 | 2,527,232 | ||
| 15 | May 22, 2021 22:04 | 3,905 | 74,820,782 | 40,961,000 | 1,998,000 | 2,265,088 | ||
| 16 | May 22, 2021 22:04 | 3,906 | 68,311,798 | 40,969,000 | 1,998,000 | 2,265,088 | ||
| 17 | May 24, 2021 19:30 | 3,906 | 71,760,984 | 41,962,000 | 999,000 | 2,260,992 | ||
| 18 | Jun 2, 2021 18:51 | 3,908 | 69,348,931 | 41,993,000 | 999,000 | 2,527,232 | ||
| 19 | Jun 2, 2021 18:51 | 3,908 | 72,873,585 | 40,993,000 | 1,999,000 | 2,265,088 | ||
| 20 | May 29, 2021 14:52 | 3,910 | 70,537,027 | 42,011,000 | 1,000,000 | 2,387,968 | ||
| 21 | Jun 2, 2021 18:51 | 3,911 | 70,922,202 | 41,017,000 | 2,000,000 | 2,400,256 | ||
| 22 | May 29, 2021 14:52 | 3,911 | 73,500,866 | 41,017,000 | 2,000,000 | 2,265,088 | ||
| 23 | May 24, 2021 19:30 | 3,913 | 72,515,504 | 42,042,000 | 1,001,000 | 2,265,088 | ||
| 24 | May 24, 2021 19:30 | 3,913 | 67,533,103 | 41,046,000 | 2,002,000 | 2,265,088 | ||
| 25 | May 22, 2021 22:04 | 3,914 | 69,512,241 | 41,056,000 | 2,002,000 | 2,265,088 | ||
| 26 | May 24, 2021 19:30 | 3,916 | 67,565,241 | 42,070,000 | 1,001,000 | 2,506,752 | ||
| 27 | May 22, 2021 22:04 | 3,916 | 73,619,711 | 41,077,000 | 2,003,000 | 2,527,232 | ||
| 28 | Jun 2, 2021 18:51 | 3,919 | 76,549,654 | 42,110,000 | 1,002,000 | 2,265,088 | ||
| 29 | Jun 2, 2021 18:51 | 3,922 | 65,639,483 | 42,139,000 | 1,003,000 | 2,265,088 | ||
| 30 | May 29, 2021 14:52 | 3,926 | 76,080,145 | 42,187,000 | 1,004,000 | 2,527,232 | ||
| 31 | May 22, 2021 22:04 | 3,927 | 70,468,749 | 42,193,000 | 1,004,000 | 2,265,088 | ||
| 32 | Jun 2, 2021 18:51 | 3,929 | 79,275,980 | 41,211,000 | 2,010,000 | 2,265,088 | ||
| 33 | May 29, 2021 14:52 | 3,930 | 71,809,456 | 42,222,000 | 1,005,000 | 2,387,968 | ||
| 34 | May 29, 2021 14:52 | 3,931 | 76,309,216 | 41,228,000 | 2,011,000 | 2,392,064 | ||
| 35 | May 24, 2021 19:30 | 3,932 | 91,670,732 | 43,252,839 | 0 | 2,236,416 | ||
| 36 | May 22, 2021 22:04 | 3,935 | 115,539,053 | 43,280,755 | 0 | 2,228,224 | ||
| 37 | May 29, 2021 14:52 | 3,940 | 69,487,328 | 42,331,000 | 1,007,000 | 2,387,968 | ||
| 38 | May 22, 2021 22:04 | 3,941 | 105,180,405 | 43,346,371 | 0 | 2,232,320 | ||
| 39 | Jun 2, 2021 18:51 | 3,943 | 95,800,334 | 43,373,989 | 0 | 2,232,320 | ||
| 40 | May 29, 2021 14:52 | 3,943 | 64,030,470 | 42,365,000 | 1,008,000 | 2,392,064 | ||
| 41 | Jun 2, 2021 18:51 | 3,944 | 108,237,718 | 43,382,156 | 0 | 2,232,320 | ||
| 42 | May 29, 2021 14:52 | 3,945 | 111,137,956 | 43,397,322 | 0 | 2,228,224 | ||
| 43 | Jun 2, 2021 18:51 | 3,945 | 107,460,713 | 43,394,829 | 0 | 2,236,416 | ||
| 44 | May 29, 2021 14:52 | 3,946 | 101,037,807 | 43,406,718 | 0 | 2,236,416 | ||
| 45 | May 24, 2021 19:30 | 3,955 | 117,174,574 | 43,504,404 | 0 | 2,236,416 | ||
| 46 | May 29, 2021 14:52 | 3,956 | 114,559,883 | 43,520,931 | 0 | 2,240,512 | ||
| 47 | May 24, 2021 19:30 | 3,961 | 91,975,431 | 43,572,680 | 0 | 2,236,416 | ||
| 48 | May 22, 2021 22:04 | 3,963 | 114,798,520 | 43,592,889 | 0 | 2,240,512 |