message
stringlengths
2
19.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
322
108k
cluster
float64
15
15
__index_level_0__
int64
644
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,149
15
26,298
Yes
output
1
13,149
15
26,299
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,150
15
26,300
Yes
output
1
13,150
15
26,301
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,151
15
26,302
Yes
output
1
13,151
15
26,303
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,152
15
26,304
No
output
1
13,152
15
26,305
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,153
15
26,306
No
output
1
13,153
15
26,307
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,154
15
26,308
No
output
1
13,154
15
26,309
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i. You will land on a square of your choice, then repeat moving to the adjacent squar...
instruction
0
13,155
15
26,310
No
output
1
13,155
15
26,311
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,427
15
26,854
Tags: sortings Correct Solution: ``` def main(): n, m = map(int, input().split()) l = list(tuple(map(int, input().split())) for _ in range(m)) h = [False for _ in range(n + 1)] v = [False for _ in range(n + 1)] d1 = [False for _ in range(n * 2 + 1)] d2 = [False for _ in range(n * 2 + 1)] for...
output
1
13,427
15
26,855
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,428
15
26,856
Tags: sortings Correct Solution: ``` #Code by Sounak, IIESTS #------------------------------warmup---------------------------- import os import sys import math from io import BytesIO, IOBase from fractions import Fraction import collections from itertools import permutations from collections import defaultdict from co...
output
1
13,428
15
26,857
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,429
15
26,858
Tags: sortings Correct Solution: ``` def main(): n, m = map(int, input().split()) l = list(tuple(map(int, input().split())) for _ in range(m)) h = [False] * (n + 1) v = [False] * (n + 1) d1 = [False] * (n * 2 + 1) d2 = [False] * (n * 2 + 1) for x, y in l: line = h[y] if line:...
output
1
13,429
15
26,859
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,430
15
26,860
Tags: sortings Correct Solution: ``` def main(): n, m = map(int, input().split()) l = list(tuple(map(int, input().split())) for _ in range(m)) h = [False] * (n + 1) v = [False] * (n + 1) d1 = [False] * (n * 2 + 1) d2 = [False] * (n * 2 + 1) for x, y in l: line = h[y] if line:...
output
1
13,430
15
26,861
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,431
15
26,862
Tags: sortings Correct Solution: ``` n,m=list(map(int,input().split())) f=[] maxx=[-999999999]*n minx=[999999999]*n maxy=[-999999999]*n miny=[999999999]*n maxm=[-999999999]*(2*n-1) minm=[999999999]*(2*n-1) maxs=[-999999999]*(2*n-1) mins=[999999999]*(2*n-1) r=[0 for i in range(9)] for i in range(m): y,x=list(map(int...
output
1
13,431
15
26,863
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,432
15
26,864
Tags: sortings Correct Solution: ``` n, m = map(int, input().split()) k = 2 * n + 1 t = [[0] * k for i in range(8)] p, r = [0] * m, [0] * 9 for k in range(m): x, y = map(int, input().split()) a, b = n + y - x, y + x p[k] = (x, y) if t[0][x]: t[0][x], t[4][x] = min(t[0][x], y), max(t[4][x], y) else...
output
1
13,432
15
26,865
Provide tags and a correct Python 3 solution for this coding contest problem. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The queen combines the options given to ...
instruction
0
13,433
15
26,866
Tags: sortings Correct Solution: ``` n,m=list(map(int,input().split())) f=[] maxy=[-999999999]*n#y-1 miny=[999999999]*n#y-1 maxx=[-999999999]*n#x-1 minx=[999999999]*n#x-1 maxm=[-999999999]*(2*n-1)#x-y+n-1 minm=[999999999]*(2*n-1)#x-y+n-1 maxs=[-999999999]*(2*n-1)#x+y-2 mins=[999999999]*(2*n-1)#x+y-2 for i in range(m): ...
output
1
13,433
15
26,867
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its...
instruction
0
13,434
15
26,868
No
output
1
13,434
15
26,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its...
instruction
0
13,435
15
26,870
No
output
1
13,435
15
26,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its...
instruction
0
13,436
15
26,872
No
output
1
13,436
15
26,873
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its...
instruction
0
13,437
15
26,874
No
output
1
13,437
15
26,875
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,532
15
27,064
Tags: dp, math Correct Solution: ``` for i in range(int(input())): n,m,k=map(int,input().split()) print('YES' if n*m-1==k else 'NO') ```
output
1
13,532
15
27,065
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,533
15
27,066
Tags: dp, math Correct Solution: ``` t = int(input()) for i in range(t): n,m,k = map(int,input().split()) cost = n*m-1 if cost==k: print('YES') else: print('NO') ```
output
1
13,533
15
27,067
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,534
15
27,068
Tags: dp, math Correct Solution: ``` t = int(input()) for _ in range(t): n,m,k = map(int, input().split()) c = (m-1) + (m*(n-1)) if c==k: print("YES") else: print("NO") ```
output
1
13,534
15
27,069
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,535
15
27,070
Tags: dp, math Correct Solution: ``` for i in range(int(input())): x, y, d = [int(x) for x in input().split()] if d == x-1 + x * (y - 1): print("Yes") else: print("No") ```
output
1
13,535
15
27,071
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,536
15
27,072
Tags: dp, math Correct Solution: ``` t=int(input()) while(t): t=t-1 n, m, k = map(int, input().split(' ')) i,j = 1, 1 b = True c=0 while(i!=n or j!=m): if b: if j!=m: j=j+1 c+=i b = False if not b: if i!=n: ...
output
1
13,536
15
27,073
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,537
15
27,074
Tags: dp, math Correct Solution: ``` from collections import defaultdict d = defaultdict(lambda: 0) def check(a,b): ans=a ans+=(b*(a+1)) return ans for i in range(int(input())): n,m,k = map(int, input().split()) rx=n-1 ry=m-1 a=check(rx,ry) b=check(ry,rx) if a==k or b==k: pri...
output
1
13,537
15
27,075
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,538
15
27,076
Tags: dp, math Correct Solution: ``` def arrIn(): return list(map(int,input().split())) def mapIn(): return map(int,input().split()) for ii in range(int(input())): n,m,k=mapIn() ans=n-1+n*(m-1) if(ans==k):print("YES") else : print("NO") ```
output
1
13,538
15
27,077
Provide tags and a correct Python 3 solution for this coding contest problem. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are standing at cell (x, y). You can: * move right...
instruction
0
13,539
15
27,078
Tags: dp, math Correct Solution: ``` for i in range(int(input())): x,y,z=map(int,input().split()) if x*y-1==z: print('YES') else: print('NO') ```
output
1
13,539
15
27,079
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,540
15
27,080
Yes
output
1
13,540
15
27,081
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,541
15
27,082
Yes
output
1
13,541
15
27,083
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,542
15
27,084
Yes
output
1
13,542
15
27,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,543
15
27,086
Yes
output
1
13,543
15
27,087
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,544
15
27,088
No
output
1
13,544
15
27,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,545
15
27,090
No
output
1
13,545
15
27,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,546
15
27,092
No
output
1
13,546
15
27,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a n Γ— m grid. You are standing at cell (1, 1) and your goal is to finish at cell (n, m). You can move to the neighboring cells to the right or down. In other words, suppose you are sta...
instruction
0
13,547
15
27,094
No
output
1
13,547
15
27,095
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,583
15
27,166
Tags: dfs and similar, dsu, graphs Correct Solution: ``` import math,sys,bisect,heapq,os from collections import defaultdict,Counter,deque from itertools import groupby,accumulate from functools import lru_cache #sys.setrecursionlimit(200000000) int1 = lambda x: int(x) - 1 def input(): return sys.stdin.readline().rstri...
output
1
13,583
15
27,167
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,584
15
27,168
Tags: dfs and similar, dsu, graphs Correct Solution: ``` n = int(input()) data = list(map(int, input().split())) spans = list(map(int, input().split())) connect = [[False for c in range(n)] for r in range(n)] for p, span in enumerate(spans): for r in [p-span, p+span]: if r >= 0 and r < n: connect[p][r] = c...
output
1
13,584
15
27,169
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,585
15
27,170
Tags: dfs and similar, dsu, graphs Correct Solution: ``` n=int(input()) a=list(map(lambda x:int(x),input().split())) fav=list(map(lambda x:int(x),input().split())) class DisjSet: def __init__(self, n): # Constructor to create and # initialize sets of n items self.rank = [1] * n self....
output
1
13,585
15
27,171
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,586
15
27,172
Tags: dfs and similar, dsu, graphs Correct Solution: ``` n=int(input()) b=list(map(int,input().split())) c=list(map(int,input().split())) d=[[] for i in range(n+1)] for i in range(n): p=(i+1)-c[i] q=(i+1)+c[i] if p<=0 and q<=n: d[i+1].append(q) d[q].append(i+1) elif p > 0 and q > n: ...
output
1
13,586
15
27,173
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,587
15
27,174
Tags: dfs and similar, dsu, graphs Correct Solution: ``` n=int(input()) orden= input().split() fav= input().split() arr=[] for i in range(n): orden[i]=int(orden[i]) fav[i]=int(fav[i]) arr.append(i) def union(el): if arr[el] != el: arr[el] = union(arr[el]) return arr[el] cont=0 for i in f...
output
1
13,587
15
27,175
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,588
15
27,176
Tags: dfs and similar, dsu, graphs Correct Solution: ``` def dsu(nodo): if nueva[nodo] != nodo: nueva[nodo] = dsu(nueva[nodo]) return nueva[nodo] else: return nodo def main(): n = int(input()) permutaciones = list(map(int, input().split())) favoritos = list(map(int, inp...
output
1
13,588
15
27,177
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,589
15
27,178
Tags: dfs and similar, dsu, graphs Correct Solution: ``` arr_size = int( input()) arr_fin = input().split(" ") arr_fin = map(int, arr_fin) cell_fav = input().split(" ") cell_fav = map(int, cell_fav) graph = {} # A este array le voy a aplicar DSU arr_ini = [i for i in range(1,arr_size+1)] for fav, i in zip(cell_f...
output
1
13,589
15
27,179
Provide tags and a correct Python 3 solution for this coding contest problem. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's favourite number. On it's move i-th cell can exch...
instruction
0
13,590
15
27,180
Tags: dfs and similar, dsu, graphs Correct Solution: ``` n, p, d = int(input()), [x - 1 for x in list(map(int, input().split()))], list(map(int, input().split())) g = [[False] * n for _ in range(n)] for i in range(n): g[i][i] = True if i - d[i] >= 0: g[i][i - d[i]] = g[i - d[i]][i] = True if i + d[i] < ...
output
1
13,590
15
27,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,591
15
27,182
Yes
output
1
13,591
15
27,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,592
15
27,184
Yes
output
1
13,592
15
27,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,593
15
27,186
Yes
output
1
13,593
15
27,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,594
15
27,188
Yes
output
1
13,594
15
27,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,595
15
27,190
No
output
1
13,595
15
27,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,596
15
27,192
No
output
1
13,596
15
27,193
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,597
15
27,194
No
output
1
13,597
15
27,195
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. One day n cells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from 1). Also each cell determined it's fa...
instruction
0
13,598
15
27,196
No
output
1
13,598
15
27,197