message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Provide tags and a correct Python 3 solution for this coding contest problem. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!). Main feature of services...
instruction
0
57,742
3
115,484
Tags: dfs and similar, graphs Correct Solution: ``` from collections import deque import sys input = sys.stdin.readline n, m, MOD = map(int, input().split()) u = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(m)] graph = [[] for i in range(n)] rev_graph = [[] for i in range(n)...
output
1
57,742
3
115,485
Provide tags and a correct Python 3 solution for this coding contest problem. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client data is really big!). Main feature of services...
instruction
0
57,743
3
115,486
Tags: dfs and similar, graphs Correct Solution: ``` import sys # sys.stind.readline lee datos el doble de # rápido que la funcion por defecto input input = sys.stdin.readline def get_input(): n, m, h = [int(x) for x in input().split(' ')] digraph = [[] for _ in range(n + 1)] transpose = [[] for _ in ra...
output
1
57,743
3
115,487
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client ...
instruction
0
57,744
3
115,488
No
output
1
57,744
3
115,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client ...
instruction
0
57,745
3
115,490
No
output
1
57,745
3
115,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client ...
instruction
0
57,746
3
115,492
No
output
1
57,746
3
115,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. BigData Inc. is a corporation that has n data centers indexed from 1 to n that are located all over the world. These data centers provide storage for client data (you can figure out that client ...
instruction
0
57,747
3
115,494
No
output
1
57,747
3
115,495
Provide a correct Python 3 solution for this coding contest problem. A new type of mobile robot has been developed for environmental earth observation. It moves around on the ground, acquiring and recording various sorts of observational data using high precision sensors. Robots of this type have short range wireless ...
instruction
0
57,934
3
115,868
"Correct Solution: ``` from heapq import heappush, heappop import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): N, T, R = map(int, readline().split()) if N == T == R == 0: return False S = [None]*N TS = [None]*N for i in range(N): s = readline().strip() ...
output
1
57,934
3
115,869
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,040
3
116,080
Tags: bitmasks, brute force, dp Correct Solution: ``` import itertools n = int(input()) turns = [] for i in range(n): turns.append(int(input())) ans = "NO" for config in itertools.product([-1, 1], repeat=n): sum_ = 0 for i in range(n): sum_ += config[i] * turns[i] if sum_ % 360 == 0: ans = 'YES' print(ans) ...
output
1
58,040
3
116,081
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,041
3
116,082
Tags: bitmasks, brute force, dp Correct Solution: ``` def ans(i,a,n,ca): if ca>=360: ca-=360 if ca<=-360: ca+=360 if i==n: if ca==0: return True else: return False else: return ans(i+1,a,n,ca+a[i]) | ans(i+1,a,n,ca-a[i]) n = int(i...
output
1
58,041
3
116,083
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,042
3
116,084
Tags: bitmasks, brute force, dp Correct Solution: ``` n=int(input()) A=[int(input()) for i in range(n)] N=[0] for a in A: l=[] for n in N: l.append((n+a)%360) l.append((n-a)%360) N=list(set(l)) if 0 in N: print("YES") else: print("NO") ```
output
1
58,042
3
116,085
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,043
3
116,086
Tags: bitmasks, brute force, dp Correct Solution: ``` n = int(input()) a, b = [0], [] for i in range(n): z = int(input()) b = [] for k in a: b.append((k + z)%360) b.append((k - z)%360) a = b[:] ##print(a) if 0 in a: print("YES") else: print("NO") ```
output
1
58,043
3
116,087
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,044
3
116,088
Tags: bitmasks, brute force, dp Correct Solution: ``` def rec(ost, s=0): if not ost: if s % 360 == 0: return True return False if rec(ost[1:], s=s + ost[0]): return True return rec(ost[1:], s=s - ost[0]) amount = int(input()) spis = [int(input()) for i in range(amount)...
output
1
58,044
3
116,089
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,045
3
116,090
Tags: bitmasks, brute force, dp Correct Solution: ``` n = int(input()) a = [] for i in range(n): a.append(int(input())) # def check_sum(i, sum): # if i > n-1: # return sum # l = check_sum(i+1, sum-a[i]) # r = check_sum(i+1, sum+a[i]) # if l%360 == 0 or r%360 == 0: # return 0 # else: # return 1 # if ...
output
1
58,045
3
116,091
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,046
3
116,092
Tags: bitmasks, brute force, dp Correct Solution: ``` Values = [] answer = False FutureValues = [] Values.append(0) Angles = [] n = int(input()) for i in range(n): Angles.append(int(input())) for i in range(n): for j in range(len(Values)): a = Values[j] + Angles[i] b = Values[j] - Angles[i] ...
output
1
58,046
3
116,093
Provide tags and a correct Python 3 solution for this coding contest problem. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a point...
instruction
0
58,047
3
116,094
Tags: bitmasks, brute force, dp Correct Solution: ``` import sys def getlarge(n): largest = '' for i in range(n): largest = largest+'1' return int(largest, 2) def f(ang): largest = getlarge(len(ang)) total=[] for index in range(largest+1): binary = bin(index)[2:] if len...
output
1
58,047
3
116,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,048
3
116,096
Yes
output
1
58,048
3
116,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,049
3
116,098
Yes
output
1
58,049
3
116,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,050
3
116,100
Yes
output
1
58,050
3
116,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,051
3
116,102
Yes
output
1
58,051
3
116,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,052
3
116,104
No
output
1
58,052
3
116,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,053
3
116,106
No
output
1
58,053
3
116,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,054
3
116,108
No
output
1
58,054
3
116,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! ...
instruction
0
58,055
3
116,110
No
output
1
58,055
3
116,111
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,104
3
116,208
Tags: implementation Correct Solution: ``` n, k, m, t = map(int, input().split()) for req in range(t): q, i = map(int, input().split()) if q == 1: n += 1 if i <= k: k += 1 else: if i >= k: n = i else: n -= i k -= i print(n,...
output
1
58,104
3
116,209
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,105
3
116,210
Tags: implementation Correct Solution: ``` n, k, m, t = map(int, input().split()) for i in range(t): a, b = map(int, input().split()) if a == 0: if k > b: k = k - b n-=b else: n -= (n-b) else: if k >= b: k+=1 n+=1 ...
output
1
58,105
3
116,211
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,106
3
116,212
Tags: implementation Correct Solution: ``` n,k,m,t = map(int,input().split()) usize = n for i in range(t): a,b = map(int,input().split()) if (a == 0): if (k <= b): usize = b else: usize = usize - b k = k - b else: if (k >= b): k = k + 1 usize = usize + 1 print (usize,k) ```
output
1
58,106
3
116,213
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,107
3
116,214
Tags: implementation Correct Solution: ``` def main(): n,k,m,t = map(int,input().split()) multi = [0]*n multi[k-1] = 1 for i in range(t): op,index = map(int,input().split()) if op == 1: if k >= index: k += 1 multi.insert(index-1,0) else: ...
output
1
58,107
3
116,215
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,108
3
116,216
Tags: implementation Correct Solution: ``` n, k, m, t = map(int, input().split(' ')) # n = nb univ # k = doc pos # m = max nb univ for _ in range(t): op, pos = map(int, input().split(' ')) if op == 1: if k >= pos: k += 1 n += 1 else: if k > pos: n -= pos ...
output
1
58,108
3
116,217
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,109
3
116,218
Tags: implementation Correct Solution: ``` n, k, m, t = [int(i) for i in input().split()] temp = n for j in range(t): x, y = [int(z) for z in input().split()] if x == 0: if y < k: temp, k = temp - y, k - y else: temp = y else: temp += 1 if y <= k: ...
output
1
58,109
3
116,219
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,110
3
116,220
Tags: implementation Correct Solution: ``` # ------------------- fast io -------------------- import os import sys from io import BytesIO, IOBase BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable...
output
1
58,110
3
116,221
Provide tags and a correct Python 3 solution for this coding contest problem. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never...
instruction
0
58,111
3
116,222
Tags: implementation Correct Solution: ``` n , k , m , t = map(int,input().split()) l = [1]*n l[k-1] = "doc" for i in range(t): op , idx = map(int,input().split()) if op == 0: if idx < k: while idx: l.pop(0) idx -= 1 else: idx = len(l) -...
output
1
58,111
3
116,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,112
3
116,224
Yes
output
1
58,112
3
116,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,113
3
116,226
Yes
output
1
58,113
3
116,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,114
3
116,228
Yes
output
1
58,114
3
116,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,115
3
116,230
Yes
output
1
58,115
3
116,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,116
3
116,232
No
output
1
58,116
3
116,233
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,117
3
116,234
No
output
1
58,117
3
116,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,118
3
116,236
No
output
1
58,118
3
116,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, wherea...
instruction
0
58,119
3
116,238
No
output
1
58,119
3
116,239
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,229
3
116,458
Yes
output
1
58,229
3
116,459
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,230
3
116,460
Yes
output
1
58,230
3
116,461
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,231
3
116,462
Yes
output
1
58,231
3
116,463
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,232
3
116,464
Yes
output
1
58,232
3
116,465
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,233
3
116,466
No
output
1
58,233
3
116,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,234
3
116,468
No
output
1
58,234
3
116,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,235
3
116,470
No
output
1
58,235
3
116,471
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n piranhas with sizes a_1, a_2, …, a_n in the aquarium. Piranhas are numbered from left to right in order they live in the aquarium. Scientists of the Berland State University want to...
instruction
0
58,236
3
116,472
No
output
1
58,236
3
116,473
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After reaching your destination, you want to build a new colony on the new planet. Since this planet has many mountains and the colony must be built on a flat surface you decided to flatten the ...
instruction
0
58,261
3
116,522
Yes
output
1
58,261
3
116,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After reaching your destination, you want to build a new colony on the new planet. Since this planet has many mountains and the colony must be built on a flat surface you decided to flatten the ...
instruction
0
58,262
3
116,524
Yes
output
1
58,262
3
116,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. After reaching your destination, you want to build a new colony on the new planet. Since this planet has many mountains and the colony must be built on a flat surface you decided to flatten the ...
instruction
0
58,263
3
116,526
Yes
output
1
58,263
3
116,527