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 a correct Python 3 solution for this coding contest problem. 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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,684
23
137,368
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools # import time,random,resource sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 mod2 = 998244353 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,...
output
1
68,684
23
137,369
Provide a correct Python 3 solution for this coding contest problem. 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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,685
23
137,370
"Correct Solution: ``` import heapq class mcf_graph: def __init__(self, n=0): self._n = n self.g = [[] for _ in range(n)] self.pos = [] def add_edge(self, frm, to, cap, cost): m = len(self.pos) e1 = self._edge(to, cap, cost) e2 = self._edge(frm, 0, -cost) ...
output
1
68,685
23
137,371
Provide a correct Python 3 solution for this coding contest problem. 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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,686
23
137,372
"Correct Solution: ``` import heapq class mcf_graph: def __init__(self, n=0): self._n = n self.g = [[] for _ in range(n)] self.pos = [] def add_edge(self, frm, to, cap, cost): m = len(self.pos) e1 = self._edge(to, cap, cost) e2 = self._edge(frm, 0, -cost) ...
output
1
68,686
23
137,373
Provide a correct Python 3 solution for this coding contest problem. 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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,687
23
137,374
"Correct Solution: ``` import heapq class mcf_graph_int_cost: """ 頂点数、及び、costの総和が、4294967295 (== (1 << 32) - 1) を超えない前提下での高速な実装。 後者は超えても一応動く。 """ def __init__(self, n): self.n = n self.pos = [] self.g = [[] for _ in range(n)] def add_edge(self, from_, to, cap, cost): ...
output
1
68,687
23
137,375
Provide a correct Python 3 solution for this coding contest problem. 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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose some of the squares so that each row and column contains at...
instruction
0
68,688
23
137,376
"Correct Solution: ``` from heapq import heappop, heappush, heapify class MinCostFlow(): def __init__(self, n): self.n = n self.graph = [[] for _ in range(n)] self.pos = [] def add_edge(self, fr, to, cap, cost): assert 0 <= fr < self.n assert 0 <= to < self.n m ...
output
1
68,688
23
137,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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,689
23
137,378
Yes
output
1
68,689
23
137,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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,690
23
137,380
Yes
output
1
68,690
23
137,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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,691
23
137,382
Yes
output
1
68,691
23
137,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 of N rows and M columns. The square at the i-th row and j-th column will be denoted as (i,j). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,692
23
137,384
Yes
output
1
68,692
23
137,385
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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,693
23
137,386
No
output
1
68,693
23
137,387
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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,694
23
137,388
No
output
1
68,694
23
137,389
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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,695
23
137,390
No
output
1
68,695
23
137,391
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). A nonnegative integer A_{i,j} is written for each square (i,j). You choose som...
instruction
0
68,696
23
137,392
No
output
1
68,696
23
137,393
Provide a correct Python 3 solution for this coding contest problem. In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc. The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_...
instruction
0
68,753
23
137,506
"Correct Solution: ``` import sys n=int(input()) lst=[] for i in range(n): x,y,h=map(int,input().split()) lst.append([x,y,h]) for j in range(101): for k in range(101): for i in range(n): H=abs(j-lst[i][0])+abs(k-lst[i][1])+lst[i][2] if H>0: if all(max(H-abs(j-lst[l][0])-abs(k-lst[l][1])...
output
1
68,753
23
137,507
Provide a correct Python 3 solution for this coding contest problem. In the Ancient Kingdom of Snuke, there was a pyramid to strengthen the authority of Takahashi, the president of AtCoder Inc. The pyramid had center coordinates (C_X, C_Y) and height H. The altitude of coordinates (X, Y) is max(H - |X - C_X| - |Y - C_...
instruction
0
68,756
23
137,512
"Correct Solution: ``` n=int(input()) XYH=[] for i in range(n): x,y,h=map(int,input().split()) XYH.append([x,y,h]) XYH.sort(key=lambda x:x[2]) for i in range(101): for j in range(101): peak=abs(i-XYH[-1][0])+abs(j-XYH[-1][1])+XYH[-1][2] flag=1 for k in range(n-1): if max(0,peak-abs(i-XYH[k][0])-...
output
1
68,756
23
137,513
Provide a correct Python 3 solution for this coding contest problem. A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel. Her magic is activated by drawing a magic circle using some magical stones and strings. This m...
instruction
0
68,849
23
137,698
"Correct Solution: ``` from collections import Counter def get_par(x, par_lst): if x == par_lst[x]: return x ret = get_par(par_lst[x], par_lst) par_lst[x] = ret return ret def main(): while True: n, m = map(int, input().split()) if n == 0: break par_lst = [i for i in range(n)] count...
output
1
68,849
23
137,699
Provide a correct Python 3 solution for this coding contest problem. A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel. Her magic is activated by drawing a magic circle using some magical stones and strings. This m...
instruction
0
68,850
23
137,700
"Correct Solution: ``` from collections import Counter def get_par(x, par_lst): if x == par_lst[x]: return x ret = get_par(par_lst[x], par_lst) par_lst[x] = ret return ret def main(): while True: n, m = map(int, input().split()) if n == 0: break par_lst = [i for i in range(n)] count...
output
1
68,850
23
137,701
Provide a correct Python 3 solution for this coding contest problem. A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel. Her magic is activated by drawing a magic circle using some magical stones and strings. This m...
instruction
0
68,851
23
137,702
"Correct Solution: ``` # AOJ 0251: Magic Square # Python3 2018.6.25 bal4u # UNION-FIND library class UnionSet: def __init__(self, nmax): self.size = [1]*nmax self.id = [i for i in range(nmax+1)] def root(self, i): while i != self.id[i]: self.id[i] = self.id[self.id[i]] i = self.id[i] return i def conn...
output
1
68,851
23
137,703
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A witch named Marie lived deep in a remote forest. Since she is a witch, she magically covers everything she needs to live, such as food, water, and fuel. Her magic is activated by drawing a ma...
instruction
0
68,852
23
137,704
No
output
1
68,852
23
137,705
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,214
23
138,428
Tags: geometry Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * from fractions import * from bisect import * from heapq import* from io import BytesIO, IOBase def vsInput(): sys.stdin = open('input.txt', 'r') sys...
output
1
69,214
23
138,429
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,215
23
138,430
Tags: geometry Correct Solution: ``` import math def dist(x, y, a, b): return math.sqrt((x - a) ** 2 + (y - b) ** 2) result = 0 x1, y1, r1, R1 = map(int, input().split()) x2, y2, r2, R2 = map(int, input().split()) if dist(x1, y1, x2, y2) >= R1 + R2 or \ dist(x1, y1, x2, y2) + R2 <= R1 or \ dist(x1, y1, x...
output
1
69,215
23
138,431
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,216
23
138,432
Tags: geometry Correct Solution: ``` ((x,y,r,R), (u,v,w,W))=[map(int, input().split()) for _ in range(2)] d = (x-u) ** 2 + (y - v) ** 2 def t(a,b,c): if c <= a and (a-c)**2 >= d: return 1 if c >= b and (c-b)**2 >= d: return 1 if (b+c) ** 2 <= d: return 1 return 0 print(t(r,R,w) ...
output
1
69,216
23
138,433
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,217
23
138,434
Tags: geometry Correct Solution: ``` def okay(xc, yc, rc, xr, yr, rr, Rr): d = ((xc-xr) ** 2 + (yc-yr) ** 2) ** 0.5 if d + rc <= rr: return True if d >= rc + Rr: return True if d + Rr <= rc: return True return False x1, y1, r1, R1 = map(float, input().split()) x2, y2, r2, R2...
output
1
69,217
23
138,435
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,218
23
138,436
Tags: geometry Correct Solution: ``` x1, y1, r1, R1 = map(int, input().split()) x2, y2, r2, R2 = map(int, input().split()) D = (x1-x2)**2+(y1-y2)**2 c = 0 c += ((r1-r2)**2>=D) c += ((R1-R2)**2>=D) c += ((R1+r2)**2<=D) c += ((R2+r1)**2<=D) c += ((R1+R2)**2<=D)*2 if r1 >= R2: c += ((r1-R2)**2>=D)*2 if r2 >= R1: ...
output
1
69,218
23
138,437
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,219
23
138,438
Tags: geometry Correct Solution: ``` from math import sqrt def dist(x1,y1,x2,y2): return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)) def circleInCircle(x1,y1,r1,x2,y2,r2): centerDist = dist(x1,y1,x2,y2) return centerDist + r1 <= r2 def circleOutsideCircle(x1,y1,r1,x2,y2,r2): centerDist = dist(x1,y1,x2,y2) if(abs(cen...
output
1
69,219
23
138,439
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,220
23
138,440
Tags: geometry Correct Solution: ``` import os import sys from io import BytesIO, IOBase from collections import Counter BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer = BytesIO() self.writable = "x" in file.mode or "r...
output
1
69,220
23
138,441
Provide tags and a correct Python 3 solution for this coding contest problem. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones will do with exactly two ...
instruction
0
69,221
23
138,442
Tags: geometry Correct Solution: ``` def is_intersect(r1, r2, R, x1, y1, x2, y2): d = (x1 - x2)**2 + (y1 - y2)**2 return d >= (r1 + R)**2 or r1 < r2 and d <= (r2 - r1)**2 or R < r1 and d <= (r1 - R)**2 x1, y1, r1, R1 = map(int, input().split()) x2, y2, r2, R2 = map(int, input().split()) res1 = is_intersect(r1...
output
1
69,221
23
138,443
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, ...
instruction
0
69,222
23
138,444
Yes
output
1
69,222
23
138,445
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, ...
instruction
0
69,223
23
138,446
No
output
1
69,223
23
138,447
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, ...
instruction
0
69,224
23
138,448
No
output
1
69,224
23
138,449
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, ...
instruction
0
69,225
23
138,450
No
output
1
69,225
23
138,451
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, ...
instruction
0
69,226
23
138,452
No
output
1
69,226
23
138,453
Provide tags and a correct Python 3 solution for this coding contest problem. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortuna...
instruction
0
69,459
23
138,918
Tags: dp, math, number theory Correct Solution: ``` def foo(listSize,list): for subSize in range(1,listSize+1): if listSize%subSize==0: parts=listSize/subSize if parts ==1: _sum = sum(list) if (listSize == _sum): return "YES" ...
output
1
69,459
23
138,919
Provide tags and a correct Python 3 solution for this coding contest problem. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortuna...
instruction
0
69,460
23
138,920
Tags: dp, math, number theory Correct Solution: ``` import math n = int(input()) l = list(map(int,input().split())) factors = [] for i in range(1,int((n+1)/2)): if n%i == 0: factors.append(i) f = 1 for d in factors: for i in range(d): k = 0 while True: if k >= n: f = 0 break elif l[i+k] == 1: ...
output
1
69,460
23
138,921
Provide tags and a correct Python 3 solution for this coding contest problem. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortuna...
instruction
0
69,464
23
138,928
Tags: dp, math, number theory Correct Solution: ``` import sys import string import math import heapq from collections import defaultdict from functools import lru_cache from collections import Counter from fractions import Fraction def mi(s): return map(int, s.strip().split()) def lmi(s): return list(mi(s)) ...
output
1
69,464
23
138,929
Provide tags and a correct Python 3 solution for this coding contest problem. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortuna...
instruction
0
69,465
23
138,930
Tags: dp, math, number theory Correct Solution: ``` a=int(input('')) b=list(map(int,input().split())) f=0 for i in range(3,a+1): if(a%i==0): n=a//i for k in range(n): f=1 for z in range(k,a,n): if(b[z]==0): f=0 break ...
output
1
69,465
23
138,931
Provide tags and a correct Python 3 solution for this coding contest problem. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortuna...
instruction
0
69,466
23
138,932
Tags: dp, math, number theory Correct Solution: ``` n=int(input()) lst=[*map(int,input().split())] from sys import exit for i in range(3,n+1): if n%i==0: k=n//i for j in range(k): res='YES' for x in range(j,n,k): if lst[x]==0:res='NO';break if res=...
output
1
69,466
23
138,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,467
23
138,934
Yes
output
1
69,467
23
138,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,468
23
138,936
Yes
output
1
69,468
23
138,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,469
23
138,938
Yes
output
1
69,469
23
138,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,470
23
138,940
Yes
output
1
69,470
23
138,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,471
23
138,942
No
output
1
69,471
23
138,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,472
23
138,944
No
output
1
69,472
23
138,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,473
23
138,946
No
output
1
69,473
23
138,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood. Merlin, the wizard predicted to King Arthur that the next...
instruction
0
69,474
23
138,948
No
output
1
69,474
23
138,949
Provide tags and a correct Python 3 solution for this coding contest problem. One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but ...
instruction
0
69,475
23
138,950
Tags: constructive algorithms, geometry Correct Solution: ``` n = int(input()) print("YES") for i in range(n): z1, y1, x2, y2 = input().split() print((int(z1) % 2) * 2 + (int(y1) % 2) + 1) ```
output
1
69,475
23
138,951
Provide tags and a correct Python 3 solution for this coding contest problem. One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but ...
instruction
0
69,476
23
138,952
Tags: constructive algorithms, geometry Correct Solution: ``` p = int(input()) print("YES") for i in range(p): a, b, c, d = [abs(int(i)) for i in input().split()] if a % 2 == 0: print("1" if b % 2 == 0 else "2") else: print("3" if b % 2 == 0 else "4") ```
output
1
69,476
23
138,953
Provide tags and a correct Python 3 solution for this coding contest problem. One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but ...
instruction
0
69,477
23
138,954
Tags: constructive algorithms, geometry Correct Solution: ``` from sys import stdin,stdout n = int(stdin.readline()) a = [0 for i in range(n)] for i in range(n): inp = stdin.readline().split() x = int(inp[0]) y = int(inp[1]) a[i] = 2 * (x % 2) + (y % 2) + 1 stdout.write("YES") stdout.write('\n') stdout....
output
1
69,477
23
138,955
Provide tags and a correct Python 3 solution for this coding contest problem. One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but ...
instruction
0
69,478
23
138,956
Tags: constructive algorithms, geometry Correct Solution: ``` '''plan noticed that if both upperle ''' from sys import stdin, stdout # n = int(stdin.readline().rstrip()) # n = int(input()) all_lines = stdin.read().split('\n') stdout.write('YES\n') for line in all_lines[1:-1]: x1, y1, x2, y2 = (int(x) % 2 for x...
output
1
69,478
23
138,957
Provide tags and a correct Python 3 solution for this coding contest problem. One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but ...
instruction
0
69,479
23
138,958
Tags: constructive algorithms, geometry Correct Solution: ``` n = int(input()) rectangles = [] for i in range(n): a, b, c, d = tuple(map(int,input().split())) rectangles.append((a,b)) print("YES") for i in range(n): a,b = rectangles[i][0], rectangles[i][1] if a%2 == 0 and b%2 == 0: print(1) ...
output
1
69,479
23
138,959