problem_id
stringlengths 6
6
| user_id
stringlengths 10
10
| time_limit
float64 1k
8k
| memory_limit
float64 262k
1.05M
| problem_description
stringlengths 48
1.55k
| codes
stringlengths 35
98.9k
| status
stringlengths 28
1.7k
| submission_ids
stringlengths 28
1.41k
| memories
stringlengths 13
808
| cpu_times
stringlengths 11
610
| code_sizes
stringlengths 7
505
|
---|---|---|---|---|---|---|---|---|---|---|
p02703 | u875541136 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare. There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter. For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains. | ['from heapq import *\n\nT = [[10**18 for _ in range(2451)] for _ in range(N)]\n\nact = [[] for _ in range(N)]\n\nN, M, S = tuple(map(int, input().split()))\n\nfor i in range(M):\n U, V, A, B = tuple(map(int, input().split()))\n maxV = max(maxV, A)\n U -= 1\n V -= 1\n act[U] += [(V, A, B)]\n act[V] += [(U, A, B)]\n\nfor i in range(N):\n C, D = tuple(map(int, input().split()))\n act[i] += [(i, -C, D)]\n\nque = [(0, 0, S)]\n\nwhile que:\n (currentT, n, coins) = heappop(que)\n for m, cost, t in act[n]:\n \n if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:\n T[m][min(2450, coins - cost)] = currentT + t\n heappush(que, (currentT + t, m, min(2450, coins - cost)))\n\nfor i in range(1, N):\n print(min(T[i]))', 'from heapq import *\n\nT = [[10**18 for _ in range(2451)] for _ in range(N)]\n\nact = [[] for _ in range(N)]\n\nN, M, S = tuple(map(int, input().split()))\n\nfor i in range(M):\n U, V, A, B = tuple(map(int, input().split()))\n U -= 1\n V -= 1\n act[U] += [(V, A, B)]\n act[V] += [(U, A, B)]\n\nfor i in range(N):\n C, D = tuple(map(int, input().split()))\n act[i] += [(i, -C, D)]\n\nque = [(0, 0, S)]\n\nwhile que:\n (currentT, n, coins) = heappop(que)\n for m, cost, t in act[n]:\n \n if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:\n T[m][min(2450, coins - cost)] = currentT + t\n heappush(que, (currentT + t, m, min(2450, coins - cost)))\n\nfor i in range(1, N):\n print(min(T[i]))', 'from heapq import *\n\nN, M, S = map(int, input().split())\n\nT = [[10**18 for _ in range(2451)] for _ in range(N)]\n\nact = [[] for _ in range(N)]\n\nfor i in range(M):\n U, V, A, B = map(int, input().split())\n U -= 1\n V -= 1\n act[U] += [(V, A, B)]\n act[V] += [(U, A, B)]\n\nfor i in range(N):\n C, D = tuple(map(int, input().split()))\n act[i] += [(i, -C, D)]\n\nque = [(0, 0, S)]\n\nwhile que:\n (currentT, n, coins) = heappop(que)\n for m, cost, t in act[n]:\n \n \n if coins >= cost and currentT + t < T[m][min(2450, coins - cost)]:\n T[m][min(2450, coins - cost)] = currentT + t\n heappush(que, (currentT + t, m, min(2450, coins - cost)))\n\nfor i in range(1, N):\n print(min(T[i]))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s413592902', 's414709127', 's859412922'] | [9248.0, 9104.0, 25992.0] | [21.0, 25.0, 884.0] | [866, 844, 918] |
p02703 | u906501980 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare. There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter. For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains. | ['def main():\n n, m, s = map(int, input().split())\n fr, al, bl, cl, dl = [dict() for _ in range(n)], [None]*m, [None]*m, [None]*n, [None]*n\n for i in range(m):\n u, v, a, b = map(int, input().split())\n fr[u-1][i] = v-1\n fr[v-1][i] = u-1\n al[i] = a\n bl[i] = b\n for i in range(n):\n c, d = map(int, input().split())\n cl[i] = c\n dl[i] = d\n if s > sum(al):\n dp = [10**13]*n\n dp[0] = 0\n for i in range(1, n):\n di = dp[i]\n for j, f in fr[i].items():\n time = dp[f] + bl[j]\n if di > time:\n di = time\n dp[i] = di\n print(di)\n else:\n dp = [[10**13]*5001 for _ in range(n)]\n for i in range(s+1):\n dp[0][i] = 0\n for i in range(1, n):\n di = dp[i]\n for j, f in fr[i].items():\n \n # additionalcoin = ccc*i\n \n \n cost = al[j]\n time = bl[j]\n cost2 = min(cost - cl[j], 5000)\n time2 = time + dl[j]\n for costi, timei in [[cost, time], [cost2, time2]]:\n for si in range(5001-costi):\n if si + costi >= 0:\n di[si] = min(di[si], dp[f][si+costi] + timei)\n dp[i] = di\n print(min(di))\n \n \n \n \n \n \n \n\nif __name__ == "__main__":\n main()\n', 'from heapq import heapify, heappush, heappop\nfrom heapq import _heapify_max, _heappop_max\n\ndef _heappush_max(heap, item):\n heap.append(item)\n heapq._siftdown_max(heap, 0, len(heap)-1)\n\n\n\n\ndef main():\n n, m, s = map(int, input().split())\n edge = [[] for i in range(n)]\n cl, dl = [None]*n, [None]*n\n sa = 0\n for i in range(m):\n u, v, a, b = map(int, input().split())\n u -= 1\n v -= 1\n edge[u].append((v, b, a))\n edge[v].append((u, b, a))\n sa += a\n for i in range(n):\n c, d = map(int, input().split())\n cl[i] = c\n dl[i] = d\n dijkstra(n, s, edge, cl, dl)\n \n \n \ndef dijkstra(n, coin, edges, cl, dl):\n coin_max = 5000\n start = 0\n coin = min(coin, coin_max)\n d = [[10**15]*(coin_max+1) for _ in range(n)]\n d[start][coin] = 0\n priority_queue = []\n heappush(priority_queue, (0, start, coin))\n while priority_queue:\n cost_i, i, coin_i = heappop(priority_queue)\n if d[i][coin_i] < cost_i:\n continue\n supplied_coin = coin_i + cl[i]\n if supplied_coin <= coin_max and cost_i + dl[i] < d[i][supplied_coin]:\n d[i][supplied_coin] = cost_i + dl[i]\n heappush(priority_queue, (cost_i + dl[i], i, supplied_coin))\n for _to, _cost, _coin in edges[i]:\n ci = coin_i-_coin\n if coin_i >= _coin and d[_to][ci] > cost_i + _cost:\n d[_to][ci] = cost_i + _cost\n heappush(priority_queue, (cost_i + _cost, _to, ci))\n for i in d[1:]:\n print(min(i))\n \n \n\nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Accepted'] | ['s190057781', 's667710464'] | [11204.0, 43772.0] | [295.0, 1198.0] | [1611, 1881] |
p02703 | u923172145 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare. There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter. For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains. | ['from heapq import heapify,heappush,heappop\nN, M, S = map(int, input().split())\n\nI = [[] for _ in range(N)]\nfor i in range(M):\n U, V, A, B = map(int, input().split())\n U -= 1\n V -= 1\n I[U].append((U,A,B))\n I[V].append((V,A,B))\n\nCD = [list(map(int, input().split())) for j in range(N)]\n \ntask = [] \nused = [0 for _ in range(N)]\nmin_len = [0 for _ in range(N)]\nlength = [(10**20,0) for _ in range(N)]\nprev_points = [0 for _ in range(N)]\nheappush(task, ((0, -S), 0, -1))\nprint("Yes")\n\nwhile task:\n while task:\n l, p, prev = heappop(task) \n if used[p] == 0:\n break\n #print(task)\n used[p] = 1\n min_len[p] = l\n prev_points[p] = prev +1 \n \n for (j, a, b) in I[p]:\n if used[j] == 1: continue\n #print(p,j)\n svr = l[1]\n tm = l[0]\n while -svr < b:\n svr -= C[p]\n tm += N[p]\n l_next = (tm,svr) \n \n if length[j] > l_next:\n length[j] = l_next\n heappush(task, (l_next, j, p))\n\n\n\nfor i in range(1, N):\n print(length[i][0])', 'from heapq import heapify,heappush,heappop\n\nN, M, S = map(int, input().split())\n\n\ntmp = [list(map(int, input().split())) for _ in range(M)]\n\nU = [0 for _ in range(M)]\nV = [0 for _ in range(M)]\nA = [0 for _ in range(M)]\nB = [0 for _ in range(M)]\n\nfor i in range(M):\n U[i] = tmp[i][0] -1\n V[i] = tmp[i][1] -1\n A[i] = tmp[i][2]\n B[i] = tmp[i][3]\nA_m = max(A)\nS = min(N*A_m, S)\n#print(A_m)\n\nI = [[] for _ in range(N * (N*A_m+1))] \n\nfor i in range(M):\n for j in range(A[i], N*A_m+1):\n I[U[i]*(N*A_m+1)+j].append((V[i]*(N*A_m+1)+j-A[i],B[i]))\n I[V[i]*(N*A_m+1)+j].append((U[i]*(N*A_m+1)+j-A[i],B[i]))\n\nfor i in range(N):\n C, D = map(int, input().split())\n for j in range(N*A_m+1):\n I[i*(N*A_m+1)+j].append((i*(N*A_m+1)+min(C+j,N*A_m),D))\n#print(I)\n\ndef dijkstra(I):\n N = len(I)\n task = [] \n visited = [0 for _ in range(N)]\n min_cost = [0 for _ in range(N)]\n cost = [10**20 for _ in range(N)]\n prev_points = [0 for _ in range(N)]\n heappush(task, (0, S, -1))\n \n \n \n flag = 0\n while task:\n while task:\n c, p, prev = heappop(task) \n if visited[p] == 0:\n break \n if len(task) == 0:\n flag = 1\n if flag == 1:\n break\n #print(task)\n visited[p] = 1\n min_cost[p] = c\n prev_points[p] = prev\n \n for j, c_ad in I[p]: \n if visited[j] == 1: continue\n #print(p//(N*A_m+1),p%(N*A_m+1),j//(N*A_m+1),j%(N*A_m+1),c_ad)\n cost_next = next_cost(I, p, j, c, c_ad)\n if cost[j] > cost_next:\n cost[j] = cost_next\n heappush(task, (cost_next, j, p))\n\n return (min_cost, prev_points)\n\ndef next_cost(I, p, j, c, c_ad): \n\n return c + c_ad\n\nmin_cost, prev_points = dijkstra(I)\n\nfor i in range(1, N):\n print(min(min_cost[i*(N*A_m+1):(i+1)*(N*A_m+1)]))'] | ['Wrong Answer', 'Accepted'] | ['s543312011', 's696347311'] | [9240.0, 98312.0] | [28.0, 1153.0] | [1070, 2273] |
p02703 | u994988729 | 2,000 | 1,048,576 | There are N cities numbered 1 to N, connected by M railroads. You are now at City 1, with 10^{100} gold coins and S silver coins in your pocket. The i-th railroad connects City U_i and City V_i bidirectionally, and a one- way trip costs A_i silver coins and takes B_i minutes. You cannot use gold coins to pay the fare. There is an exchange counter in each city. At the exchange counter in City i, you can get C_i silver coins for 1 gold coin. The transaction takes D_i minutes for each gold coin you give. You can exchange any number of gold coins at each exchange counter. For each t=2, ..., N, find the minimum time needed to travel from City 1 to City t. You can ignore the time spent waiting for trains. | ['import heapq\nimport sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n\nN, M, S = map(int, input().split())\nedge = [[] for _ in range(N)]\nfor _ in range(M):\n u, v, a, b = map(int, input().split())\n u -= 1\n v -= 1\n edge[u].append((v, a, b))\n edge[v].append((u, a, b))\nCD = tuple(tuple(map(int, input().split())) for _ in range(N))\n\ninf = 10**18\nU = N*50\nS = min(S, U)\ndist = [[inf] * (U + 1) for _ in range(N)]\ndist[0][S] = 0\n\nque = [(0, -S, 0)] \nwhile que:\n time, silver, now = heapq.heappop(que)\n silver = -silver\n if dist[now][silver] < time:\n continue\n \n c, d = CD[now]\n n = 1\n while silver + c * n <= U:\n if dist[now][silver + c * n] > time + n * d:\n dist[now][silver + c * n] = time + n * d\n heapq.heappush(que, (time + n * d, -(silver + c * n), now))\n n += 1\n \n for nxt, s, t in edge[now]:\n if silver < s:\n continue\n if dist[nxt][silver - s] > time + t:\n dist[nxt][silver - s] = time + t\n heapq.heappush(que, (time + t, -(silver - s), nxt))\n\nfor i in range(1, N):\n print(min(dist[i]))', 'import heapq\nimport sys\ninput = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 7)\n\nN, M, S = map(int, input().split())\nedge = [[] for _ in range(N)]\nfor _ in range(M):\n u, v, a, b = map(int, input().split())\n u -= 1\n v -= 1\n edge[u].append((v, a, b))\n edge[v].append((u, a, b))\nCD = tuple(tuple(map(int, input().split())) for _ in range(N))\n\ninf = 10**18\nU = N*50\nS = min(S, U)\ndist = [[inf] * (U + 1) for _ in range(N)]\ndist[0][S] = 0\n\nque = [(0, -S, 0)] \nwhile que:\n time, silver, now = heapq.heappop(que)\n silver = -silver\n if dist[now][silver] < time:\n continue\n \n c, d = CD[now]\n n = 1\n while silver + c * n <= U:\n if dist[now][silver + c * n] > time + n * d:\n dist[now][silver + c * n] = time + n * d\n heapq.heappush(que, (time + n * d, -(silver + c * n), now))\n n += 1\n else:\n break\n \n for nxt, s, t in edge[now]:\n if silver < s:\n continue\n if dist[nxt][silver - s] > time + t:\n dist[nxt][silver - s] = time + t\n heapq.heappush(que, (time + t, -(silver - s), nxt))\n\nfor i in range(1, N):\n print(min(dist[i]))'] | ['Time Limit Exceeded', 'Accepted'] | ['s006992591', 's054544282'] | [10312.0, 55000.0] | [2206.0, 1547.0] | [1211, 1243] |
p02704 | u389910364 | 2,000 | 1,048,576 | Given are an integer N and arrays S, T, U, and V, each of length N. Construct an N×N matrix a that satisfy the following conditions: * a_{i,j} is an integer. * 0 \leq a_{i,j} \lt 2^{64}. * If S_{i} = 0, the bitwise AND of the elements in the i-th row is U_{i}. * If S_{i} = 1, the bitwise OR of the elements in the i-th row is U_{i}. * If T_{i} = 0, the bitwise AND of the elements in the i-th column is V_{i}. * If T_{i} = 1, the bitwise OR of the elements in the i-th column is V_{i}. However, there may be cases where no matrix satisfies the conditions. | ['import os\n\nimport sys\nimport numpy as np\n\nfrom libs.debug import debug\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(10 ** 9)\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\n\nN = int(sys.stdin.buffer.readline())\nrow_or = list(map(int, sys.stdin.buffer.readline().split()))\ncol_or = list(map(int, sys.stdin.buffer.readline().split()))\nright = list(map(int, sys.stdin.buffer.readline().split()))\ndown = list(map(int, sys.stdin.buffer.readline().split()))\n\nrow_or = np.array(row_or, dtype=bool)\nrow_and = ~row_or\ncol_or = np.array(col_or, dtype=bool)\ncol_and = ~col_or\nright = np.array(right, dtype=int)\ndown = np.array(down, dtype=int)\n\n\n@debug\ndef solve(right, down):\n ret = np.full((N, N), -1, dtype=int)\n yet_rows = []\n yet_cols = []\n used = [False] * 2\n for r in range(N):\n if row_or[r] and right[r] == 0:\n ret[r, :] = 0\n used[0] = True\n elif row_and[r] and right[r] == 1:\n ret[r, :] = 1\n used[1] = True\n else:\n yet_rows.append(r)\n for c in range(N):\n if col_or[c] and down[c] == 0:\n ret[:, c] = 0\n used[0] = True\n elif col_and[c] and down[c] == 1:\n ret[:, c] = 1\n used[1] = True\n else:\n yet_cols.append(c)\n\n if len(yet_cols) == 1:\n c = yet_cols[0]\n if not used[0]:\n \n ret[yet_rows, c] = 0\n for r in yet_rows:\n \n \n if row_or[r] and right[r] == 1:\n ret[r, c] = 1\n break\n elif not used[1]:\n \n ret[yet_rows, c] = 1\n for r in yet_rows:\n \n \n if row_and[r] and right[r] == 0:\n ret[r, c] = 0\n break\n else:\n \n ret[yet_rows, c] = np.arange(len(yet_rows), dtype=int) % 2\n elif len(yet_rows) == 1:\n r = yet_rows[0]\n if not used[0]:\n \n ret[r, yet_cols] = 0\n for c in yet_cols:\n \n \n if col_or[c] and down[c] == 1:\n ret[r, c] = 1\n break\n elif not used[1]:\n \n ret[r, yet_cols] = 1\n for c in yet_cols:\n \n \n if col_and[c] and down[c] == 0:\n ret[r, c] = 0\n break\n else:\n \n ret[r, yet_cols] = np.arange(len(yet_cols), dtype=int) % 2\n else:\n \n for i, r in enumerate(yet_rows):\n ret[r, yet_cols] = (np.arange(len(yet_cols), dtype=int) + i) % 2\n\n \n ok = True\n for r in range(N):\n if row_and[r]:\n if right[r] == 1:\n ok &= np.all(ret[r, :] == 1)\n else:\n ok &= np.any(ret[r, :] == 0)\n else:\n if right[r] == 1:\n ok &= np.any(ret[r, :] == 1)\n else:\n ok &= np.all(ret[r, :] == 0)\n for c in range(N):\n if col_and[c]:\n if down[c] == 1:\n ok &= np.all(ret[:, c] == 1)\n else:\n ok &= np.any(ret[:, c] == 0)\n else:\n if down[c] == 1:\n ok &= np.any(ret[:, c] == 1)\n else:\n ok &= np.all(ret[:, c] == 0)\n return ret, ok\n\n\nans = np.zeros((N, N), dtype=int)\nfor i in range(64):\n bits, ok = solve(right >> i & 1, down >> i & 1)\n if not ok:\n print(-1)\n exit()\n ans |= bits << i\n\nfor row in ans:\n print(*row)\n', 'import os\n\nimport sys\nimport numpy as np\n\nif os.getenv("LOCAL"):\n sys.stdin = open("_in.txt", "r")\n\nsys.setrecursionlimit(10 ** 9)\nINF = float("inf")\nIINF = 10 ** 18\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\n\nN = int(sys.stdin.buffer.readline())\nrow_or = list(map(int, sys.stdin.buffer.readline().split()))\ncol_or = list(map(int, sys.stdin.buffer.readline().split()))\nright = list(map(int, sys.stdin.buffer.readline().split()))\ndown = list(map(int, sys.stdin.buffer.readline().split()))\n\nrow_or = np.array(row_or, dtype=bool)\nrow_and = ~row_or\ncol_or = np.array(col_or, dtype=bool)\ncol_and = ~col_or\nright = np.array(right, dtype=\'uint64\')\ndown = np.array(down, dtype=\'uint64\')\n\n\ndef solve(right, down):\n ret = np.full((N, N), 7, dtype=\'uint64\')\n yet_rows = []\n yet_cols = []\n used = [False] * 2\n for r in range(N):\n if row_or[r] and right[r] == 0:\n ret[r, :] = 0\n used[0] = True\n elif row_and[r] and right[r] == 1:\n ret[r, :] = 1\n used[1] = True\n else:\n yet_rows.append(r)\n for c in range(N):\n if col_or[c] and down[c] == 0:\n ret[:, c] = 0\n used[0] = True\n elif col_and[c] and down[c] == 1:\n ret[:, c] = 1\n used[1] = True\n else:\n yet_cols.append(c)\n\n if len(yet_cols) == 1:\n c = yet_cols[0]\n if not used[0]:\n \n ret[yet_rows, c] = 0\n if down[c] == 1:\n for r in yet_rows:\n \n \n if row_or[r] and right[r] == 1:\n ret[r, c] = 1\n break\n elif not used[1]:\n \n ret[yet_rows, c] = 1\n if down[c] == 0:\n for r in yet_rows:\n \n \n if row_and[r] and right[r] == 0:\n ret[r, c] = 0\n break\n else:\n \n ret[yet_rows, c] = np.arange(len(yet_rows), dtype=int) % 2\n elif len(yet_rows) == 1:\n r = yet_rows[0]\n if not used[0]:\n \n ret[r, yet_cols] = 0\n if right[r] == 1:\n for c in yet_cols:\n \n \n if col_or[c] and down[c] == 1:\n ret[r, c] = 1\n break\n elif not used[1]:\n \n ret[r, yet_cols] = 1\n if right[r] == 0:\n for c in yet_cols:\n \n \n if col_and[c] and down[c] == 0:\n ret[r, c] = 0\n break\n else:\n \n ret[r, yet_cols] = np.arange(len(yet_cols), dtype=int) % 2\n else:\n \n for i, r in enumerate(yet_rows):\n ret[r, yet_cols] = (np.arange(len(yet_cols), dtype=int) + i) % 2\n\n \n ok = True\n for r in range(N):\n if row_and[r]:\n if right[r] == 1:\n ok &= np.all(ret[r, :] == 1)\n else:\n ok &= np.any(ret[r, :] == 0)\n else:\n if right[r] == 1:\n ok &= np.any(ret[r, :] == 1)\n else:\n ok &= np.all(ret[r, :] == 0)\n for c in range(N):\n if col_and[c]:\n if down[c] == 1:\n ok &= np.all(ret[:, c] == 1)\n else:\n ok &= np.any(ret[:, c] == 0)\n else:\n if down[c] == 1:\n ok &= np.any(ret[:, c] == 1)\n else:\n ok &= np.all(ret[:, c] == 0)\n assert np.all(ret <= 1)\n return ret & 1, ok\n\n\nans = np.zeros((N, N), dtype=\'uint64\')\nfor i in range(64):\n bits, ok = solve(right >> i & 1, down >> i & 1)\n if not ok:\n print(-1)\n exit()\n ans |= bits << i\n\nfor row in ans:\n print(*row)\n'] | ['Runtime Error', 'Accepted'] | ['s937285473', 's247066428'] | [27064.0, 38620.0] | [108.0, 1979.0] | [4340, 4568] |
p02704 | u493130708 | 2,000 | 1,048,576 | Given are an integer N and arrays S, T, U, and V, each of length N. Construct an N×N matrix a that satisfy the following conditions: * a_{i,j} is an integer. * 0 \leq a_{i,j} \lt 2^{64}. * If S_{i} = 0, the bitwise AND of the elements in the i-th row is U_{i}. * If S_{i} = 1, the bitwise OR of the elements in the i-th row is U_{i}. * If T_{i} = 0, the bitwise AND of the elements in the i-th column is V_{i}. * If T_{i} = 1, the bitwise OR of the elements in the i-th column is V_{i}. However, there may be cases where no matrix satisfies the conditions. | ['import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.int64)\nT = np.array(list(map(int,input().split())),dtype = np.int64)\nU = np.array(list(map(int,input().split())),dtype = np.int64)\nV = np.array(list(map(int,input().split())),dtype = np.int64)\n\nans = np.zeros((N,N),dtype = np.int64)\nexit()\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,int)-u\n invv = np.ones(N,int)-v\n b = np.zeros((N,N),int)\n check = np.zeros((N,N),int)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),int)) & np.dot(np.array([v]).T,np.ones((1,N),int)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),int)) & np.dot(np.array([invv]).T,np.ones((1,N),int)).T\n b |= same1\n check |= (same1|same0)\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n flag = 0 \n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n flag = 0 \n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n flag = 0 \n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n flag = 0 \n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n\n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 1:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 1:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVzerozerolist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n YOKOSUM = [sum(b[i]) for i in range(N)]\n TATESUM = [sum(b[:,i]) for i in range(N)]\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = list(map(int,input().split()))\nT = list(map(int,input().split()))\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n su = [int(S[i]*2+u[i]) for i in range(N)]\n tv = [int(T[i]*2+v[i]) for i in range(N)]\n suzerozero = []\n suoneone = []\n tvzerozero = []\n tvoneone = []\n for i in range(N):\n if su[i] == 0:\n suzerozero.append(i)\n if su[i] == 3:\n suoneone.append(i)\n for i in range(N):\n if tv[i] == 0:\n tvzerozero.append(i)\n if tv[i] == 3:\n tvoneone.append(i)\n \n b = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if su[i] == 1:\n b[i] = np.ones(N,int)\n \n for i in range(N):\n if tv[i] == 1:\n b[:,i] = np.ones(N,int)\n \n b |= np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n \n if 1 not in tv and 3 not in tv:\n m = len(tvzerozero)\n now = 0\n for i in suoneone:\n b[i][tvzerozero[now%m]] += 1\n now += 1\n \n if 1 not in su and 3 not in su:\n m = len(suzerozero)\n now = 0\n for i in tvoneone:\n b[suzerozero[now%m]][i] += 1\n now += 1\n ans += b<<n\nprint(ans)\ndef end():\n print(-1)\n exit()\nfor i in range(N):\n if S[i] == 0:\n now = ans[i][0]\n for j in range(1,N):\n now &= ans[i][j]\n if S[i] == 1:\n now = ans[i][0]\n for j in range(1,N):\n now |= ans[i][j]\n if now != U[i]:\n end()\nfor i in range(N):\n if T[i] == 0:\n now = ans[0][i]\n for j in range(1,N):\n now &= ans[j][i]\n if T[i] == 1:\n now = ans[0][i]\n for j in range(1,N):\n now |= ans[j][i]\n if now != V[i]:\n end()\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n c = 0\n for i in range(N):\n for j in range(N):\n c += 1\n continue\n \n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n\n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 1:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 1:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVzerozerolist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n YOKOSUM = [sum(b[i]) for i in range(N)]\n TATESUM = [sum(b[:,i]) for i in range(N)]\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n continue\n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVzerozerolist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n c = 0\n for i in range(N):\n for j in range(N):\n c += 1\n c += 1\n continue\n \n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n\n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 1:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 1:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVzerozerolist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n YOKOSUM = [sum(b[i]) for i in range(N)]\n TATESUM = [sum(b[:,i]) for i in range(N)]\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n\n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 1:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 1:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVzerozerolist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.uint64)\nT = np.array(list(map(int,input().split())),dtype = np.uint64)\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,dtype = np.uint64)-u\n invv = np.ones(N,dtype = np.uint64)-v\n b = np.zeros((N,N),dtype = np.uint64)\n check = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([invv]).T,np.ones((1,N),dtype = np.uint64)).T\n b |= same1\n check |= (same1|same0)\n \n SUoneonelist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUoneonelist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVoneonelist.append(i)\n SUzerozerolist = []\n for i in range(N):\n if S[i] == u[i] == 0:\n SUzerozerolist.append(i)\n TVoneonelist = []\n for i in range(N):\n if T[i] == v[i] == 0:\n TVzerozerolist.append(i)\n continue\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n pass\n """\n flag = 0 #未解決\n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))\n', 'import numpy as np\n\nN = int(input())\n\nS = np.array(list(map(int,input().split())),dtype = np.int64)\nT = np.array(list(map(int,input().split())),dtype = np.int64)\nU = np.array(list(map(int,input().split())),dtype = np.int64)\nV = np.array(list(map(int,input().split())),dtype = np.int64)\n\nans = np.zeros((N,N),dtype = np.int64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n invu = np.ones(N,int)-u\n invv = np.ones(N,int)-v\n b = np.zeros((N,N),int)\n check = np.zeros((N,N),int)\n \n for i in range(N):\n if S[i] != u[i]:\n if u[i] == 1:\n b[i] = np.ones(N,int)\n check[i] = np.ones(N,int)\n \n for i in range(N):\n if T[i] != v[i]:\n if v[i] == 1:\n if max(b[:,i]^check[:,i])!=0:\n print(-1)\n exit()\n b[:,i] = np.ones(N,int)\n if v[i] == 0:\n if max(b[:,i])!=0:\n print(-1)\n exit()\n check[:,i] = np.ones((1,N),int)\n break\n \n same1 = np.dot(np.array([u]).T,np.ones((1,N),int)) & np.dot(np.array([v]).T,np.ones((1,N),int)).T\n same0 = np.dot(np.array([invu]).T,np.ones((1,N),int)) & np.dot(np.array([invv]).T,np.ones((1,N),int)).T\n b |= same1\n check |= (same1|same0)\n \n for i in range(N):\n if S[i] == u[i] == 1 and max(b[i]) == 0: \n flag = 0 \n for j in range(N):\n if T[j] == v[j] == b[i][j] == check[i][j] == 0 and sum(b[:,j]) < N-1:\n b[i][j] = check[i][j] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n \n \n for i in range(N):\n if T[i] == v[i] == 1 and max(b[:,i]) == 0: \n flag = 0 \n for j in range(N):\n if S[j] == u[j] == b[j][i] == check[j][i] == 0 and sum(b[j]) < N-1:\n b[j][i] = check[j][i] = flag = 1\n break\n if not flag:\n print(-1)\n exit()\n """\n for i in range(N):\n if S[i] == 0 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] == mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 0 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] != mask_gyo[i]:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 0:\n if b & mask_gyo[i] != 0:\n print(-1)\n exit()\n if S[i] == 1 and((u>>i) & 1) == 1:\n if b & mask_gyo[i] == 0:\n print(-1)\n exit()\n \n for i in range(N):\n if T[i] == 0 and((v>>i) & 1) == 0:\n if b & mask_retu[i] == mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 0 and((v>>i) & 1) == 1:\n if b & mask_retu[i] != mask_retu[i]:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 0:\n if b & mask_retu[i] != 0:\n print(-1)\n exit()\n if T[i] == 1 and((v>>i) & 1) == 1:\n if b & mask_retu[i] == 0:\n print(-1)\n exit()\n """\n ans += b<<n\n\n\nfor item in ans:\n print(*list(item))', 'import numpy as np\n\nN = int(input())\n\nS = list(map(int,input().split()))\nT = list(map(int,input().split()))\nU = np.array(list(map(int,input().split())),dtype = np.uint64)\nV = np.array(list(map(int,input().split())),dtype = np.uint64)\n\nans = np.zeros((N,N),dtype = np.uint64)\n\nfor n in range(64):\n u = (U>>n)&1\n v = (V>>n)&1\n su = [int(S[i]*2+u[i]) for i in range(N)]\n tv = [int(T[i]*2+v[i]) for i in range(N)]\n suzerozero = []\n suoneone = []\n tvzerozero = []\n tvoneone = []\n for i in range(N):\n if su[i] == 0:\n suzerozero.append(i)\n if su[i] == 3:\n suoneone.append(i)\n for i in range(N):\n if tv[i] == 0:\n tvzerozero.append(i)\n if tv[i] == 3:\n tvoneone.append(i)\n \n b = np.zeros((N,N),dtype = np.uint64)\n \n for i in range(N):\n if su[i] == 1:\n b[i] = np.ones(N,int)\n \n for i in range(N):\n if tv[i] == 1:\n b[:,i] = np.ones(N,int)\n \n b |= np.dot(np.array([u]).T,np.ones((1,N),dtype = np.uint64)) & np.dot(np.array([v]).T,np.ones((1,N),dtype = np.uint64)).T\n \n if 1 not in tv and 3 not in tv:\n m = len(tvzerozero)\n now = 0\n for i in suoneone:\n b[i][tvzerozero[now%m]] += 1\n now += 1\n \n if 1 not in su and 3 not in su:\n m = len(suzerozero)\n now = 0\n for i in tvoneone:\n b[suzerozero[now%m]][i] += 1\n now += 1\n ans += b<<n\n\ndef end():\n print(-1)\n exit()\nfor i in range(N):\n if S[i] == 0:\n now = ans[i][0]\n for j in range(1,N):\n now &= ans[i][j]\n if S[i] == 1:\n now = ans[i][0]\n for j in range(1,N):\n now |= ans[i][j]\n if now != U[i]:\n end()\nfor i in range(N):\n if T[i] == 0:\n now = ans[0][i]\n for j in range(1,N):\n now &= ans[j][i]\n if T[i] == 1:\n now = ans[0][i]\n for j in range(1,N):\n now |= ans[j][i]\n if now != V[i]:\n end()\n\nfor item in ans:\n print(*list(item))\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s036285914', 's058015330', 's179065029', 's198852640', 's243216661', 's460975733', 's566317148', 's625327662', 's946245993', 's975285944', 's264368601'] | [27300.0, 40956.0, 41352.0, 37480.0, 27592.0, 41128.0, 27256.0, 41556.0, 41284.0, 27008.0, 37348.0] | [114.0, 1225.0, 2207.0, 933.0, 1570.0, 1244.0, 2206.0, 1388.0, 1322.0, 115.0, 951.0] | [3074, 3197, 3738, 2044, 3817, 3662, 3830, 3652, 3652, 3076, 2034] |
p02705 | u428246454 | 2,000 | 1,048,576 | Print the circumference of a circle of radius R. | ['import math\nR = int(input())\ncircumference = 2 * math.pi * R\nprint("%.20f" % circumference())', 'PI = 3.14159265\ndef circumference(r):\n return (2 * PI * r)', 'import math\nR = float(input())\ncircumference = 2 * math.pi * R\nprint("%.20f" % circumference)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s143786585', 's632150499', 's288226694'] | [9124.0, 9016.0, 9116.0] | [19.0, 21.0, 22.0] | [93, 61, 93] |
p02706 | u003855259 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N=()\nM=()\nA=()\n\nN=int(input(""))\nM=int(input(""))\n \nfor i in range (0,M):\n A=int(input(""))\n N=(N-A)\n \nif N<0:\n print("-1")\nelse:\n print(N)', 'N=()\nM=()\nA=()\n\nN=int(input(""))\nM=int(input(""))\n \nfor i in range (0,M):\n A=int(input(""))\n N=(N-A)\n \nif N<0:\n print("-1")\nelse:\n print(N)', 'N=()\nM=()\nA=()\n\nN, M = map(int, input().split())\n\nA = list(map(int, input().split()))\nfor i in range(0,M): \n N=N-A[i]\n \nif N<0:\n print("-1")\nelse:\n print(N)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s219739258', 's986095827', 's111783705'] | [9184.0, 8888.0, 10008.0] | [24.0, 21.0, 24.0] | [169, 169, 176] |
p02706 | u004233621 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = input().split()\nadd = 0\nn = int(n)\nm = int(m)\nlst = list(map(int,input().split()))\nfor i in lst:\n add += i\nif add>n :\n print(-1)\nelif(add = n):\n print(0)\nelse:\n print(n-add)', 'n,m = input().split()\nadd = 0\nn = int(n)\n\nm = int(m)\n\nfor i in range(m):\n lst = list(map(int,input().split()))\nfor i in lst:\n add += i\nif add>n :\n print(-1)\nelif(add = n):\n print(0)\nelse:\n print(n-add)', 'n,m = input().split()\nadd = 0\nn = int(n)\nm = int(m)\nlst = list(map(int,input().split()))\nfor i in lst:\n add += i\nif add>n :\n print(-1)\nelif(add == n):\n print(0)\nelse:\n print(n-add)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s036688344', 's116679794', 's537180238'] | [8960.0, 8980.0, 10108.0] | [22.0, 21.0, 27.0] | [183, 206, 184] |
p02706 | u006425112 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nhomework = A.sum()\nprint(n - m if n - m >= 0 else -1)', 'n, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nhomework = sum(A) \nprint(n - m if n - m >= 0 else -1)', 'n, m = map(int, input().split())\nA = list(map(int, input().split()))\n\nhomework = sum(A) \nprint(n - homework if n - homework >= 0 else -1)\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s161432771', 's597797477', 's855111305'] | [10164.0, 10028.0, 10032.0] | [21.0, 22.0, 22.0] | [123, 123, 138] |
p02706 | u018591138 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int, input().split())\n\na = list(map(int,input().split()))\n\ndays = 0\n\nfor i in range(m):\n days += a[i]\n\nremaining = n-days\n\nif remaining < 0:\n print(-1)\nelse:\n print(remainig)', 'n,m = map(int, input().split())\n\na = list(map(int,input().split()))\n\ndays = 0\n\nfor i in range(m):\n days += a[i]\n\nremaining = n-days\n\nif remaining < 0:\n print(-1)\nelse:\n print(remaining)'] | ['Runtime Error', 'Accepted'] | ['s863875602', 's644376240'] | [10064.0, 10000.0] | [23.0, 24.0] | [193, 194] |
p02706 | u018679195 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['x, y = [int(x) for x in input().split()]\n\nfor tareas in range(y):\n\n c = int(input())\n\n x-=c\nprint(x)\n\n', 'dias,tareas=input().split()\ndias=int(dias)\ntareas=int(tareas)\ntodas=input().split()\nsuma=0\nfor cada in todas:\n suma+=int(cada)\nif suma<=dias:\n print(dias-suma)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s561658263', 's147257512'] | [8920.0, 9316.0] | [25.0, 27.0] | [108, 185] |
p02706 | u019075898 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = int(input().split())\nA = [int(a) for a input().split()]\nif N - sum(A) >= 0:\n print(N - sum(A))\nelse:\n print(-1)\n', '\nN, M = [int(x) for x in input().split()]\nA = [int(a) for a input()]\ntmp = N - sum(A)\nif tmp >= 0:\n print(tmp)\nelse:\n print(-1)\n', 'N, M = [int(x) for x in input().split()]\nA = [int(a) for a input().split()]\ntmp = N - sum(A)\nif tmp >= 0:\n print(tmp)\nelse:\n print(-1)', 'N, M = int(input().split())\nA = [int(a) for a input().split()]\ntmp = N - sum(A)\nif tmp >= 0:\n print(tmp)\nelse:\n print(-1)\n', 'N, M = [int(x) for x in input().split()]\nA = [int(a) for a in input().split()]\ntmp = N - sum(A)\nif tmp >= 0:\n print(tmp)\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s050012236', 's445833650', 's626534534', 's945072159', 's869002769'] | [8972.0, 9028.0, 8860.0, 8988.0, 9956.0] | [23.0, 20.0, 20.0, 23.0, 22.0] | [125, 134, 140, 128, 143] |
p02706 | u021217230 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m=map(int,input().split())\nl=list(map(int,input().split()))\ns=sum(l)\nif s>l:\n print(-1)\nelse:\n print(l-s)', 'n,m=map(int,input().split())\nl=list(map(int,input().split()))\ns=sum(l)\nif s>n:\n print(-1)\nelse:\n print(n-s)\n'] | ['Runtime Error', 'Accepted'] | ['s130219055', 's695401286'] | [9860.0, 10012.0] | [24.0, 22.0] | [109, 110] |
p02706 | u021906447 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\n\na = 0\nfor i in range(M):\n b = int(input())\n a += b\n\nday = N-a\nprint(day)', 'N, M = map(int, input().split())\n \na = 0\nfor i in range(M):\n b = int(input())\n a += b\n\nday_count = N-a\n\nif day_count>=0:\n print(day)\nelse:\n print(-1)', 'N, M = map(int, input().split())\n\na = 0\nfor i in range(M):\n c_sum = int(input())\n a += b\n\nday_count = N-c_sum\n\nif day_count>=0:\n print(day_count)\nelse:\n print(-1)', 'N, M = map(int, input().split())\n\nc_sum = 0\nfor i in range(M):\n b = int(input())\n c_sum += b\n\nday_count = N-c_sum\n\nif day_count>=0:\n print(day_count)\nelse:\n print(-1)', 'N, M = map(int, input().split())\n\nc = list(map(int,input().split()))\nc_sum = sum(c)\n\nday_count = N-c_sum\n\nif day_count>=0:\n print(day_count)\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s114425966', 's185322194', 's403842919', 's426511398', 's746897791'] | [9172.0, 9144.0, 9148.0, 9188.0, 9844.0] | [20.0, 21.0, 21.0, 25.0, 23.0] | [108, 153, 166, 170, 159] |
p02706 | u031722966 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int,input().split())\nA = list(map(int,input().split()))\n\nif sum(A) < N:\n print(-1)\nelse:\n print(N - sum(A))', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\n\nif sum(A) < A:\n print(-1)\nelse:\n print(A - sum(A))', 'N , M = map(int,input().split())\nA = list(map(int,input().split()))\nif N < sum(A):\n print(-1)\nelse:\n print(N - sum(A))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s146805829', 's674559738', 's975035284'] | [9852.0, 10124.0, 9884.0] | [30.0, 28.0, 21.0] | [123, 123, 124] |
p02706 | u033360495 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = [int(s) for s in input().split()]\nA = [int(a) for a in input().split()]\n\nd = N - sum(A)\n\nif d > 0:\n return d\nelse:\n return -1', 'N, M = [int(s) for s in input().split()]\nA = [int(a) for a in input().split()]\n\nd = N - sum(A)\n\nif d >= 0:\n print(d)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s560359982', 's062727897'] | [9100.0, 10000.0] | [24.0, 23.0] | [138, 139] |
p02706 | u037601040 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['import math\nprint(2*math.pi*int(input()))\n', 'a, b = input().split()\nlis = list(map(int, input().split()))\nprint(int(a) - sum(lis) if int(a) >= sum(lis) else "-1")\n'] | ['Runtime Error', 'Accepted'] | ['s979880415', 's526667400'] | [9188.0, 9892.0] | [23.0, 23.0] | [42, 118] |
p02706 | u038819082 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M=map(int,input().split())\nA=list(map(int,input().split()))\nc=0\nfor i in range(M):\n c+=i\nf=N-c\nif f<0:\n f=-1\nprint(f)', 'N,M=map(int,input().split())\nA=list(map(int,input().split()))\nc=0\nfor i in range(M):\n c+=A[i]\nf=N-c\nif f<0:\n f=-1\nprint(f)'] | ['Wrong Answer', 'Accepted'] | ['s631821468', 's875575497'] | [10192.0, 9880.0] | [21.0, 23.0] | [125, 128] |
p02706 | u047918169 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n, m = map(int, input())\na = sum([int(i) for i in input().split()])\n\nprint(n-a if n-a>=0 else '-1')", "n, m = map(int, input().split())\na = sum([int(i) for i in input().split()])\n\nprint(n-a if n-a>=0 else '-1')"] | ['Runtime Error', 'Accepted'] | ['s224116104', 's109309028'] | [9116.0, 9884.0] | [22.0, 22.0] | [99, 107] |
p02706 | u049355439 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n,m = map(int, input().strip().sprit(' '))\n\nhomework = list(map(int, input().strip().sprit(' ')))\n\nday = n - sum(homework)\n\nif day >= 0:\n print(day)\nelse:\n print(-1)\n\n ", 'n,m = map(int, input().strip().split(" "))\n\nhomework = list(n,m)\n\nday = n - sum(homework)\n\nif day >= 0:\n \n print(day)\n \nelse:\n \n print(-1)', 'n,m = map(int, input().strip().split(" "))\n \nhomework = list(map(int, input().strip().split(" ")))\n \nday = n - sum(homework)\n \nif day >= 0:\n print(day)\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s008473105', 's073972306', 's653751764'] | [9044.0, 9168.0, 10116.0] | [21.0, 21.0, 23.0] | [171, 143, 174] |
p02706 | u050805798 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['a,b = map(int,input().split())\nc = [int(x) for x in input().split()]\nprint(c,len(c))\ncsum = 0\nfor i in range(len(c)):\n csum = csum + c[i]\nif a>=csum:\n print(a-csum)\nelse:\n print(-1)', 'a,b = map(int,input().split())\nc = [int(x) for x in input().split()]\ncsum = 0\nfor i in range(len(c)):\n csum = csum + c[i]\nif a>=csum:\n print(a-csum)\nelse:\n print(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s538417263', 's242661470'] | [10060.0, 10056.0] | [26.0, 22.0] | [190, 175] |
p02706 | u054858774 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\n\nl = list()\nfor i in range(m):\n k = int(input())\n l.append(k)\ns = sum(l)\n\nans = n-s\nif ans>=0:\n print(ans)\nelse:\n print(-1)', 'n,m = map(int,input().split())\n\nl = list(map(int,input().split()))\n\ns = sum(l)\n\nans = n-s\nif ans>=0:\n print(ans)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s416266409', 's474003235'] | [9288.0, 9980.0] | [21.0, 24.0] | [158, 131] |
p02706 | u055244973 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["print('number of days of summer vacation: ')\nN = int(input())\nprint('number of summer assignments: ')\nM = int(input())\n\nfor i in range(M):\n Ai = int(input())\n N = N - Ai\n\nif N >= 0:\n print(N)\nelse:\n N = -1\n print(N)", 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nans = N - sum(A)\n\nif ans < 0:\n print(-1)\nelse:\n print(ans)'] | ['Runtime Error', 'Accepted'] | ['s726171351', 's612744609'] | [9048.0, 10064.0] | [23.0, 23.0] | [230, 134] |
p02706 | u067986264 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = input().split()\nif sum(A) > N:\n print(-1)\nelse:\n print(N - sum(A))', 'N, M = map(int, input().split())\nA = input().split()\nif sum(int(i) for i in A) > N:\n print(-1)\nelse:\n print(N - sum(int(i) for i in A))'] | ['Runtime Error', 'Accepted'] | ['s831353569', 's887610668'] | [9580.0, 9520.0] | [26.0, 23.0] | [105, 141] |
p02706 | u072080927 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['j=list(map(int,input().split())) \nn=j[0]\nm=j[1]\na=list(map(int,input().split()))\ns=int(0)\nfor i in range[0,m]:\n s+=a[i]\nif n-s<0:\n print(-1)\nelse:\n print(n-s)', 'j=list(map(int,input().split())) \nn=j[0]\na=list(map(int,input().split()))\ns=sum(a)\nif n-s<0:\n print(-1)\nelse:\n print(n-s)\n'] | ['Runtime Error', 'Accepted'] | ['s044659900', 's820137301'] | [10008.0, 9988.0] | [24.0, 22.0] | [161, 124] |
p02706 | u075304271 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['def solve():\n n, m = map(int, input().split())\n a = list(map(int, input().split()))\n hoge = max(0, n-sum(a))\n if hoge == 0:\n print(-1)\n else:\n print(a)\n return 0\n \nif __name__ == "__main__":\n solve()\n', 'def solve():\n n, m = map(int, input().split())\n a = list(map(int, input().split()))\n hoge = max(0, n-sum(a))\n if hoge > 0:\n print(a)\n else:\n print(-1)\n return 0\n \nif __name__ == "__main__":\n solve()\n', 'def solve():\n n, m = map(int, input().split())\n a = list(map(int, input().split()))\n hoge = max(-1, n-sum(a))\n print(hoge)\n return 0\n \nif __name__ == "__main__":\n solve()\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s267641400', 's827358001', 's509380521'] | [9996.0, 9876.0, 10060.0] | [25.0, 24.0, 23.0] | [213, 212, 177] |
p02706 | u080475902 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m=map(int,input().split())\na=list(map(int,input().split()))\np=0\nfor i in a:\n p+=i\nif(n>=p):\n print("{}",n-p)\nelse:\n print("{}",-1)', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\np=0\nfor i in a:\n p+=i\nif(n>=p):\n print("{}",n-p)\nelse:\n print("-1")', 'n,m=map(int,input().split())\na=0\na+=map(int,input().split())\nif(n>a):\n print("{}",n-a)\nelse:\n print("-1",', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\np=0\nfor i in a:\n p+=i\nif(n>=p):\n print("{}".format(n-p))\nelse:\n print("-1")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s183903580', 's255756415', 's281557020', 's699783436'] | [10004.0, 10052.0, 9036.0, 10140.0] | [23.0, 22.0, 22.0, 22.0] | [155, 140, 107, 160] |
p02706 | u082861480 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int,input().splti())\nhomeworks = [int(i) for i in input().splti()]\nprint(-1 if sum(homeworks) > N else sum(homeworks) - N))', 'N,M = map(int,input().split())\nhomeworks = [int(i) for i in input().split()]\nprint(-1 if sum(homeworks) > N else sum(homeworks) - N))', 'N,M = map(int,input().split())\nhomeworks = [int(i) for i in input().split()]\nprint(-1 if sum(homeworks) > N else N - sum(homeworks))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s242721014', 's837536371', 's731487952'] | [9040.0, 9044.0, 10060.0] | [20.0, 21.0, 24.0] | [133, 133, 132] |
p02706 | u086624329 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M=map(int,input().split())\n\nA=[int(input())for i in range(M)]\n\nprint(N-sum(A))', "N,M=map(int,input().split())\n\nA=list(map(int,input().split()))\n\nif N-sum(A)>=0:\n print(N-sum(A))\n \nelse:\n print('-1')"] | ['Runtime Error', 'Accepted'] | ['s194221694', 's321550089'] | [9224.0, 10080.0] | [22.0, 22.0] | [80, 126] |
p02706 | u088475928 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M=map(int,input().split())\np=list(map(int,input().split()))\nif np.sum(p)>M:\n print(-1)\nelse:\n print(N-np.sum(p))', 'import numpy as np\nN,M=map(int,input().split())\np=list(map(int,input().split()))\nif np.sum(p)>M:\n print(-1)\nelse:\n print(N-np.sum(p))', 'import numpy as np\nN,M=map(int,input().split())\np=list(map(int,input().split()))\nif np.sum(p)>N:\n print(-1)\nelse:\n print(N-np.sum(p))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s727685169', 's877892698', 's397598373'] | [9852.0, 27784.0, 27772.0] | [21.0, 108.0, 105.0] | [116, 135, 135] |
p02706 | u090406054 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m= map(int,input().split())\na = list(map(int,input().split()))\n\nhwdsum=0\nk=0\nwhile k<= m-1:\n hwdsum += a[k]\n k+=1\n \nif n-hwdsum>=0:\n print(str(hwdsum))\n \nelse:\n print(str(-1))\n\n', 'n,m= map(int,input().split())\na = list(map(int,input().split()))\n\nhwdsum=0\nk=0\nwhile k<= m-1:\n sum += a[k]\n \nif n-sum>=0:\n print(str(sum))\n \nelse:\n print(-1)\n\n', 'n,m= map(int,input().split())\na = list(map(int,input().split()))\n\nhwdsum=0\nk=0\nwhile k<= m-1:\n hwdsum += a[k]\n k+=1\n \nif n-hwdsum>=0:\n print(str(n-hwdsum))\n \nelse:\n print(str(-1))\n\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s049274275', 's908827127', 's252050598'] | [10120.0, 9884.0, 10052.0] | [22.0, 22.0, 27.0] | [185, 164, 187] |
p02706 | u092646083 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = list(map(int, input().split()))\nflag = True\n \nfor i in A:\n N = N - i\n if N < 0:\n flag = False\n break\n \nif flag == True:\nprint(N)\nelse:\nprint(-1)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nflag = True\n\nfor i in A:\nN = N - i\nif N < 0:\nflag = False\nbreak\n\nif flag == True:\nprint(N)\nelse:\nprint(-1)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nflag = True\n \nfor i in A:\nN = N - i\nif N < 0:\nflag = False\nbreak\n \nif flag == True:\n print(N)\nelse:\n print(-1)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nflag = True\n \nfor i in A:\n N = N - i\n if N < 0:\n flag = False\n break\n \nif flag == True:\n print(N)\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s166099639', 's644077402', 's747254796', 's069418670'] | [8976.0, 8960.0, 9028.0, 10064.0] | [20.0, 20.0, 23.0, 24.0] | [190, 176, 182, 194] |
p02706 | u100994727 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['def resolve():\n a,b = map(int, input().split())\n A = list(map(int, input().split()))\n count = 0\n\n for c in range(b):\n count += A[c]\n \n print(a - count)\n \n resolve()', 'def resolve():\n a,b = map(int, input().split())\n A = list(map(int, input().split()))\n count = 0\n\n for c in range(b):\n count += A[c]\n \n result = a - count\n if result < 0:\n print("-1")\n else:\n print(result)\n \nresolve()'] | ['Runtime Error', 'Accepted'] | ['s413297644', 's824779075'] | [8936.0, 9876.0] | [24.0, 25.0] | [192, 264] |
p02706 | u101350975 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = list(map(int, input(),split()))\nsum = sum(A)\nif sum > N:\n ans = -1\nelse:\n ans = N - sum\nprint(ans)\n', 'N, M = map(int, input().split())\nA = list(map(int, input(),split()))\nsum = sum(A)\nif sum > N:\n ans = -1\nelse:\n ans = N - sum\nprint(ans)\n', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nsum = sum(A)\nif sum > N:\n ans = -1\nelse:\n ans = N - sum\nprint(ans)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s326276439', 's586737374', 's585884600'] | [9280.0, 9164.0, 10064.0] | [22.0, 23.0, 21.0] | [142, 142, 142] |
p02706 | u106816675 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = [int(x) for x in input().split()]\nsumA = 0\n\nfor i in A:\n sumA = sumA + A[i]\n\nif sumA > N:\n print(-1)\nelse:\n print(N-sumA)\n', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nsumA = 0\ncnt = 0\n\nfor i in A:\n sumA = sumA + A[cnt]\n cnt = cnt +1\n\nif sumA > N:\n print(-1)\nelse:\n print(N-sumA)\n'] | ['Runtime Error', 'Accepted'] | ['s298287696', 's724912529'] | [9888.0, 10060.0] | [26.0, 24.0] | [168, 193] |
p02706 | u106954338 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N = int(input())\nM = int(input())\nA = list(map(int(input().split)))\na = sum(A)\nif V >= 0:\n print(a)\nelse:\n print(-1)\n \n \n', 'N, M = map(int, input().sprit())\nA = list(map(int, input().split()))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n', 'N,M = map(int, input().sprit())\nA = list(map(int, input().split()))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n', 'N = int(input())\nM = int(input())\nA = list(map(int, input().split()))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n', 'N = int(input())\nM = int(input())\nA = list(map(int, input().split()))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n', 'N = int(input())\nM = int(input())\nA = list(map(int(input().split)))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n', 'N = int(input())\nM = int(input())\nA = list(map(int(input().split)))\na = sum(A)\nif N - a >= 0:\n print(N-a)\nelse:\n print(-1)\n \n \n', 'N = int(input())\nM = int(input())\nb = -1\nwhile M != 0:\n M = M -1\n A = int(input())\n V = N - A\n\nif V >= 0:\n print(V)\nelse:\n print(b)\n \n \n', 'N,M = map(int, input().split())\nA = list(map(int, input().split()))\na = sum(A)\nans = N -a\nif ans >= 0:\n print(ans)\nelse:\n print(-1)\n \n \n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s070655989', 's200414197', 's332233703', 's364227313', 's617645110', 's742254395', 's900551803', 's909424513', 's560474735'] | [9204.0, 9092.0, 9068.0, 9152.0, 9100.0, 9080.0, 9180.0, 9188.0, 10000.0] | [26.0, 20.0, 25.0, 24.0, 22.0, 22.0, 21.0, 24.0, 22.0] | [137, 153, 152, 154, 154, 153, 143, 161, 152] |
p02706 | u108375911 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['a = int(input())\nb = int(input())\nc = list(map(int,input().split()))\nd = sum(c)\n\nif (a-d) < 0:\n print(-1)\nelse:\n print(a-d)\n\n\n\n \n', "r = list(map(int,input().split()))\na = r[0]\nb = r[1]\nc = r[2:]\n\n\n\n\nwhile b > 0:\n a -= c[b]\n b -= 1\n \n if a < 0:\n print('-1')\n \n print(a)\n\n", 'a,b = (map(int,input().split()))\nc = list(map(int,input().split()))\nd = sum(c)\n\nif (a-d) < 0:\n print(-1)\nelse:\n print(a-d)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s768994702', 's972036782', 's314471874'] | [9172.0, 9124.0, 10180.0] | [20.0, 22.0, 24.0] | [138, 163, 128] |
p02706 | u115110170 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\nls = list(map(int,input().split()))\nfor a in range(ls):\n n -= a\nprint(max(-1,n))', 'n,m = map(int,input().split())\nls = list(map(int,input().split()))\nfor a in ls:\n n -= a\nprint(max(-1,n))\n'] | ['Runtime Error', 'Accepted'] | ['s447567032', 's289918052'] | [9884.0, 9992.0] | [24.0, 24.0] | [112, 106] |
p02706 | u116118064 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m=int(input.split())\ns=0\nfor i in input.split():\n s=s+i\nif s>n:\n print("-1")\nelse:\n print(n-s)\n\n', 'n,m=map(int, input().split())\ns=0\nfor i in input().split():\n s=s+int(i)\nif s>n:\n print("-1")\nelse:\n print(n-s)'] | ['Runtime Error', 'Accepted'] | ['s479004679', 's868472122'] | [9020.0, 9660.0] | [22.0, 24.0] | [101, 119] |
p02706 | u123872895 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = list(map(int, input().split()))\na = list(map(int, input().split()))\n\nprint(max(n - sum(a), -1)', 'n,m = list(map(int, input().split()))\na = list(map(int, input().split()))\n \nprint(max(n - sum(a), -1))'] | ['Runtime Error', 'Accepted'] | ['s543341124', 's581603616'] | [9036.0, 10120.0] | [25.0, 25.0] | [101, 102] |
p02706 | u127285813 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = list(map(int, input().split())\n \nprint(max(-1, N-sum(A)))', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint(max(-1, N-sum(A)))'] | ['Runtime Error', 'Accepted'] | ['s742818043', 's863211956'] | [8992.0, 10040.0] | [22.0, 22.0] | [102, 94] |
p02706 | u127288756 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M=map(int,input().split())\nA=map(int,input().split())\n\nif N < sum(A):\n print(-1)\nelse:\n print(N - sum(A))\n \n', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\n\nif N < sum(A):\n print(-1)\nelse:\n print(N - sum(A))'] | ['Wrong Answer', 'Accepted'] | ['s851376133', 's465515039'] | [9528.0, 9880.0] | [22.0, 24.0] | [113, 123] |
p02706 | u138045722 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['import numpy as np\n\nA=list(input().split())\n\nprint(A, A[0], int(A[0]))\n\nN=int(A[0])\nM=int(A[1])\n\nB=list(input().split())\n\nk=0\n\nfor i in range(len(B)):\n k+=int(B[i])\n\nprint(N-k if N-k>=0 else -1)\n', 'import numpy as np\n\nA=list(input().split())\n\n\nN=int(A[0])\nM=int(A[1])\n\nB=list(input().split())\n\nk=0\n\nfor i in range(len(B)):\n k+=int(B[i])\n\nprint(N-k if N-k>=0 else -1)'] | ['Wrong Answer', 'Accepted'] | ['s534622454', 's744872416'] | [27516.0, 27448.0] | [106.0, 105.0] | [198, 171] |
p02706 | u148183225 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int,input().split())\nA = list(map(int,input().split()))\nif sum(A) > N:\n print("-1")\nelse:\n print(M - sum(A))', 'N,M = map(int,input().split())\nA = list(map(int,input().split()))\nif sum(A) > N:\n print("-1")\nelse:\n print(N - sum(A))'] | ['Wrong Answer', 'Accepted'] | ['s135324287', 's269800519'] | [10056.0, 10056.0] | [21.0, 21.0] | [120, 120] |
p02706 | u157020659 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['import math\nr = int(input())\nprint(2 * r * math.pi)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\nans = n - sum(a) if n - sum(a) >= 0 else -1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s291420604', 's771035112'] | [9176.0, 9880.0] | [20.0, 23.0] | [51, 123] |
p02706 | u158126367 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n = int(input())\nm = int(input())\nli = list(map(int,input().split()))\nif n - sum(li) >= 0:\n print(n - sum(li))\nelse:\n print(-1)', 'n = int(input())\nm = int(input())\nli = list(map(int,input().split()))\nif n - sum(li) >= 0:\n print(n - sum(li))\nelse:\n print(-1)', 'n,m = map(int,input().split())\nli = list(map(int,input().split()))\nif n - sum(li) >= 0:\n print(n - sum(li))\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s808177576', 's851305575', 's482525184'] | [9188.0, 9188.0, 9928.0] | [25.0, 21.0, 25.0] | [133, 133, 130] |
p02706 | u163725566 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['import math\nfrom sys import *\ninp=stdin.readline\n\nzip=zip \ndef linp(x):\n return list(map(int,x.split()))\ndef minp(x):\n return map(int,x.split())\n\nn,m=minp(inp())\na=linp(inp())\nprint(sum(a)-n)\n \n\n\n\n\n ', 'import math\nfrom sys import *\ninp=stdin.readline\n\nzip=zip \ndef linp(x):\n return list(map(int,x.split()))\ndef minp(x):\n return map(int,x.split())\n\nn,m=minp(inp())\na=linp(inp())\nan=sum(a)-n\nif an>=0:\n print(an)\nelse:\n print("-1")\n \n\n\n\n\n ', 'import math\nfrom sys import *\ninp=stdin.readline\n\nzip=zip \ndef linp(x):\n return list(map(int,x.split()))\ndef minp(x):\n return map(int,x.split())\n\nn,m=minp(inp())\na=linp(inp())\nan=n-sum(a)\nif an>=0:\n print(an)\nelse:\n print("-1")\n \n\n\n\n\n '] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s401529876', 's704685881', 's568136130'] | [9912.0, 9880.0, 10068.0] | [22.0, 22.0, 22.0] | [211, 253, 253] |
p02706 | u165114979 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['a, n = input().split()\na = int(a)\nn = int(n)\np = list(map(int, input().split()))\n\nc = 0\nfor i in range n:\n c += p[i]\n \nif c > a:\n print(-1)\nelse:\n print(a-c)\n', 'a, n = input().split()\na = int(a)\nn = int(n)\np = list(map(int, input().split()))\n\nc = 0\nfor i in range(n):\n c += p[i]\n \nif c > a:\n print(-1)\nelse:\n print(a-c)\n\n'] | ['Runtime Error', 'Accepted'] | ['s249801177', 's167740548'] | [8892.0, 10116.0] | [26.0, 33.0] | [162, 164] |
p02706 | u172214030 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['human_num = int(input())\n\nnyu = list(map(int, input().split(" ")))\n\nfor i in range(human_num):\n print(nyu.count(i + 1))', 'day_num, homework_num = map(int, input().split(" "))\n\nrequ_day = list(map(int, input().split()))\nsum_day = 0\n\nfor day in requ_day:\n sum_day += day\n \nactiv_day = day_num - sum_day\n\nif activ_day >= 0:\n print(activ_day)\nelse:\n print(-1)\n '] | ['Runtime Error', 'Accepted'] | ['s613719513', 's147743901'] | [9172.0, 10168.0] | [20.0, 23.0] | [122, 240] |
p02706 | u178439102 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\nasoberuhi = N - sum(A)\nif asoberuhi < 0:\n print(asoberuhi)\nelse:\n print(-1)', 'N, M = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nasoberuhi = N - sum(A)\nif asoberuhi >= 0:\n print(asoberuhi)\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s875375224', 's117024151'] | [9876.0, 9960.0] | [24.0, 21.0] | [156, 158] |
p02706 | u180528413 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n,m=map(int, input().split(' '))\na = list(map(int, input().split()))\nres = n-sum(a)\nprint(res if res >= 0 else -1", "n,m=map(int, input().split(' '))\na = list(map(int, input().split()))\nres = n-sum(a)\nprint(res if res >= 0 else -1)"] | ['Runtime Error', 'Accepted'] | ['s698118103', 's878816410'] | [9032.0, 9864.0] | [19.0, 24.0] | [113, 114] |
p02706 | u181195295 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['a, _ =map(int,input().split())\nli = [x for x in input().split()]\ns = sum(li)\nprint(a-s)', 'a, _ =map(int,input().split())\nli = [int(x) for x in input().split()]\ns = sum(li)\nprint(max(a-s, -1))\n'] | ['Runtime Error', 'Accepted'] | ['s103182787', 's513352796'] | [9592.0, 10044.0] | [21.0, 25.0] | [87, 102] |
p02706 | u184148551 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['\nN, M = map(int, input().split()) \nA = list(map(int, input().split()))\nfor i in range (M)\n\tN = N -A[i]\nif N>=0\n\tprint (N)\nelse\n\tprint (-1)', 'N, M = map(int, input().split()) \nA = list(map(int, input().split()))\nfor i in range (M):\n\tN = N -A[i]\nif N>=0:\n\tprint (N)\nelse:\n\tprint (-1)'] | ['Runtime Error', 'Accepted'] | ['s426230382', 's914940447'] | [8960.0, 9888.0] | [19.0, 23.0] | [138, 140] |
p02706 | u186121428 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["N, M = map(int, input().split())\nA = list(map(int, input().split()))\nans = sum(A) if N > sum(A) else 'No'\nprint(ans)", 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\nans = N - sum(A) if N >= sum(A) else -1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s287049465', 's836644116'] | [9984.0, 9988.0] | [25.0, 21.0] | [116, 119] |
p02706 | u187193817 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n , m = map(int, input().split())\na = list(map(int, input().split()))\nprint(max(n - sum(a)), -1)', 'n , m = map(int, input().split())\na = list(map(int, input().split()))\n\nprint(max(n - sum(a), -1))'] | ['Runtime Error', 'Accepted'] | ['s976889615', 's768088471'] | [10056.0, 10000.0] | [23.0, 21.0] | [96, 97] |
p02706 | u189513668 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\n\nA = 0\nfor i in range(M):\n s = int(input())\n A += s\n\nsub = N - A\n\nif sub >= 0:\n print(sub)\nelse:\n print(-1)', 'N, M = map(int, input().split())\n\nA = list(map(int, input().split()))\n\nsub = N - sum(A)\n\nif sub >= 0:\n print(sub)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s765273068', 's369398460'] | [9172.0, 10028.0] | [23.0, 21.0] | [152, 136] |
p02706 | u189806337 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n,m = map(int,input().split())\na = list(map(int,input().split()))\n\nif N-sum(a) >= 0:\n\tprint(N-sum(a))\nelse:\n\tprint('-1')", "n,m = map(int,input().split())\na = list(map(int,input().split()))\n \nif n-sum(a) >= 0:\n\tprint(n-sum(a))\nelse:\n\tprint('-1')"] | ['Runtime Error', 'Accepted'] | ['s267680170', 's498570455'] | [9880.0, 9876.0] | [22.0, 26.0] | [120, 121] |
p02706 | u195355592 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = input().split()\nN = int(N)\nM = int(M)\n\ntemp = sum(input().split())\n\nif N - temp > -1:\n print(N - temp)\nelse:\n print("-1")', 'N,M = input().split()\nN = int(N)\nM = int(M)\n\ntemp = sum(list(map(int,input().split())))\n\nif N - temp > -1:\n print(N - temp)\nelse:\n print("-1")\n'] | ['Runtime Error', 'Accepted'] | ['s665646801', 's457260016'] | [9664.0, 10060.0] | [22.0, 22.0] | [129, 145] |
p02706 | u201993393 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = list(map(int, input().split())\n\nprint(max(N - sum(A), - 1)) \n ', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\n\nprint(max(N - sum(A), -1))'] | ['Runtime Error', 'Accepted'] | ['s257071431', 's084100363'] | [9016.0, 10052.0] | [21.0, 23.0] | [115, 96] |
p02706 | u203471639 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input.split())\na = list(map(int, input.split()))\nfinal = sum(a)\nif n > 0:\n print(n - a)\nelse:\n print(-1)\n ', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\ndaytofinish = sum(A)\nif N-daytofinish < 0:\n print(-1)\nelse:\n print(N-daytofinish)'] | ['Runtime Error', 'Accepted'] | ['s944368181', 's562311445'] | [9096.0, 9860.0] | [24.0, 21.0] | [131, 156] |
p02706 | u205087376 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n,m = map(int,input().split())\na = [map(int,input().split()) for i in range(m)]\nb = sum(a)\nif n-a<0:\n print('-1')\nelse:\n print(int(n-a))", "n,m = map(int,input().split())\ntry:\n a = list(map(int,input().split()))\n b = int(sum(a))\nexcept EOFError:\n pass\nif int(n-b)<0:\n print('-1')\nelse:\n print(int(n-b))"] | ['Runtime Error', 'Accepted'] | ['s018689310', 's650329557'] | [9672.0, 9880.0] | [23.0, 22.0] | [138, 167] |
p02706 | u208309047 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int, input().split())\nA = list(map(int, input().split()))\nsum = 0\n\nfor i in range(M):\n sum += A[i]\n\nprint(sum)\nans = N - sum\nif(ans >= 0):\n print(ans)\nelse:\n print(-1)\n\n', 'N,M = map(int, input().split())\nA = list(map(int, input().split()))\nsum = 0\n\nfor i in range(M):\n sum += A[i]\n\nprint(sum)\nans = N - sum\n\nprint(ans)', 'N,M = map(int, input().split())\nA = list(map(int, input().split()))\nsum = 0\n\nfor i in range(M):\n sum += A[i]\n\n\nans = N - sum\nif(ans >= 0):\n print(ans)\nelse:\n print(-1)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s195738794', 's284499736', 's986484835'] | [9876.0, 9928.0, 9876.0] | [24.0, 24.0, 23.0] | [188, 149, 176] |
p02706 | u218071226 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\nl = sum(map(int, input().split()))\nprint(n-s if s <= n else -1)', 'n, m = map(int, input().split())\ns = sum(map(int, input().split()))\nprint(n-s if s <= n else -1)'] | ['Runtime Error', 'Accepted'] | ['s462729709', 's766156004'] | [9544.0, 9532.0] | [23.0, 22.0] | [96, 96] |
p02706 | u218341628 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['vacationDayCount, homeworkCount = map(int, input().split())\nrequiredDayList = list(map(int, input.split()))\n\nplayableDayCount = vacationDayCount - sum(requiredDayList)\n\nif(playableDayCount >= 0):\n print(playableDayCount)\nelse:\n print(-1)', 'vacationDayCount, homeworkCount = map(int, input().split())\nrequiredDayList = list(map(int, input().split()))\n\nplayableDayCount = vacationDayCount - sum(requiredDayList)\n\nif(playableDayCount >= 0):\n print(playableDayCount)\nelse:\n print(-1)'] | ['Runtime Error', 'Accepted'] | ['s257892023', 's376446236'] | [9180.0, 10052.0] | [26.0, 23.0] | [243, 245] |
p02706 | u221061152 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m=map(int,input().split())\n\nprint( max( -1,sum( list(map(int,input().split() ) ) ) ) )', 'n,m=map(int,input().split())\nA=sum(list(map(int,input().split())))\nprint(max(-1,N-A))', 'n,m=map(int,input().split())\nA=list(map(int,input().split()))\nprint(max(-1,n-sum(A)))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s704052589', 's772995892', 's617932002'] | [9908.0, 9980.0, 9872.0] | [33.0, 30.0, 30.0] | [88, 85, 85] |
p02706 | u221888299 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int, input().split())\nA = list(map(int, input().split()))\nAA = 0\nfor i in range(M):\n AA = AA+A[i]\nprint(AA)\nif N-(AA) >= 0:\n print(N-AA)\nelse:\n print(-1)', 'N,M = map(int, input().split())\nA = list(map(int, input().split()))\nAA = 0\nfor i in range(M):\n AA = AA+A[i]\nif N-(AA) >= 0:\n print(N-AA)\nelse:\n print(-1)'] | ['Wrong Answer', 'Accepted'] | ['s584613425', 's012271141'] | [10124.0, 10064.0] | [24.0, 23.0] | [172, 162] |
p02706 | u231484984 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int, input().split())\nA = map(int, input().split())\nif N >= sum(A):\n print((N)-(sum(A)))\nelse:\n print("-1")\n', 'N,M = map(int, input().split())\nA = map(int, input().split())\nZ = sum(A)\nif (N) >= (Z):\n print((N)-(Z))\nelse:\n print("-1")'] | ['Wrong Answer', 'Accepted'] | ['s379228656', 's583180666'] | [9664.0, 9664.0] | [26.0, 24.0] | [124, 128] |
p02706 | u232860859 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["N, M = [int(s) for s in input().split(' ')]\nA = [int(s) for s in input().split(' ')]\n\ntask_days = sum(A)\n\nif N < task_days:\n return -1\nelse:\n return N - task_days", "N, M = [int(s) for s in input().split(' ')]\nA = [int(s) for s in input().split(' ')]\n\ntask_days = sum(A)\n\nif N < task_days:\n print(-1)\nelse:\n print(N - task_days)"] | ['Runtime Error', 'Accepted'] | ['s883637070', 's344386225'] | [9100.0, 10192.0] | [23.0, 21.0] | [168, 168] |
p02706 | u235066013 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["n,m=[int(i)for i in input()]\nlist=[int(i) for i in input().split()]\na=n-sum(list)\nif a>=0:\n print(a)\nelse:\n print('-1')", "n,m=[int(i)for i in input().split()]\nlist=[int(i) for i in input().split()]\na=n-sum(list)\nif a>=0:\n print(a)\nelse:\n print('-1')"] | ['Runtime Error', 'Accepted'] | ['s274946643', 's763832800'] | [9120.0, 9988.0] | [20.0, 23.0] | [121, 129] |
p02706 | u237634011 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\na = list(map(int, input().split()))\n\nfor i in range(m):\n ans = a[i]\n \nprint(n - ans)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\n \nprint(max(-1, n - sum(a)))\n'] | ['Wrong Answer', 'Accepted'] | ['s903802389', 's162996258'] | [10012.0, 9868.0] | [30.0, 31.0] | [119, 99] |
p02706 | u239528020 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['#!/usr/bin/env python3\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\n\nsum_a = sum(a)\nif sum_a > n:\n print(-1)\nelse:\n print(sum_a-n)\n', '#!/usr/bin/env python3\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\n\nsum_a = sum(a)\nif sum_a > n:\n print(-1)\nelse:\n print(sum_a-n)\n', '#!/usr/bin/env python3\n\nn, m = list(map(int, input().split()))\na = list(map(int, input().split()))\n\nsum_a = sum(a)\nif sum_a > n:\n print(-1)\nelse:\n print(n-sum_a)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s443399534', 's755220543', 's052013691'] | [9892.0, 9880.0, 9892.0] | [24.0, 22.0, 26.0] | [168, 168, 168] |
p02706 | u250664216 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int, input().split())\nan = list(map(int, input().split()))\nsum_a = sum(an)\nif an - sum_a < 0:\n print(-1)\nelse:\n print(an-sum_a)', 'n,m = map(int, input().split())\nan = list(map(int, input().split()))\nsum_a = sum(an)\nif n - sum_a < 0:\n print(-1)\nelse:\n print(n-sum_a)'] | ['Runtime Error', 'Accepted'] | ['s865621677', 's118440307'] | [9872.0, 10184.0] | [23.0, 21.0] | [143, 141] |
p02706 | u252964975 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M=map(int, input().split())\nA=list(map(int, input().split()))\nif sum(A)>=N:\n print(N-sum(A))\nelse:\n print(-1)', 'N,M=map(int, input().split())\nA=list(map(int, input().split()))\nif sum(A)<=N:\n print(N-sum(A))\nelse:\n print(-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s176578588', 's054952924'] | [10056.0, 10044.0] | [23.0, 24.0] | [113, 114] |
p02706 | u255422179 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\na = [int(i) for i in input().split()]\ns = sum(a)\nif(n=>s):\n print(n-s)\nelse:\n print("-1")', 'n,m = map(int,input().split())\na = [int(i) for i in input().split()]\ns = sum(a)\nif(n>=s):\n print(n-s)\nelse:\n print("-1")'] | ['Runtime Error', 'Accepted'] | ['s559579881', 's934664590'] | [8840.0, 10196.0] | [25.0, 23.0] | [122, 122] |
p02706 | u257265865 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N M = map(int,input().split())\nList = list(map(int,input().split()))\nprint(N-sum(List) if N-sum(List) >= 0 else -1)\n', 'N M = map(int,input().split())\nList = [map(int,input().split())]\nprint(N-sum(List) if N-sum(List) >= 0 else -1)', 'N M = map(int,input().split())\nList = list(map(int,input().split()))\nprint(N-sum(List) if N-sum(List) >= 0 else -1)\n', 'N,M= map(int,input().split())\nList = list(map(int,input().split()))\nprint(N-sum(List) if N-sum(List) >= 0 else -1)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s257356182', 's413808461', 's622570313', 's281826180'] | [8948.0, 8944.0, 9012.0, 10016.0] | [22.0, 20.0, 20.0, 22.0] | [116, 111, 116, 114] |
p02706 | u257442624 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['NM = list(map(int, input().split()))\nN, M = NM[0],NM[1]\na = list(map(int, input().split()))\n\nif sum(a)> N:\n print(-1)\nelse:\n print(N - sum(A))', 'NM = list(map(int, input().split())\nN, M = NM[0],NM[1]\na = list(map(int, input().split()))\nx = 0\nfor i in range(M):\n x += a[i]\n\nif x > N:\n print(-1)\nelse:\n print(N - x)', 'NM = list(map(int, input().split()))\nN, M = NM[0],NM[1]\na = list(map(int, input().split()))\nA = sum(a)\nif A> N:\n print(-1)\nelse:\n print(N - A)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s610609302', 's799102741', 's847623846'] | [10044.0, 8924.0, 10048.0] | [22.0, 21.0, 20.0] | [149, 177, 149] |
p02706 | u257695767 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['a = [int(x) for x in input().split() if x != "0"]\n\nif a[0]-(sum(a)-a[0]-a[1]) >= 0 :{\n\tprint(a[0]-(sum(a)-a[0]-a[1]))\n\t}\nelse :{\n\tprint(-1)\n\t}', 'N,M= map(int, input().split())\nA = list(map(int, input().split()))\n\n\nif N-sum(A) >= 0 :{\n\tprint(N-sum(A))\n\t}\nelse :{\n\tprint(-1)\n\t}'] | ['Wrong Answer', 'Accepted'] | ['s697875956', 's282401111'] | [9176.0, 10096.0] | [20.0, 24.0] | [142, 130] |
p02706 | u268314634 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int, input().split())\na= list(map(int, input().split()))\nif sum(a)<=n:\n print("1")\nelse:\n print("-1")', '\nn,m = map(int, input().split())\na= sum(list(map(int, input().split())))\nif n-a>=0:\n print(n-a)\nelse:\n print("-1")\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s546617855', 's373838300'] | [9852.0, 10176.0] | [31.0, 31.0] | [117, 123] |
p02706 | u269778596 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['m,n = int(input())\nli = list(map(int,input().split()))\nif sum(li)>m:\n print(-1)\nelse:\n print(m - sum(li))', 'm,n = list(map(int,input().split()))\nli = list(map(int,input().split()))\nif sum(li)>m:\n print(-1)\nelse:\n print(m - sum(li))\n'] | ['Runtime Error', 'Accepted'] | ['s599089137', 's825497980'] | [9180.0, 9876.0] | [24.0, 23.0] | [107, 126] |
p02706 | u270886147 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N = int(input())\nM = int(input())\n\nA = [input()for i in range(M)]\n\nx = N\n\nfor j in range(M):\n x = x - int(A[j])\n j += 1\n\nif x < 0 :\n print(-1)\n\nelse :\n print(x)\n', 'N,M = (input().strip().split())\n\n\nA = list(map(int,input().strip().split()))\n\nx = int(N)\n\nfor j in range(int(M)):\n x = x - int(A[j])\n j += 1\n\nif x < 0 :\n print(-1)\n\nelse :\n print(x)\n'] | ['Runtime Error', 'Accepted'] | ['s826625844', 's101628779'] | [9192.0, 10028.0] | [22.0, 21.0] | [186, 207] |
p02706 | u271063202 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\na = [map(int,input().split())]\nprint(max(n-sum(a)),-1)\n', 'n,m = map(int,input().split())\na = list(map(int,input().split()))\nprint(max(n-sum(a),-1))\n'] | ['Runtime Error', 'Accepted'] | ['s842790069', 's693043821'] | [9580.0, 10000.0] | [25.0, 31.0] | [86, 90] |
p02706 | u276686572 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['arr = list(map(int, input().split()))\nais = list(map(int, input().split()))\n\ndays,tasks = arr[0],arr[1]\n\ndef main(days, ais):\n sum = 0\n for i in ais:\n sum += 0\n if sum > days: return -1\n\n return days - sum\n\nprint(main(days, ais))\n', 'arr = list(map(int, input().split()))\nais = list(map(int, input().split()))\n\ndays,tasks = arr[0],arr[1]\n\ndef main(days, ais):\n sum = 0\n for i in ais:\n sum += i\n if sum > days: return -1\n\n return days - sum\n\nprint(main(days, ais))\n'] | ['Wrong Answer', 'Accepted'] | ['s288938196', 's954746857'] | [9940.0, 9852.0] | [30.0, 33.0] | [239, 239] |
p02706 | u277314812 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = input().split()\na = list(map(int, input().split()))\nprint(max(n-sum(a),-1))', 'n, m = map(int,input().split())\na = list(map(int, input().split()))\nprint(max(n-sum(a),-1))'] | ['Runtime Error', 'Accepted'] | ['s414154136', 's784470616'] | [9984.0, 10064.0] | [25.0, 24.0] | [82, 91] |
p02706 | u277353449 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m=map(int,input().split())\na=list(map(int,input().split()))\nif n-sum(a)<=0:\n print(-1)\nelse print(n-sum(a))', 'n,m=map(int,input().split())\na=list(map(int,input().split()))\nif n-sum(a)<0:\n print(-1)\nelse:\n print(n-sum(a))'] | ['Runtime Error', 'Accepted'] | ['s845870808', 's515819743'] | [9028.0, 10056.0] | [21.0, 22.0] | [110, 116] |
p02706 | u284167015 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N = int(input())\nM = int(input())\n\nA = 0\n\nfor i in range(M):\n A += int(input())\n\nif M < A:\n print(N-A)\n\nelse:\n print(-1)', 'N = int(input())\nM = int(input())\n\nA = 0\n\nfor i in range(M):\n A += int(input())\n\nif M < A:\n print(N-A)\n\nelse:\n print(-1)', 'N = int(input())\n\nA = []\n\nfor i in range(N-1):\n a = int(input())\n A.append(a)\n\nB = []\n\nfor j in range(N-1):\n temp = 0\n for i in A:\n if i-2 == j:\n temp += 1\n B.append(temp) \nfor j in range(N-1):\n print(B[j])', 'N = int(input())\nM = int(input())\n\nA = 0\n\nfor i in range(M):\n A += int(input())\n\nif M < A:\n print(N-A)\n\nelse:\n print(-1)', 'N = int(input())\nM = int(input())\n\nA = 0\n\nfor i in range(M):\n A += int(input())\n\nif M < A:\n print(N-A)\n\nelse:\n print(-1)', 'N = int(input())\nM = int(input())\n\nA = 0\n\nfor i in range(M):\n A += int(input())\n\nif M < A:\n print(N-A)\n\nelse:\n print(-1)', "N, M = map(int, input().split())\n\nA = [int(i) for i in range(M)]\n\nB = sum(A)\n\nif N <= B:\n print(N-B)\n\nelse:\n print('-1')", "N, M = map(int, input().split())\n\nA = [int(i) for i in input().split()]\n\nB = sum(A)\n\nif N >= B:\n print(N-B)\n\nelse:\n print('-1')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s117777530', 's143360512', 's288715981', 's675725520', 's790436885', 's928815309', 's975650508', 's698799648'] | [9112.0, 9188.0, 9216.0, 9180.0, 9176.0, 9180.0, 9452.0, 9876.0] | [24.0, 20.0, 21.0, 25.0, 21.0, 23.0, 24.0, 24.0] | [123, 123, 227, 123, 129, 123, 122, 129] |
p02706 | u290160862 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['import numpy as np\ntmp = np.array(list(map(int, input().split())))\nN = tmp[0]\nM = tmp[1]\nA = np.array(tmp[2:])\nNeeded = np.sum(A)\nif Needed > N:\n print(str(-1))\nelse:\n print(str(N - Needed))', 'import numpy as np\n\ntmp = np.array(list(map(int, input().split())))\nN = tmp[0]\nA = tmp[2:]\n\nNeeded = np.sum(A)\n\nif Needed > N:\n print(-1)\nelse:\n print(N - Needed)', 'import numpy as np\n\nN = int(input())\nM = int(input())\nA = np.array(list(map(int, input().split())))\nNeeded = np.sum(A)\nif Needed > N:\n print(-1)\nelse:\n print(N - Needed)', 'import numpy as np\n\nN = int(input().split()[0])\nA = np.array(list(map(int, input().split())))\nNeeded = np.sum(A)\nif Needed > N:\n print(-1)\nelse:\n print(N - Needed)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s331530204', 's624115371', 's859185576', 's557100075'] | [27200.0, 27192.0, 27120.0, 27940.0] | [106.0, 106.0, 103.0, 101.0] | [196, 168, 175, 169] |
p02706 | u295585689 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = input().split()\na = [i for i in input.split()]\nif sum(a)>n:\n print(-1)\nelse:\n print(m-sum(a))', 'n,m = (int(x) for x in input().split())\na = [int(i) for i in input().split()]\nif sum(a)>n:\n print(-1)\nelse:\n print(n-sum(a))'] | ['Runtime Error', 'Accepted'] | ['s015092607', 's445657270'] | [9048.0, 9888.0] | [19.0, 24.0] | [105, 130] |
p02706 | u296989351 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\na = list(map(int,iuput().split()))\nx = n - sum(a)\nif x >= 0:\n print(x)\nelse:\n print("-1")', 'n,m = map(int,input().split())\na = list(map(int,iuput().split()))\na_sum = sum(a)\nx = n - a_sum\nif x >= 0:\n print(x)\nelse:\n print(-1)', 'n,m = map(int,input().split())\na = list(map(int,iuput().split()))\nx = n - sum(a)\nif x >= 0:\n print(x)\nelse:\n print(-1)', 'n, m= map(int, input().split())\n\nc = list(map(int,input().split()))\nc_sum = sum(c)\n\nday_count = n-c_sum\n\nif day_count>=0:\n print(day_count)\nelse:\n print(-1)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s138532932', 's450063366', 's466449073', 's742738527'] | [9116.0, 9168.0, 9148.0, 10004.0] | [23.0, 21.0, 23.0, 23.0] | [126, 138, 124, 159] |
p02706 | u302292660 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['m,n = map(int,input().split())\nl = list(map(int,input().split()))\nfor i in range(n):\n s += l[i]\nprint(max(m-s,-1))', 'm,n = map(int,input().split())\nl = list(map(int,input().split()))\ns = 0\nfor i in range(n):\n s += l[i]\nprint(max(m-s,-1))'] | ['Runtime Error', 'Accepted'] | ['s363302898', 's406276484'] | [10060.0, 10192.0] | [24.0, 23.0] | [115, 121] |
p02706 | u303739137 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\naa = list(map(int, input().split()))\nprint(min(-1,n - sum(aa)))', 'n, m = map(int, input().split())\naa = list(map(int, input().split()))\nprint(max(-1,n - sum(aa)))'] | ['Wrong Answer', 'Accepted'] | ['s104478361', 's438905300'] | [10012.0, 9880.0] | [23.0, 22.0] | [96, 96] |
p02706 | u305892818 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N = input()\nM = input()\nsumA = 0\nfor i in range(int(M)):\n sumA += int(input())\nplayday = int(N)-sumA\nif playday >= 0:\n print(playday)\nelse:\n print(-1)', 'N = int(input())\nM = int(input())\nfor i in range(M):\n N = N - int(input())\nif N >= 0:\n print(N)\nelse:\n print(-1)', 'N = int(input())\nM = int(input())\nfor i in range(M):\n N = N - int(input())\nif N >= 0:\n print(N)\nelse:\n print(-1)', "N = input()\nA = input()\nM = [int(x) for x in N.split(' ')]\nB = [int(x) for x in A.split(' ')]\nfor i in range(M[1]):\n M[0] = M[0] - B[i]\nif M[0] >= 0:\n print(M[0])\nelse:\n print(-1)"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s008760037', 's153814894', 's450159817', 's766558076'] | [9200.0, 9120.0, 9108.0, 9820.0] | [25.0, 23.0, 23.0, 26.0] | [159, 122, 122, 189] |
p02706 | u306033313 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\nlis = list(map(int, input().split()))\n\nprint(lis)\nans = n\nfor i in range(m):\n ans -= lis[i]\nif ans >= 0:\n print(ans)\nelse:\n print("-1")', 'n, m = map(int, input().split())\nlis = list(map(int, input().split()))\n\n\nans = n\nfor i in range(m):\n ans -= lis[i]\nif ans >= 0:\n print(ans)\nelse:\n print("-1")'] | ['Wrong Answer', 'Accepted'] | ['s184969364', 's058811601'] | [10116.0, 9876.0] | [25.0, 25.0] | [177, 167] |
p02706 | u306260540 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input.split())\na = list(map(int, input.split()))\nsum = 0\nfor i in a:\n sum += i\nif n >= sum:\n print(n - sum)\nelse:\n print(-1)', 'n, m = map(int, input().split())\na = list(map(int, input().split()))\nsum = 0\nfor i in a:\n sum += i\nif n >= sum:\n print(n - sum)\nelse:\n print(-1)\n'] | ['Runtime Error', 'Accepted'] | ['s961273839', 's734819441'] | [9108.0, 9988.0] | [20.0, 21.0] | [149, 154] |
p02706 | u307622233 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n, m = map(int, input().split())\na = list(i for i in input().suplt)\n\nall_homework_day = sum(a)\n\nif all_homework_day <= n:\n play_day = all_homework_day\nelse:\n play_day = -1\n\nprint(play_day)', 'n, m = map(int, input().split())\na = list(int(i) for i in input().split())\n\nall_homework_day = sum(a)\n\nif all_homework_day <= n:\n play_day = n - all_homework_day\nelse:\n play_day = -1\n\nprint(play_day)\n'] | ['Runtime Error', 'Accepted'] | ['s478975380', 's492239292'] | [9196.0, 10044.0] | [22.0, 21.0] | [194, 206] |
p02706 | u309120194 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split()) \nA = [int(input()) for _ in range(M)]\n\ns = sum(A)\nans = -1\nif N >= s: ans = N - s\nprint(ans)', 'N, M = map(int, input().spit())\nA = [input() for _ in range(M)]\n\ns = sum(A)\nans = -1\nif N >= s: ans = N - s\nprint(ans)', 'N, M = map(int, input().split()) \nA = list(map(int, input().split()))\n \n\ns = sum(A)\nans = -1\nif N >= s: ans = N - s\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s032427931', 's561127222', 's478567594'] | [9156.0, 9036.0, 9856.0] | [24.0, 25.0, 32.0] | [125, 118, 160] |
p02706 | u310937700 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N,M = map(int, input().split())\nlist = list(map(int, input().split()))\n\ni=0\nsum=0\n\nwhile i<=M:\n sum=sum+list[i]\n i=i+1\n \nif sum>N:\n print("-1")\n \nelse:\n print(sum-N)', 'N,M = map(int, input().split())\nlist_1 = list(map(int, input().split()))\n \ni=0\nsum=0\n \nwhile i<=M:\n sum=sum+list_1[i]\n i=i+1\n \nif sum>N:\n print("-1")\n \nelse:\n print(sum-N)', 'N,M = map(int, input().split())\nlist_1 = list(map(int, input().split()))\n \ni=0\nsum=0\n \nwhile i<M:\n sum=sum+list_1[i]\n i=i+1\n \nif sum>N:\n print("-1")\n \nelse:\n print(abs(sum-N))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s434361134', 's771090303', 's247526196'] | [10056.0, 10192.0, 10000.0] | [23.0, 26.0, 21.0] | [171, 177, 181] |
p02706 | u312078744 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ["N, M = map(int, input().split())\n\nheight = [input() for i in range(M)]\nsum = N - sum(height)\n\nif (sum >= 0):\n print(sum)\nelse:\n print('-1')\n", "import numpy as np\nN, M = map(int, input().split())\ndata = np.array(input().split(), dtype=np.int64)\n\n#height = [int(input()) for _ in range(M)]\nsum = N - np.sum(data)\n\nif (sum >= 0):\n print(sum)\nelse:\n print('-1')\n"] | ['Runtime Error', 'Accepted'] | ['s108019328', 's093685063'] | [9156.0, 27784.0] | [20.0, 110.0] | [146, 221] |
p02706 | u314050667 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['N, M = map(int, input().split())\nA = np.array(list(map(int, input().split())))\ntot = np.sum(A)\n\nif tot > N:\n\tprint(-1)\nelse:\n\tprint(N-tot)', 'import numpy as np\nimport sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\nN, M = map(int, input().split())\nA = np.array(list(map(int, input().split())))\ntot = np.sum(A)\n\nif tot > N:\n\tprint(-1)\nelse:\n\tprint(N-tot)'] | ['Runtime Error', 'Accepted'] | ['s197644375', 's440744817'] | [9180.0, 27780.0] | [22.0, 105.0] | [138, 253] |
p02706 | u316649390 | 2,000 | 1,048,576 | Takahashi has N days of summer vacation. His teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment. He cannot do multiple assignments on the same day, or hang out on a day he does an assignment. What is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation? If Takahashi cannot finish all the assignments during the vacation, print `-1` instead. | ['n,m = map(int,input().split())\nA = list(map(int,input(),split()))\na = int(sum(A))\n \nif n >= a:\n print(n-a)\nelse:\n print(-1)', 'n,m = map(int,input().split())\nA = list(map(int,input(),split()))\na = sum(A)\n\nif n>=a:\n print(n-a)\nelse:\n print(-1)', 'N, M = map(int, input().split())\nA = list(map(int, input().split()))\na = sum(A)\n\nif N>=a:\n print(N-a)\nelse:\n print(-1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s275666611', 's759129242', 's829817418'] | [9208.0, 9276.0, 9888.0] | [22.0, 23.0, 24.0] | [125, 117, 120] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.