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. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,506
23
25,012
Tags: geometry Correct Solution: ``` n = int(input()) l = list(map(int,input().split())) w = 0 c = 0 for i in range(n-1): if l[i] == 2: if i!=0 and i!=n-1: if l[i+1] == 3 or l[i-1] == 3: w = 1 break else: if i == 0: if l[i+1] ==...
output
1
12,506
23
25,013
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,507
23
25,014
Tags: geometry Correct Solution: ``` n = int(input()) a = list(map(int,input().split())) cnt,f = 0,0 for i in range(1,n): if (a[i-1]-1)*(a[i]-1) > 0: f = 1 cnt += a[i-1]+a[i] if i > 1 and a[i-2] == 3 and a[i-1] == 1 and a[i] == 2: cnt -= 1 if f == 1: print("Infinite") else: print("Finite") print(cnt) ```
output
1
12,507
23
25,015
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,508
23
25,016
Tags: geometry Correct Solution: ``` n = int(input()) a = [int(i) for i in input().split()] total = 0 suma = dict() suma[1, 2] = 3 suma[1, 3] = 4 suma[2, 1] = 3 suma[2, 3] = 9999999999999999999999999999999999999999999999999 suma[3, 1] = 4 suma[3, 2] = 9999999999999999999999999999999999999999999999999 for i, j in zip...
output
1
12,508
23
25,017
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,509
23
25,018
Tags: geometry Correct Solution: ``` input() a = ''.join(input().split()) res = 0 for aij in zip(a, a[1:]): if '1' in aij: res += sum(map(int, aij)) else: print('Infinite') break else: print('Finite') print(res - a.count('312')) ```
output
1
12,509
23
25,019
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,510
23
25,020
Tags: geometry Correct Solution: ``` def solve(n,A): cnt=0 for i in range(n-1): a0,a1,a2=A[i],A[i+1],A[i+2] if a2==1: if a1==2: cnt+=3 else: cnt+=4 elif a2==2: if a1==1: if a0==3: cnt+...
output
1
12,510
23
25,021
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,511
23
25,022
Tags: geometry Correct Solution: ``` n = int(input()) a = list(map(int,input().split())) flag = 0 count = 0 for i in range(1,n): if a[i] == 1: if a[i-1] == 1: flag = 1 break else: if a[i-1] == 2: count += 3 else: count += 4 elif a[i] == 2: if a[i-1] == 3 or a[i-1] == 2: flag = 1 break...
output
1
12,511
23
25,023
Provide tags and a correct Python 3 solution for this coding contest problem. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier....
instruction
0
12,512
23
25,024
Tags: geometry Correct Solution: ``` n = int(input()) vals = input().replace(" ", "") if "23" in vals or "32" in vals: print("Infinite") exit(0) else: result = 0 for i in range(len(vals)-1): temp = vals[i] + vals[i+1] if temp == "12" or temp == "21": result += 3 if ...
output
1
12,512
23
25,025
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,513
23
25,026
Yes
output
1
12,513
23
25,027
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,514
23
25,028
Yes
output
1
12,514
23
25,029
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,515
23
25,030
Yes
output
1
12,515
23
25,031
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,516
23
25,032
Yes
output
1
12,516
23
25,033
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,517
23
25,034
No
output
1
12,517
23
25,035
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,518
23
25,036
No
output
1
12,518
23
25,037
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,519
23
25,038
No
output
1
12,519
23
25,039
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus,...
instruction
0
12,520
23
25,040
No
output
1
12,520
23
25,041
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,586
23
25,172
Tags: geometry Correct Solution: ``` import math n = int(input()) kords = list() for _ in range(n): kords.append(list(map(int, input().split()))) if n % 2 == 0: first_part = kords[:len(kords) // 2 + 1] second_part = kords[len(kords) // 2:] + [kords[0]] for i in range(n // 2): if abs( first_part[i][0] - second...
output
1
12,586
23
25,173
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,587
23
25,174
Tags: geometry Correct Solution: ``` import sys n = int(sys.stdin.readline().strip()) X = [] Y = [] for i in range (0, n): x, y = list(map(int, sys.stdin.readline().strip().split())) X.append(x) Y.append(y) X.append(X[0]) Y.append(Y[0]) if n % 2 == 1: print("NO") else: v = True m = n // 2 f...
output
1
12,587
23
25,175
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,588
23
25,176
Tags: geometry Correct Solution: ``` from sys import stdin from collections import deque mod = 10**9 + 7 import sys # sys.setrecursionlimit(10**6) from queue import PriorityQueue # def rl(): # return [int(w) for w in stdin.readline().split()] from bisect import bisect_right from bisect import bisect_left from colle...
output
1
12,588
23
25,177
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,589
23
25,178
Tags: geometry Correct Solution: ``` # https://codeforces.com/contest/1300/problem/D n = int(input()) p = [list(map(int, input().split())) for _ in range(n)] def is_parallel(x1, y1, x2, y2): if x1 == -x2 and y1 == -y2: return True return False flg = True if n % 2 == 1: flg=False else: for ...
output
1
12,589
23
25,179
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,590
23
25,180
Tags: geometry Correct Solution: ``` def main(): N = int(input()) if N % 2: print("NO") return pts = [complex(*map(int, input().strip().split())) for _ in range(N)] for i in range(N // 2): if pts[i] + pts[i + N // 2] != pts[0] + pts[N // 2]: print("NO") return print("YES") main() `...
output
1
12,590
23
25,181
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,591
23
25,182
Tags: geometry Correct Solution: ``` def main(): from sys import stdin, stdout n = int(stdin.readline()) inp = tuple((tuple(map(float, stdin.readline().split())) for _ in range(n))) avg_xt2 = sum((inp_i[0] for inp_i in inp)) / n * 2 avg_yt2 = sum((inp_i[1] for inp_i in inp)) / n * 2 sym = tuple(...
output
1
12,591
23
25,183
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,592
23
25,184
Tags: geometry Correct Solution: ``` from __future__ import division N = int(input()) points = [] for p in range(N): x, y = [int(x) for x in input().split()] points.append((x, y)) # T always has central symmetry # To determine: if P has a point of central symmetry # function to determine the bottom and top mo...
output
1
12,592
23
25,185
Provide tags and a correct Python 3 solution for this coding contest problem. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Define P(x,y) as a polygon obtained by translating...
instruction
0
12,593
23
25,186
Tags: geometry Correct Solution: ``` def Input(): tem = input().split() ans = [] for it in tem: ans.append(int(it)) return ans n = Input()[0] a = [] ma = {} for i in range(n): x, y = Input() a.append((x,y)) a.append(a[0]) flag = True for i in range(1,n+1): if (a[i][0]-a[i-1][0])==0:...
output
1
12,593
23
25,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,594
23
25,188
Yes
output
1
12,594
23
25,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,595
23
25,190
Yes
output
1
12,595
23
25,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,596
23
25,192
Yes
output
1
12,596
23
25,193
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,597
23
25,194
Yes
output
1
12,597
23
25,195
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,598
23
25,196
No
output
1
12,598
23
25,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,599
23
25,198
No
output
1
12,599
23
25,199
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,600
23
25,200
No
output
1
12,600
23
25,201
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Guy-Manuel and Thomas are going to build a polygon spaceship. You're given a strictly convex (i. e. no three points are collinear) polygon P which is defined by coordinates of its vertices. Def...
instruction
0
12,601
23
25,202
No
output
1
12,601
23
25,203
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,732
23
25,464
Tags: implementation, math Correct Solution: ``` R=lambda:map(int,input().split()) a1,b1,c1=R() a2,b2,c2=R() Z=lambda x,y,z:not x and not y and z if a1*b2-a2*b1!=0: print("1") elif Z(a1,b1,c1) or Z(a2,b2,c2) or c1*b2-b1*c2 or c1*a2-c2*a1: print("0") else: print("-1") ```
output
1
12,732
23
25,465
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,733
23
25,466
Tags: implementation, math Correct Solution: ``` a1, b1, c1 = [int(i) for i in input().split()] a2, b2, c2 = [int(i) for i in input().split()] if(b1 != 0 and b2 != 0): #paralelas: if(a1/b1 == a2/b2): if(c1/b1 == c2/b2): print(-1) #paralelas iguais else: print(0) #paralel...
output
1
12,733
23
25,467
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,734
23
25,468
Tags: implementation, math Correct Solution: ``` R = lambda:map(int, input().split()) a1, b1, c1 = R() a2, b2, c2 = R() if a1 == b1 == 0 and c1 != 0 or a2 == b2 == 0 and c2 != 0: print(0) elif a1 == b1 == c1 == 0 or a2 == b2 == c2 == 0: print(-1) else: if c1 != 0: a1 /= c1 b1 /= c1 c1 = 1 if c2 != 0...
output
1
12,734
23
25,469
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,735
23
25,470
Tags: implementation, math Correct Solution: ``` a1,b1,c1=list(map(int,input().split())) a2,b2,c2=list(map(int,input().split())) if (a1==0 and b1==0 and c1!=0) or (a2==0 and b2==0 and c2!=0): c=0 print(c) elif (a2==1 and b2==-1 and c2==-1 and c1!=-1): c=-1 print(c) elif (a2==0 and b2==0 and c2==0): c=-1 print(c)...
output
1
12,735
23
25,471
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,736
23
25,472
Tags: implementation, math Correct Solution: ``` #codeforces 21b intersection, math def readGen(transform): while (True): n=0 tmp=input().split() m=len(tmp) while (n<m): yield(transform(tmp[n])) n+=1 readint=readGen(int) A1,B1,C1=next(readint),next(readint),next(readint) A2,B2,C2=next(readint),next(rea...
output
1
12,736
23
25,473
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,737
23
25,474
Tags: implementation, math Correct Solution: ``` a1, b1, c1 = input().split(' ') a2, b2, c2 = input().split(' ') a1 = int(a1) b1 = int(b1) c1 = int(c1) a2 = int(a2) b2 = int(b2) c2 = int(c2) if((a1 == 0 and b1 == 0) and (a2 == 0 and b2 == 0) and c1 != c2): print(0) exit() if((a1 == 0 and b1 == 0 and c1 =...
output
1
12,737
23
25,475
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,738
23
25,476
Tags: implementation, math Correct Solution: ``` #! /usr/bin/python3 def solve(): x, y, z = map(int, input().strip().split()) a, b, c = map(int, input().strip().split()) ret = 0 if (x * b == y * a): if (y == 0 and b == 0): if c * x == a * z: ret = -1 else: ret = 0 elif z * b == y * c: ret = ...
output
1
12,738
23
25,477
Provide tags and a correct Python 3 solution for this coding contest problem. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which finds the number of points in the intersection of ...
instruction
0
12,739
23
25,478
Tags: implementation, math Correct Solution: ``` def fazTudo(): ar,br,cr = map(int,input().split()); aw,bw,cw = map(int,input().split()); res=1; if(br==0 and bw==0): if(ar==0 and cr!=0 or aw==0 and cw!=0): print(0); return; if(ar==0 and br==0 and cr==0 or aw==0 and bw==0 and cw==0): print(-1); retur...
output
1
12,739
23
25,479
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,740
23
25,480
Yes
output
1
12,740
23
25,481
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,741
23
25,482
Yes
output
1
12,741
23
25,483
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,742
23
25,484
Yes
output
1
12,742
23
25,485
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,743
23
25,486
Yes
output
1
12,743
23
25,487
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,745
23
25,490
No
output
1
12,745
23
25,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,746
23
25,492
No
output
1
12,746
23
25,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given two set of points. The first set is determined by the equation A1x + B1y + C1 = 0, and the second one is determined by the equation A2x + B2y + C2 = 0. Write the program which fin...
instruction
0
12,747
23
25,494
No
output
1
12,747
23
25,495
Provide tags and a correct Python 3 solution for this coding contest problem. There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have i...
instruction
0
12,809
23
25,618
Tags: brute force, geometry, implementation, math Correct Solution: ``` a, b = map(int, input().split()) s = [i*i for i in range(1, a)] t = [i*i for i in range(1, b)] def r(x): return int(x**0.5) for i in s: if a*a-i in s: for j in t: if b*b-j in t: if i!=j and i*j-(a*a-i)*(...
output
1
12,809
23
25,619
Provide tags and a correct Python 3 solution for this coding contest problem. There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have i...
instruction
0
12,810
23
25,620
Tags: brute force, geometry, implementation, math Correct Solution: ``` a,b=list(map(int,input().split())) f=0 x1,y1,x2,y2=0,0,0,0 for x in range(1,a+1): for y in range(1,a+1): if (x**2+y**2==a**2) and (x!=0 and y!=0): m=-x/y if float(int(b/(1+m**2)**(0.5)))==b/(1+m**2)**(0.5) and fl...
output
1
12,810
23
25,621
Provide tags and a correct Python 3 solution for this coding contest problem. There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have i...
instruction
0
12,811
23
25,622
Tags: brute force, geometry, implementation, math Correct Solution: ``` a,b=map(int,input().split()) def get(a): return list([i,j] for i in range(1,a) for j in range(1,a) if i*i+j*j==a*a) A=get(a) B=get(b) for [a,b] in A: for [c,d] in B: if a*c==b*d and b!=d: print("YES\n0 0") pr...
output
1
12,811
23
25,623
Provide tags and a correct Python 3 solution for this coding contest problem. There is a right triangle with legs of length a and b. Your task is to determine whether it is possible to locate the triangle on the plane in such a way that none of its sides is parallel to the coordinate axes. All the vertices must have i...
instruction
0
12,812
23
25,624
Tags: brute force, geometry, implementation, math Correct Solution: ``` sqrt = {i * i: i for i in range(1, 1000)} a, b = map(int, input().split()) for y in range(1, a): x2 = a * a - y * y if x2 in sqrt: x = sqrt[x2] if b * y % a == 0 and b * x % a == 0 and b * x // a != y: print('YES...
output
1
12,812
23
25,625