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
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken line that would go along the grid lines and that ...
instruction
0
37,799
23
75,598
Tags: implementation, math Correct Solution: ``` """ Square must be far enough from the center to allow for a line that wouldn't touch it 4 rows in the middle are touched: 2 in the center are fully touched 2 on the edges are touched only except for the first and last cells """ def solution(double_n, x, y): n = ...
output
1
37,799
23
75,599
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken line that would go along the grid lines and that ...
instruction
0
37,800
23
75,600
Tags: implementation, math Correct Solution: ``` n, x, y = [int(i) for i in input().split()] n = n//2 if (x==n or x==n+1) and (y==n or y==n+1): print('NO') else: print('YES') ```
output
1
37,800
23
75,601
Provide tags and a correct Python 3 solution for this coding contest problem. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken line that would go along the grid lines and that ...
instruction
0
37,801
23
75,602
Tags: implementation, math Correct Solution: ``` k=input().split(" ") n=int(k[0]) x=int(k[1]) y=int(k[2]) n/=2 if (x==n or x==n+1)and(y==n or y==n+1): print("NO") else: print("YES") ```
output
1
37,801
23
75,603
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,802
23
75,604
Yes
output
1
37,802
23
75,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,803
23
75,606
Yes
output
1
37,803
23
75,607
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,804
23
75,608
Yes
output
1
37,804
23
75,609
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,805
23
75,610
Yes
output
1
37,805
23
75,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,806
23
75,612
No
output
1
37,806
23
75,613
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,807
23
75,614
No
output
1
37,807
23
75,615
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,808
23
75,616
No
output
1
37,808
23
75,617
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Petya loves playing with squares. Mum bought him a square 2n Γ— 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken li...
instruction
0
37,809
23
75,618
No
output
1
37,809
23
75,619
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two integers n and k. You need to construct k regular polygons having same [circumcircle](https://en.wikipedia.org/wiki/Circumscribed_circle), with distinct number of sides l betw...
instruction
0
37,821
23
75,642
No
output
1
37,821
23
75,643
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,901
23
75,802
Yes
output
1
37,901
23
75,803
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,902
23
75,804
Yes
output
1
37,902
23
75,805
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,903
23
75,806
Yes
output
1
37,903
23
75,807
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,904
23
75,808
Yes
output
1
37,904
23
75,809
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,905
23
75,810
No
output
1
37,905
23
75,811
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,906
23
75,812
No
output
1
37,906
23
75,813
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,907
23
75,814
No
output
1
37,907
23
75,815
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given three multisets of pairs of colored sticks: * R pairs of red sticks, the first pair has length r_1, the second pair has length r_2, ..., the R-th pair has length r_R; * G pa...
instruction
0
37,908
23
75,816
No
output
1
37,908
23
75,817
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,959
23
75,918
Tags: brute force, math Correct Solution: ``` import sys import math #import random #sys.setrecursionlimit(10000000) input = sys.stdin.readline ############ ---- USER DEFINED INPUT FUNCTIONS ---- ############ def inp(): return(int(input())) def inara(): return(list(map(int,input().split()))) def insr(): s...
output
1
37,959
23
75,919
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,960
23
75,920
Tags: brute force, math Correct Solution: ``` import sys input = sys.stdin.readline w, h = map(int, input().split()) maxW = w//2 maxH = h//2 ans = 0 for i in range(1, maxW+1): for j in range(1, maxH+1): ans += (w-(i*2)+1)*(h-(j*2)+1) print(ans) ```
output
1
37,960
23
75,921
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,961
23
75,922
Tags: brute force, math Correct Solution: ``` x, y = map(int, input().split()) x = x**2 y = y**2 ans = (x//4)*(y//4) print(ans) ```
output
1
37,961
23
75,923
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,962
23
75,924
Tags: brute force, math Correct Solution: ``` try: import math w,h=list(map(int,input().split(" "))) s1=0 s2=0 for i in range(2,w+1,2): s1+=w-i+1 for i in range(2,h+1,2): s2+=h-i+1 print(s1*s2) except: pass ```
output
1
37,962
23
75,925
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,963
23
75,926
Tags: brute force, math Correct Solution: ``` data = [int(i) for i in input().split()] w = data[0] h = data[1] if w < 2 or h < 2: print(0) else: res = 0 for i in range(2, w + 1, 2): for j in range(2, h + 1, 2): res = res + (w - i + 1) * (h - j + 1) print(res) ```
output
1
37,963
23
75,927
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,964
23
75,928
Tags: brute force, math Correct Solution: ``` #!/usr/bin/env python3 w, h = map(int, input().split()) w_edge = h_edge = 0 for i in range(2, w + 1, 2): w_edge += (w - i + 1) for i in range(2, h + 1, 2): h_edge += (h - i + 1) print(w_edge * h_edge) ```
output
1
37,964
23
75,929
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,965
23
75,930
Tags: brute force, math Correct Solution: ``` w, h = map(int, input().split()) if w < 2 or h < 2: print(0) else: ans = 0 for x in range(2, w + 1, 2): for y in range(2, h + 1, 2): ans += (w + 1 - x) * (h + 1 - y) print(ans) ```
output
1
37,965
23
75,931
Provide tags and a correct Python 3 solution for this coding contest problem. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All vertices of the rhombi are located inside or on ...
instruction
0
37,966
23
75,932
Tags: brute force, math Correct Solution: ``` h, w = map(int, input().split()) x, y = h % 2, w % 2 print(((h + x) * (h - x) * (w + y) * (w - y)) // 16) ```
output
1
37,966
23
75,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,967
23
75,934
Yes
output
1
37,967
23
75,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,968
23
75,936
Yes
output
1
37,968
23
75,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,969
23
75,938
Yes
output
1
37,969
23
75,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,970
23
75,940
Yes
output
1
37,970
23
75,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,971
23
75,942
No
output
1
37,971
23
75,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,972
23
75,944
No
output
1
37,972
23
75,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,973
23
75,946
No
output
1
37,973
23
75,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have two positive integers w and h. Your task is to count the number of rhombi which have the following properties: * Have positive area. * With vertices at integer points. * All v...
instruction
0
37,974
23
75,948
No
output
1
37,974
23
75,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A country called Flatland is an infinite two-dimensional plane. Flatland has n cities, each of them is a point on the plane. Flatland is ruled by king Circle IV. Circle IV has 9 sons. He wants ...
instruction
0
37,991
23
75,982
No
output
1
37,991
23
75,983
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,017
23
76,034
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] def pol(x, y): if y % 2 != 0: return False l, r = 0, y - 1 while l < r: if a[l][x] != a[r][x]: return False l += 1 r -= 1 return True result = 1 for i in ran...
output
1
38,017
23
76,035
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,018
23
76,036
Tags: implementation Correct Solution: ``` mtxSize = list(map(int, input().split())) rows = mtxSize[0] inArray = [] for i in range(rows): inputs = list(map(int, input().split())) inArray.append(inputs) bRows = rows revArray = inArray[::-1] while(rows%2 == 0): if inArray == revArray: rows //= 2 ...
output
1
38,018
23
76,037
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,019
23
76,038
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) a = [] for i in range(n): a.append(list(map(int, input().split()))) while n and n % 2 == 0 and a[:n//2] == a[n-1:n//2-1:-1]: n //= 2 print(n) ```
output
1
38,019
23
76,039
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,020
23
76,040
Tags: implementation Correct Solution: ``` n,m=map(int,input().split()) l=[] for i in range(n):l.append("".join(list(map(str,input().split())))) if n&1:print(n) else: while 1: if l[:n//2]!=l[n//2:n][::-1]:print(n);break n//=2 ```
output
1
38,020
23
76,041
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,021
23
76,042
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) mat = [input() for _ in range(n)] while n > 1 and n % 2 == 0: if mat[:n] != list(reversed(mat[:n])): break n //= 2 if n == 1: if len(set(mat)) > 1: n = 2 break print(n) ```
output
1
38,021
23
76,043
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,022
23
76,044
Tags: implementation Correct Solution: ``` n, m = [int(i) for i in input().split()] a = [input().split() for i in range(n)] while n%2==0: if a[:n//2] == a[n//2:n][::-1]: n //= 2 else: break print(n) ```
output
1
38,022
23
76,045
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,023
23
76,046
Tags: implementation Correct Solution: ``` n, m = map(int, input().split()) mat = [input() for _ in range(n)] ans = n while ans > 1 and ans % 2 == 0: if mat[:ans] == list(reversed(mat[:ans])): ans //= 2 else: break if ans == 1: if len(set(mat)) > 1: ans = 2 break...
output
1
38,023
23
76,047
Provide tags and a correct Python 3 solution for this coding contest problem. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: * the upper half of matrix c (rows with numbe...
instruction
0
38,024
23
76,048
Tags: implementation Correct Solution: ``` import sys import math from collections import defaultdict import itertools MAXNUM = math.inf MINNUM = -1 * math.inf def getInt(): return int(sys.stdin.readline().rstrip()) def getInts(): return map(int, sys.stdin.readline().rstrip().split(" ")) def getString():...
output
1
38,024
23
76,049
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: ...
instruction
0
38,025
23
76,050
Yes
output
1
38,025
23
76,051
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: ...
instruction
0
38,026
23
76,052
Yes
output
1
38,026
23
76,053
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: ...
instruction
0
38,027
23
76,054
Yes
output
1
38,027
23
76,055
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: ...
instruction
0
38,028
23
76,056
Yes
output
1
38,028
23
76,057
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Let's assume that we are given a matrix b of size x Γ— y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x Γ— y matrix c which has the following properties: ...
instruction
0
38,029
23
76,058
No
output
1
38,029
23
76,059