message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
276
109k
cluster
float64
23
23
__index_level_0__
int64
552
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Gerald got a very curious hexagon for his birthday. The boy found out that all the angles of the hexagon are equal to <image>. Then he measured the length of its sides, and found that each of th...
instruction
0
40,028
23
80,056
No
output
1
40,028
23
80,057
Provide tags and a correct Python 3 solution for this coding contest problem. You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like to compress this image. You want to choose an i...
instruction
0
40,112
23
80,224
Tags: brute force Correct Solution: ``` from sys import stdin as fin def check(x, y): if x < 0 or y < 0: return 0 else: return table2[x][y] n, m = [int(x) for x in fin.readline().split()] table = fin.readlines() fin.close() table2 = [[None]*m for _ in range(n)] table2[0][0] = int(table[0][0]...
output
1
40,112
23
80,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like ...
instruction
0
40,115
23
80,230
No
output
1
40,115
23
80,231
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like ...
instruction
0
40,117
23
80,234
No
output
1
40,117
23
80,235
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like ...
instruction
0
40,118
23
80,236
No
output
1
40,118
23
80,237
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,184
23
80,368
Yes
output
1
40,184
23
80,369
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,185
23
80,370
Yes
output
1
40,185
23
80,371
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,186
23
80,372
Yes
output
1
40,186
23
80,373
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,187
23
80,374
Yes
output
1
40,187
23
80,375
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,188
23
80,376
No
output
1
40,188
23
80,377
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,189
23
80,378
No
output
1
40,189
23
80,379
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,190
23
80,380
No
output
1
40,190
23
80,381
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). Some of the squares contain an object. All the remaining squares are empty. The...
instruction
0
40,191
23
80,382
No
output
1
40,191
23
80,383
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with 2 rows and 3 columns of squares. The color of the square at the i-th row and j-th column is represented by the character C_{ij}. Write a program that prints `YES` if t...
instruction
0
40,291
23
80,582
No
output
1
40,291
23
80,583
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,479
23
80,958
Tags: constructive algorithms Correct Solution: ``` import sys import math from collections import defaultdict,deque n=int(sys.stdin.readline()) arr=[[0 for _ in range(n)] for x in range(n)] count=0 num=0 for i in range(n//2): for j in range(n//2): arr[i][j]=num num+=1 arr[i][j]=arr[i][j]*4+...
output
1
40,479
23
80,959
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,480
23
80,960
Tags: constructive algorithms Correct Solution: ``` import functools import math import sys from collections import defaultdict # input = sys.stdin.readline rt = lambda: map(int, input().split()) ri = lambda: int(input()) rl = lambda: list(map(int, input().split())) def main(): n = ri() pattern = [[0, 4, 8, ...
output
1
40,480
23
80,961
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,481
23
80,962
Tags: constructive algorithms Correct Solution: ``` n = int(input()) x = 0 for q in range(0, n, 4): a = [[], [], [], []] for q1 in range(0, n, 4): for q2 in range(4): for q3 in range(4): a[q2].append(x+q2*4+q3) x += 16 for q1 in a: print(*q1) ```
output
1
40,481
23
80,963
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,482
23
80,964
Tags: constructive algorithms Correct Solution: ``` # Contest: Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) (https://codeforces.com/contest/1208) # Problem: C: Magic Grid (https://codeforces.com/contest/1208/problem/C) def rint(): return int(input()) def rints(): return list(map(int, inpu...
output
1
40,482
23
80,965
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,483
23
80,966
Tags: constructive algorithms Correct Solution: ``` n = int(input()) t = [[0]*n for _ in range(n)] n2 = n//2 c = 0 for i in range(n2): for j in range(n2): t[i][j] = c t[i+n2][j] = c+1 t[i][j+n2] = c+2 t[i+n2][j+n2] = c+3 c += 4 for r in t: print(' '.join((str(v) for v...
output
1
40,483
23
80,967
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,484
23
80,968
Tags: constructive algorithms Correct Solution: ``` from sys import stdin,stdout n=int(stdin.readline().strip()) x=0 y=0 acum=0 mt=[[0 for i in range(n)] for j in range(n)] for i in range((n//4)*(n//4)): for j in range(4): for k in range(4): mt[x+j][y+k]=acum acum+=1 y+=4 if(...
output
1
40,484
23
80,969
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,485
23
80,970
Tags: constructive algorithms Correct Solution: ``` import sys input = lambda: sys.stdin.readline().strip() arr = [] n = int(input()) for i in range(n//4): cur = n*4*i for j in range(4): arr.append([]) for k in range(n): arr[-1].append(cur+j+4*k) for i in arr: for j in i: ...
output
1
40,485
23
80,971
Provide tags and a correct Python 3 solution for this coding contest problem. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly once. * [Bitwise XOR](https://en.wikipedia.org/...
instruction
0
40,486
23
80,972
Tags: constructive algorithms Correct Solution: ``` n = int(input()) ans = [] for i in range(n): ans.append([0 for i in range(n)]) c = 0 for k in range(n//4): for i in range(n): for j in range(4): ans[i][k*4 + j] = c c+=1 for i in ans: print(*i) ```
output
1
40,486
23
80,973
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,487
23
80,974
Yes
output
1
40,487
23
80,975
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,488
23
80,976
Yes
output
1
40,488
23
80,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,489
23
80,978
Yes
output
1
40,489
23
80,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,490
23
80,980
Yes
output
1
40,490
23
80,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,491
23
80,982
No
output
1
40,491
23
80,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,492
23
80,984
No
output
1
40,492
23
80,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,493
23
80,986
No
output
1
40,493
23
80,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let us define a magic grid to be a square matrix of integers of size n × n, satisfying the following conditions. * All integers from 0 to (n^2 - 1) inclusive appear in the matrix exactly onc...
instruction
0
40,494
23
80,988
No
output
1
40,494
23
80,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,519
23
81,038
Yes
output
1
40,519
23
81,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,520
23
81,040
Yes
output
1
40,520
23
81,041
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,521
23
81,042
Yes
output
1
40,521
23
81,043
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,522
23
81,044
Yes
output
1
40,522
23
81,045
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,523
23
81,046
No
output
1
40,523
23
81,047
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,524
23
81,048
No
output
1
40,524
23
81,049
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,525
23
81,050
No
output
1
40,525
23
81,051
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a Young diagram. Given diagram is a histogram with n columns of lengths a_1, a_2, …, a_n (a_1 ≥ a_2 ≥ … ≥ a_n ≥ 1). <image> Young diagram for a=[3,2,2,2,1]. Your goal is to fin...
instruction
0
40,526
23
81,052
No
output
1
40,526
23
81,053
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,796
23
81,592
Tags: geometry, sortings Correct Solution: ``` n=int(input()) X,Y=input().split() X,Y=float(X)+1e-10,float(Y)-1e-10 L=[list(map(float,input().split())) for _ in range(n)] print('NO' if [i for x,i in sorted((k*X+b,i) for i,(k,b) in enumerate(L))] == [i for x,i in sorted((k*Y+b,i) for i,(k,b) in enumerate(L))] else 'YES'...
output
1
40,796
23
81,593
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,797
23
81,594
Tags: geometry, sortings Correct Solution: ``` #!/usr/bin/env python # coding: utf-8 # In[33]: ertekek=[] n=int(input()) x1, x2 = [int(i) for i in input().split()] for i in range(n): k, b = [int(i) for i in input().split()] bal=k*x1+b jobb=k*x2+b ertekek.append([bal,jobb]) ertekek.sort() szamlalo=0 f...
output
1
40,797
23
81,595
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,798
23
81,596
Tags: geometry, sortings Correct Solution: ``` n = int(input()) x1, x2 = map(int, input().split()) ps = [map(int, input().split()) for _ in range(n)] ys = [0] * n for i, (k, b) in enumerate(ps): ys[i] = k * x1 + b, k * x2 + b ys.sort() max_y = -float('inf') ok = False for y1, y2 in ys: if y2 < max_y: ok ...
output
1
40,798
23
81,597
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,799
23
81,598
Tags: geometry, sortings Correct Solution: ``` # Author : nitish420 -------------------------------------------------------------------- import os import sys from io import BytesIO, IOBase # mod=10**9+7 # sys.setrecursionlimit(10**6) # mxm=sys.maxsize # from functools import lru_cache def main(): n=int(input()) ...
output
1
40,799
23
81,599
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,800
23
81,600
Tags: geometry, sortings Correct Solution: ``` n = int(input()) x1, x2 = map(int, input().split()) points = [list(map(int, input().split())) for _ in range(n)] one = list() two = list() # y = 1 * x + 2 # at x = 1, y = 3 # at x = 2, y = 4 for i in range(n): k, b = points[i] one.append((k * (x1 + 1e-10) + b, i))...
output
1
40,800
23
81,601
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,801
23
81,602
Tags: geometry, sortings Correct Solution: ``` n = int(input()) x1, x2 = map(float, input().split()) x1 += 1e-10 x2 -= 1e-10 lines = [tuple(map(float, input().split())) for _ in range(n)] l1 = sorted((k * x1 + b, i) for i, (k, b) in enumerate(lines)) l2 = sorted((k * x2 + b, i) for i, (k, b) in enumerate(lines)) if [i ...
output
1
40,801
23
81,603
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,802
23
81,604
Tags: geometry, sortings Correct Solution: ``` def equation(k, x, b): return k * x + b num = int(input()) ans = [] x1, x2 = map(int, input().split()) for i in range(0,num): k, b = map(int, input().split()) ans.append((equation(k, x1, b), equation(k, x2, b))) ans.sort() for i in range(1, num): ...
output
1
40,802
23
81,605
Provide tags and a correct Python 3 solution for this coding contest problem. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necessary to deter...
instruction
0
40,803
23
81,606
Tags: geometry, sortings Correct Solution: ``` import sys #sys.stdin = open("input.txt") #sys.stdout = open("output.txt", "w") n = int(input()) k = [] b = [] x1, x2 = (int(i) for i in input().split()) for i in range(n): k1, b1 = (int(j) for j in input().split()) k.append(k1) b.append(b1) zn = [(k[i]*x1 + b[i],...
output
1
40,803
23
81,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equ...
instruction
0
40,804
23
81,608
Yes
output
1
40,804
23
81,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equ...
instruction
0
40,805
23
81,610
Yes
output
1
40,805
23
81,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equ...
instruction
0
40,806
23
81,612
Yes
output
1
40,806
23
81,613
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equ...
instruction
0
40,807
23
81,614
Yes
output
1
40,807
23
81,615