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. The numbers 1 to n x n are contained in the n x n square squares one by one, and the sum of the squares in any vertical column and the sum of the squares in any horizontal column are diagonal sq...
instruction
0
84,932
23
169,864
Yes
output
1
84,932
23
169,865
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The numbers 1 to n x n are contained in the n x n square squares one by one, and the sum of the squares in any vertical column and the sum of the squares in any horizontal column are diagonal sq...
instruction
0
84,933
23
169,866
No
output
1
84,933
23
169,867
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The numbers 1 to n x n are contained in the n x n square squares one by one, and the sum of the squares in any vertical column and the sum of the squares in any horizontal column are diagonal sq...
instruction
0
84,934
23
169,868
No
output
1
84,934
23
169,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The numbers 1 to n x n are contained in the n x n square squares one by one, and the sum of the squares in any vertical column and the sum of the squares in any horizontal column are diagonal sq...
instruction
0
84,935
23
169,870
No
output
1
84,935
23
169,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The numbers 1 to n x n are contained in the n x n square squares one by one, and the sum of the squares in any vertical column and the sum of the squares in any horizontal column are diagonal sq...
instruction
0
84,936
23
169,872
No
output
1
84,936
23
169,873
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,961
23
169,922
"Correct Solution: ``` #!/usr/bin/env python3 #aoj b import re from collections import defaultdict def check(i):#メモ化再帰 if d[i] > 0: return d[i] d[i] = 1#チェック状態 for y in range(p[i][0],p[i][1]+1): for x in range(p[i][2],p[i][3]+1): if s[y][x] == ".":#長方形内部に空の部分が存在 ...
output
1
84,961
23
169,923
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,962
23
169,924
"Correct Solution: ``` def can_fill(image, k, v): for y in range(v[1], v[3] + 1): for x in range(v[0], v[2] + 1): m = image[y][x] if m != k and m != '*': return False return True def is_safe(image, p): keys = list(p.keys()) i = 0 while i < len(keys): ...
output
1
84,962
23
169,925
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,963
23
169,926
"Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [i...
output
1
84,963
23
169,927
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,964
23
169,928
"Correct Solution: ``` import sys from collections import defaultdict def check(i): #メモ化再帰でやります if d[i] > 0: return d[i] d[i] = 1 #チェック状態 """長方形と仮定し、矛盾があればSUSPICUOUS""" for y in range(p[i][0],p[i][1]+1): for x in range(p[i][2],p[i][3]+1): if s[y][x] == ".": #長方形内部に空の部分が存在 ...
output
1
84,964
23
169,929
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,965
23
169,930
"Correct Solution: ``` n = int(input()) for _ in range(n): h, w = map(int, input().split()) mp = [list(input()) for _ in range(h)] range_dic = {} keys = [] for y in range(h): for x in range(w): c = mp[y][x] if c in range_dic: x1, x2, y1, y2 = range_dic[c] range_dic[c] = (min(x,...
output
1
84,965
23
169,931
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,966
23
169,932
"Correct Solution: ``` n = int(input()) for _ in range(n): h, w = map(int, input().split()) mp = [list(input()) for _ in range(h)] range_dic = {} keys = [] for y in range(h): for x in range(w): c = mp[y][x] if c in range_dic: x1, x2, y1, y2 = range_dic[c] range_dic[c] = (min(x,...
output
1
84,966
23
169,933
Provide a correct Python 3 solution for this coding contest problem. This is the story of 20XX. The number of air passengers increased as a result of the stable energy supply by the renewable power network and the invention of liquefied synthetic fuel. However, the threat of terrorism by aircraft still exists, and the...
instruction
0
84,967
23
169,934
"Correct Solution: ``` from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,copy,time sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(input()) def inpl(): return list(map(int, input().split())) def inpl_str(): return list(input()....
output
1
84,967
23
169,935
Provide a correct Python 3 solution for this coding contest problem. You are recording a result of a secret experiment, which consists of a large set of N-dimensional vectors. Since the result may become very large, you are thinking of compressing it. Fortunately you already have a good compression method for vectors ...
instruction
0
84,972
23
169,944
"Correct Solution: ``` import sys readline = sys.stdin.readline write = sys.stdout.write def calc(V, es, r): mins = [(10**18, -1)]*V for s, t, w in es: mins[t] = min(mins[t], (w, s)) mins[r] = (-1, -1) group = [0]*V comp = [0]*V cnt = 0 used = [0]*V for v in range(V): ...
output
1
84,972
23
169,945
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,982
23
169,964
"Correct Solution: ``` def cross(a: complex, b: complex) -> float: return a.real * b.imag - a.imag * b.real def cross_point(c: complex, d: complex) -> complex: global lt, lv vec = d - c v1 = cross(lv, vec) v2 = cross(lv, lt - c) return c + v2 / v1 * vec if __name__ == "__main__": n = int...
output
1
84,982
23
169,965
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,983
23
169,966
"Correct Solution: ``` import sys readline = sys.stdin.readline write = sys.stdout.write def cross3(O, A, B): ox, oy = O; ax, ay = A; bx, by = B return (ax - ox) * (by - oy) - (bx - ox) * (ay - oy) def cross_point(p0, p1, q0, q1): x0, y0 = p0; x1, y1 = p1 x2, y2 = q0; x3, y3 = q1 dx0 = x1 - x0; dy0 ...
output
1
84,983
23
169,967
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,984
23
169,968
"Correct Solution: ``` import cmath EPS = 1e-6 #外積 def OuterProduct(one, two): tmp = one.conjugate() * two return tmp.imag #点が直線上にあるか def IsOnLine(point, begin, end): return abs(OuterProduct(begin-point, end-point)) <= EPS #3点が反時計回りか #一直線上のときの例外処理できていない→F def CCW(p, q, r): one, two = q-p, r-q if OuterProduct(on...
output
1
84,984
23
169,969
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,985
23
169,970
"Correct Solution: ``` #!/usr/bin/env python3 # CGL_4_C: Convex Polygon Convex Cut def cut(ps, p0, p1): polygon = [] for p2, p3 in zip(ps, ps[1:] + [ps[0]]): if cross(p0, p1, p0, p2) >= 0: polygon.append(p2) if intersect(p0, p1, p2, p3): p = intersect_point(p0, p1, p2, ...
output
1
84,985
23
169,971
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,986
23
169,972
"Correct Solution: ``` from sys import stdin readline = stdin.readline class vector: def cross(a, b): return a.real * b.imag - a.imag * b.real def dot(a, b): return a.real * b.real + a.imag * b.imag def ccw(a, b, c): b -= a c -= a if vector.cross(b, c) > 0: ...
output
1
84,986
23
169,973
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,987
23
169,974
"Correct Solution: ``` def cross(a, b): return a.real * b.imag - a.imag * b.real def cross_point(c, d): l = d - c v1 = cross(lv, l) v2 = cross(lv, lt - c) return c + v2 / v1 * l n = int(input()) points = [complex(*map(int, input().split())) for _ in range(n)] point0 = points.pop(0) points.append...
output
1
84,987
23
169,975
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,988
23
169,976
"Correct Solution: ``` # cross point def cross(c1, c2): return c1.real * c2.imag - c1.imag * c2.real def cross_point(p1, p2, p3, p4): # p1 and p2 are points on a segment. # p3 and p4 are points on the other segment. base = p4 - p3 hypo1 = p1 - p3 hypo2 = p2 - p3 d1 = cross(base, hypo1) / a...
output
1
84,988
23
169,977
Provide a correct Python 3 solution for this coding contest problem. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of points p1, p2,..., pn where line segments connecting pi...
instruction
0
84,989
23
169,978
"Correct Solution: ``` from sys import stdin readline = stdin.readline class vector: def cross(a, b): return a.real * b.imag - a.imag * b.real def dot(a, b): return a.real * b.real + a.imag * b.imag def ccw(a, b, c): b -= a c -= a if vector.cross(b, c) > 0: ...
output
1
84,989
23
169,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,990
23
169,980
Yes
output
1
84,990
23
169,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,991
23
169,982
Yes
output
1
84,991
23
169,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,992
23
169,984
No
output
1
84,992
23
169,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,993
23
169,986
No
output
1
84,993
23
169,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,994
23
169,988
No
output
1
84,994
23
169,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> As shown in the figure above, cut a convex polygon g by a line p1p2 and print the area of the cut polygon which is on the left-hand side of the line. g is represented by a sequence of...
instruction
0
84,995
23
169,990
No
output
1
84,995
23
169,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50; 1 ≤ a ≤ m ≤ 50). Find any such rectangular matrix of size n × m that satisfies all of the following conditions: * each row of ...
instruction
0
85,160
23
170,320
Yes
output
1
85,160
23
170,321
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50; 1 ≤ a ≤ m ≤ 50). Find any such rectangular matrix of size n × m that satisfies all of the following conditions: * each row of ...
instruction
0
85,163
23
170,326
No
output
1
85,163
23
170,327
Provide tags and a correct Python 3 solution for this coding contest problem. We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k. <image> The descripti...
instruction
0
85,185
23
170,370
Tags: constructive algorithms, math Correct Solution: ``` from sys import stdout, stdin _input, _print = stdin.readline, stdout.write _range, _int = range, int def solution(): for _ in _range(_int(_input())): a, k = [_int(i) for i in _input().split()] if (a-k) >= 0: if (a - k) % 2 == 0: ...
output
1
85,185
23
170,371
Provide tags and a correct Python 3 solution for this coding contest problem. We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k. <image> The descripti...
instruction
0
85,186
23
170,372
Tags: constructive algorithms, math Correct Solution: ``` import math t=int(input()) out=[] for i in range(t): n,k=map(int,input().split()) x=(n-k)/2 if(x<0): z=int(-2*x) out.append(z) elif(x>0): if(x==math.ceil(x)): out.append(0) else: o...
output
1
85,186
23
170,373
Provide tags and a correct Python 3 solution for this coding contest problem. We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k. <image> The descripti...
instruction
0
85,188
23
170,376
Tags: constructive algorithms, math Correct Solution: ``` tests=int(input()) for i in range(tests): a,b=list(map(int,input().split())) if(b>a): print(b-a) elif((a-b)%2==1): print("1") else: print("0") ```
output
1
85,188
23
170,377
Provide tags and a correct Python 3 solution for this coding contest problem. We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance from A to B is equal to k. <image> The descripti...
instruction
0
85,190
23
170,380
Tags: constructive algorithms, math Correct Solution: ``` ''' Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anyw...
output
1
85,190
23
170,381
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We have a point A with coordinate x = n on OX-axis. We'd like to find an integer point B (also on OX-axis), such that the absolute difference between the distance from O to B and the distance fr...
instruction
0
85,194
23
170,388
Yes
output
1
85,194
23
170,389
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,584
23
171,168
"Correct Solution: ``` from itertools import product def check_odd(i, j): return (i + j) % 2 == 0 def check_even(i, j): return i % 2 == 0 def solve(n, d1, d2): s1, s2 = 0, 0 while d1 % 4 == 0: d1 >>= 2 s1 += 1 while d2 % 4 == 0: d2 >>= 2 s2 += 1 f1 = check_...
output
1
85,584
23
171,169
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,585
23
171,170
"Correct Solution: ``` def judge(D): n = 0 while D%4==0: n += 1 D //= 4 def h1(x,y): return ~((x>>n)^(y>>n))&1 def h2(x,y): return ~(x>>n)&1 return h1 if D%2==1 else h2 N,D1,D2 = map(int,input().split()) j1,j2 = judge(D1),judge(D2) cnt = 0 for x in range(N*2): for y in range(N*2): if...
output
1
85,585
23
171,171
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,586
23
171,172
"Correct Solution: ``` def judge(D): n = 0 while D%4==0: n += 1 D //= 4 return (lambda x,y: ~((x>>n)^(y>>n))&1) if D%2==1 else (lambda x,y: ~(x>>n)&1) N,D1,D2 = map(int,input().split()) j1,j2 = judge(D1),judge(D2) for _,(x,y) in zip(range(N*N),filter(lambda p: j1(*p) and j2(*p), ((x,y) for x in range(N*...
output
1
85,586
23
171,173
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,587
23
171,174
"Correct Solution: ``` def check_odd(i, j): return (i + j) % 2 == 0 def check_even(i, j): return i % 2 == 0 def solve(n, d1, d2): s1, s2 = 0, 0 while d1 % 4 == 0: d1 >>= 2 s1 += 1 while d2 % 4 == 0: d2 >>= 2 s2 += 1 f1 = check_odd if d1 % 2 else check_even ...
output
1
85,587
23
171,175
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,588
23
171,176
"Correct Solution: ``` from sys import exit, setrecursionlimit, stderr from functools import reduce from itertools import * from collections import defaultdict from bisect import bisect def read(): return int(input()) def reads(): return [int(x) for x in input().split()] N, D1, D2 = reads() NN = 2 * N def deg(x...
output
1
85,588
23
171,177
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,589
23
171,178
"Correct Solution: ``` from itertools import product N, D1, D2 = map(int, input().split()) # Dが「奇数」or「D%4=2」になるまで、4で割る Ds = [] Ms = [] for D in [D1, D2]: M = 1 while D % 4 == 0: D //= 4 M *= 2 Ds += [D] Ms += [M] # 各点(i,j)に対して、処理を行う num = 0 for i, j in product(range(2 * N), repeat=2)...
output
1
85,589
23
171,179
Provide a correct Python 3 solution for this coding contest problem. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The distance between any two points in S is not \sqrt{D_1}. * The...
instruction
0
85,590
23
171,180
"Correct Solution: ``` from sys import exit, setrecursionlimit, stderr from functools import reduce from itertools import * from collections import defaultdict from bisect import bisect def read(): return int(input()) def reads(): return [int(x) for x in input().split()] N, D1, D2 = reads() NN = 2 * N def deg(x...
output
1
85,590
23
171,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The dista...
instruction
0
85,591
23
171,182
No
output
1
85,591
23
171,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The dista...
instruction
0
85,592
23
171,184
No
output
1
85,592
23
171,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The dista...
instruction
0
85,593
23
171,186
No
output
1
85,593
23
171,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi is doing a research on sets of points in a plane. Takahashi thinks a set S of points in a coordinate plane is a good set when S satisfies both of the following conditions: * The dista...
instruction
0
85,594
23
171,188
No
output
1
85,594
23
171,189
Provide a correct Python 3 solution for this coding contest problem. <image> For given three points p0, p1, p2, print COUNTER_CLOCKWISE if p0, p1, p2 make a counterclockwise turn (1), CLOCKWISE if p0, p1, p2 make a clockwise turn (2), ONLINE_BACK if p2 is on a line p2, p0, p1 in this order (3), ONLINE_F...
instruction
0
85,688
23
171,376
"Correct Solution: ``` #! /usr/bin/env python3 from typing import List, Tuple from math import sqrt from enum import Enum EPS = 1e-10 def float_equal(x: float, y: float) -> bool: return abs(x - y) < EPS class PointLocation(Enum): COUNTER_CLOCKWISE = 1 CLOCKWISE = 2 ONLINE_BACK = 3 ONLINE_FRONT...
output
1
85,688
23
171,377
Provide a correct Python 3 solution for this coding contest problem. <image> For given three points p0, p1, p2, print COUNTER_CLOCKWISE if p0, p1, p2 make a counterclockwise turn (1), CLOCKWISE if p0, p1, p2 make a clockwise turn (2), ONLINE_BACK if p2 is on a line p2, p0, p1 in this order (3), ONLINE_F...
instruction
0
85,689
23
171,378
"Correct Solution: ``` import sys import math input = sys.stdin.readline class Vector(): def __init__(self, x, y): self.x = x self.y = y def __add__(self, vec): return Vector(self.x+vec.x, self.y+vec.y) def __sub__(self, vec): return Vector(self.x-vec.x, self.y-vec.y) ...
output
1
85,689
23
171,379
Provide a correct Python 3 solution for this coding contest problem. <image> For given three points p0, p1, p2, print COUNTER_CLOCKWISE if p0, p1, p2 make a counterclockwise turn (1), CLOCKWISE if p0, p1, p2 make a clockwise turn (2), ONLINE_BACK if p2 is on a line p2, p0, p1 in this order (3), ONLINE_F...
instruction
0
85,690
23
171,380
"Correct Solution: ``` from math import sqrt x0,y0,x1,y1 = map(int, input().split()) a = [x0,y0] b = [x1, y1] q = int(input()) CCW = {1: 'COUNTER_CLOCKWISE', 2: 'CLOCKWISE', 3: 'ONLINE_BACK', 4: 'ONLINE_FRONT', 5: 'ON_SEGMENT',} def dot(a,b): return sum ([i * j for i, j in zip(a,b)]) de...
output
1
85,690
23
171,381
Provide a correct Python 3 solution for this coding contest problem. <image> For given three points p0, p1, p2, print COUNTER_CLOCKWISE if p0, p1, p2 make a counterclockwise turn (1), CLOCKWISE if p0, p1, p2 make a clockwise turn (2), ONLINE_BACK if p2 is on a line p2, p0, p1 in this order (3), ONLINE_F...
instruction
0
85,691
23
171,382
"Correct Solution: ``` pp = list(map(int, input().split())) n = int(input()) def cross(a, b): return a[0]*b[1]-a[1]*b[0] def dot(a, b): n = len(a) if n != len(b): return None ans = 0 for i, j in zip(a, b): ans += i*j return ans for i in range(n): bb = list(map(...
output
1
85,691
23
171,383
Provide a correct Python 3 solution for this coding contest problem. <image> For given three points p0, p1, p2, print COUNTER_CLOCKWISE if p0, p1, p2 make a counterclockwise turn (1), CLOCKWISE if p0, p1, p2 make a clockwise turn (2), ONLINE_BACK if p2 is on a line p2, p0, p1 in this order (3), ONLINE_F...
instruction
0
85,692
23
171,384
"Correct Solution: ``` # coding=utf-8 def cross_product(vect1, vect2): return vect1[0]*vect2[1] - vect1[1]*vect2[0] def vector_plus(vect1, vect2): return [el1 + el2 for el1, el2 in zip(vect1, vect2)] def vector_minus(vect1, vect2): return [el1 - el2 for el1, el2 in zip(vect1, vect2)] def vector_prod...
output
1
85,692
23
171,385