message
stringlengths
2
28.7k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
21
109k
cluster
float64
7
7
__index_level_0__
int64
42
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired by this adventure and an accidentally found plas...
instruction
0
42,919
7
85,838
Tags: constructive algorithms, implementation Correct Solution: ``` def main(): s = list(input())*2 ans = 0 k = 1 for i in range(len(s) - 1): if (s[i] == "b" and s[i + 1] == "b") or (s[i] == "w" and s[i + 1] == "w"): ans = max(ans, k) k = 1 else: k += ...
output
1
42,919
7
85,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,920
7
85,840
Yes
output
1
42,920
7
85,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,921
7
85,842
Yes
output
1
42,921
7
85,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,922
7
85,844
Yes
output
1
42,922
7
85,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,923
7
85,846
Yes
output
1
42,923
7
85,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,924
7
85,848
No
output
1
42,924
7
85,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,925
7
85,850
No
output
1
42,925
7
85,851
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,926
7
85,852
No
output
1
42,926
7
85,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras. Inspired b...
instruction
0
42,927
7
85,854
No
output
1
42,927
7
85,855
Provide a correct Python 3 solution for this coding contest problem. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an integer starting from 0. For example, the coordinates of β—Ž i...
instruction
0
43,710
7
87,420
"Correct Solution: ``` import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): L = 10 N = int(readline()) MP = [list(map(int, readline().split())) for i in range(L)] P = [] for i in range(L): for j in range(L): if MP[i][j]: P.append((j, i)) ...
output
1
43,710
7
87,421
Provide a correct Python 3 solution for this coding contest problem. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an integer starting from 0. For example, the coordinates of β—Ž i...
instruction
0
43,711
7
87,422
"Correct Solution: ``` n_drop, cloth = int(input()), [[int(i) for i in input().split()] for _ in range(10)] n_stain = sum(sum(i) for i in cloth) n = (n_stain - 5 * n_drop) // 4 drops_candidate = [] dl = 0 while 2 * dl <= n: dm = n - 2 * dl ds = n_drop - dm - dl if ds >= 0: drops_candidate.append([d...
output
1
43,711
7
87,423
Provide a correct Python 3 solution for this coding contest problem. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an integer starting from 0. For example, the coordinates of β—Ž i...
instruction
0
43,712
7
87,424
"Correct Solution: ``` import itertools dx = (0, 0, 0, 1,-1, 1, 1,-1,-1,-2, 2, 0, 0) dy = (0, 1,-1, 0, 0, 1,-1, 1,-1, 0, 0,-2, 2) dd = (5, 9, 13) def drop(fab, start, used, size_list): for xy in range(start, 100): y = xy%10 x = xy//10 size = size_list[used] for i in range(size): ...
output
1
43,712
7
87,425
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an inte...
instruction
0
43,713
7
87,426
No
output
1
43,713
7
87,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an inte...
instruction
0
43,714
7
87,428
No
output
1
43,714
7
87,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an inte...
instruction
0
43,715
7
87,430
No
output
1
43,715
7
87,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a "cloth" of 10 Γ— 10 squares as shown in Fig. 1, and the squares are indicated by a pair of X-coordinate and Y-coordinate values ​​as shown in (1 and 2). The coordinate value is an inte...
instruction
0
43,716
7
87,432
No
output
1
43,716
7
87,433
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,946
7
87,892
Tags: greedy, math, number theory Correct Solution: ``` import math n = int(input()) for i in range(n): r, b, k = list(map(int, input().split())) g = math.gcd(r, b) r = r // g b = b // g if k > (max(r, b) - 2) // (min(r, b)) + 1: print("OBEY") else: print("REBEL") ```
output
1
43,946
7
87,893
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,947
7
87,894
Tags: greedy, math, number theory Correct Solution: ``` import math n=int(input()) for i in range(n): x,y,k=map(int,input().split()) if(x>y): x,y=y,x p=math.gcd(x,y) z=(y-p)/x if(z<=k-1): print("OBEY") else: print("REBEL") ```
output
1
43,947
7
87,895
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,948
7
87,896
Tags: greedy, math, number theory Correct Solution: ``` from math import gcd a = int(input()) for i in range(a): r, b, t = map(int, input().split()) nok = (r * b) // gcd(r, b) g = gcd(r, b) r, b = min(r, b), max(b, r) if nok == b: if (b - 1)//r >= t: print('REBEL') else:...
output
1
43,948
7
87,897
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,949
7
87,898
Tags: greedy, math, number theory Correct Solution: ``` #Ashish Sagar import math t=int(input()) for _ in range(t): r,b,k=map(int,input().split()) if r>b: r,b=b,r g=math.gcd(r,b) b=b//g r=r//g if (k-1)*r+1<b: print("rebel") else: print("obey") ```
output
1
43,949
7
87,899
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,950
7
87,900
Tags: greedy, math, number theory Correct Solution: ``` import math n = int(input()) for _ in range(n): a, b, k = map(int, input().split()) if a < b: min = a max = b else: min = b max = a if max % min == 0: if max // min - 1 >= k: print('REBEL') else: print('OBEY') elif min == 2: if max //...
output
1
43,950
7
87,901
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,951
7
87,902
Tags: greedy, math, number theory Correct Solution: ``` def euc(a, b): while b != 0: a, b = b, a%b return a for _ in range(int(input())): r, b, k = map(int, input().split()) if r == b: print('OBEY') continue r, b = min(r, b), max(r, b) if b%r == 0: if b//r-1 < k: ...
output
1
43,951
7
87,903
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,952
7
87,904
Tags: greedy, math, number theory Correct Solution: ``` import math t = int(input()) for c in range (t): a,b,k= map(int, input().split()) if(a==b): print('OBEY') continue if(a<b): a,b = b,a x = math.gcd(a,b) step = 1 +int((a-x-1) / b) if(step<k): print('OBEY') ...
output
1
43,952
7
87,905
Provide tags and a correct Python 3 solution for this coding contest problem. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. You must paint a fence which consists of 10^{10...
instruction
0
43,953
7
87,906
Tags: greedy, math, number theory Correct Solution: ``` import math def lcm(c,d): return (d*c//math.gcd(c,d)) for _ in range(int(input())): a,b,k=map(int,input().split()) l=lcm(a,b) p=l//a-1 q=l//b-1 pr=math.ceil(max(p,q)/(min(p,q)+1)) print("OBEY" if pr<k else "REBEL") ```
output
1
43,953
7
87,907
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,954
7
87,908
Yes
output
1
43,954
7
87,909
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,955
7
87,910
Yes
output
1
43,955
7
87,911
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,956
7
87,912
Yes
output
1
43,956
7
87,913
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,957
7
87,914
Yes
output
1
43,957
7
87,915
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,958
7
87,916
No
output
1
43,958
7
87,917
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,959
7
87,918
No
output
1
43,959
7
87,919
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,960
7
87,920
No
output
1
43,960
7
87,921
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor. ...
instruction
0
43,961
7
87,922
No
output
1
43,961
7
87,923
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. Alice and Bob are playing a game. There is nΓ— n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1≀ i, j≀ n. There is an infinite supply of tokens that come in 3 colors labelled...
instruction
0
44,067
7
88,134
Tags: constructive algorithms, games, interactive Correct Solution: ``` from sys import stdin, stdout n = int(stdin.readline()) ones = n**2 // 2 twos = n**2 - ones i1, j1 = 0, 1 i2, j2 = 0, 0 while ones and twos: a = stdin.readline() if a == '1\n' or a == '3\n': stdout.write(f"2 {i2+1} {j2+1}\n") ...
output
1
44,067
7
88,135
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Alice and Bob are playing a game. There is nΓ— n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1≀ i, j≀ n. There is an infinite ...
instruction
0
44,068
7
88,136
No
output
1
44,068
7
88,137
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Alice and Bob are playing a game. There is nΓ— n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1≀ i, j≀ n. There is an infinite ...
instruction
0
44,069
7
88,138
No
output
1
44,069
7
88,139
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Alice and Bob are playing a game. There is nΓ— n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1≀ i, j≀ n. There is an infinite ...
instruction
0
44,070
7
88,140
No
output
1
44,070
7
88,141
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. Alice and Bob are playing a game. There is nΓ— n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1≀ i, j≀ n. There is an infinite ...
instruction
0
44,071
7
88,142
No
output
1
44,071
7
88,143
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,740
7
89,480
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import os import sys if os.path.exists('/mnt/c/Users/Square/square/codeforces'): f = iter(open('E.txt').readlines()) def input(): return next(f) else: input = lambda: sys.stdin.readline().rstrip() from collections i...
output
1
44,740
7
89,481
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,741
7
89,482
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e]...
output
1
44,741
7
89,483
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,742
7
89,484
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` from collections import deque n, m, t = map(int, input().split()) s = [] for _ in range(n): s.append(input()) query = [] for _ in range(t): i, j, p = map(int, input().split()) query.append((i-1, j-1, p)) dist = [[-1]*m for ...
output
1
44,742
7
89,485
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,743
7
89,486
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys input = sys.stdin.readline n, m, t = map(int, input().split()) cell = [list(input().rstrip()) for _ in range(n)] cnt = [[False] * m for _ in range(n)] for i in range(n): for j in range(m): if i - 1 >= 0 and cell...
output
1
44,743
7
89,487
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,744
7
89,488
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` #region bcf # code section by Barry Fam # # pylint: disable= reimported #region mapping2d.py import collections class Mapping2D: """ A convenience class for accessing a 2d array with map-like methods Mapping2D(n: int, m: i...
output
1
44,744
7
89,489
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,745
7
89,490
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys;input=sys.stdin.readline N, M, T = map(int, input().split()) X = [[0]*M for _ in range(N)] S = [] for _ in range(N): s = input().strip() S.append(s) f = False stack = [] for i in range(N): for j in range(M): ...
output
1
44,745
7
89,491
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,746
7
89,492
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys import collections def main(): input=lambda: sys.stdin.readline().rstrip() n,m,t=map(int,input().split()) T=[input() for _ in range(n)] C=[0]*(n*m) d=((1,0),(0,1),(-1,0),(0,-1)) Q=collections.deque() ...
output
1
44,746
7
89,493
Provide tags and a correct Python 3 solution for this coding contest problem. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows and m columns. Each cell is either black or wh...
instruction
0
44,747
7
89,494
Tags: dfs and similar, graphs, implementation, shortest paths Correct Solution: ``` import sys from collections import deque readline = sys.stdin.readline readlines = sys.stdin.readlines ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(m...
output
1
44,747
7
89,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows...
instruction
0
44,748
7
89,496
Yes
output
1
44,748
7
89,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows...
instruction
0
44,749
7
89,498
Yes
output
1
44,749
7
89,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows...
instruction
0
44,750
7
89,500
Yes
output
1
44,750
7
89,501
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows...
instruction
0
44,751
7
89,502
Yes
output
1
44,751
7
89,503
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with n rows...
instruction
0
44,752
7
89,504
No
output
1
44,752
7
89,505