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. Find common tangent lines of two circles $c1$ and $c2$. Constraints * $-1,000 \leq c1x, c1y, c2x, c2y \leq 1,000$ * $1 \leq c1r, c2r \leq 1,000$ * $c1$ and $c2$ are different Input Center coordinates ($cix$, $ciy$) and radii $cir$ of two circles ...
instruction
0
96,061
23
192,122
"Correct Solution: ``` import cmath import itertools import math import os import sys from collections import defaultdict if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(10 ** 9) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 # MOD = 998244353 PI = cmath.pi TAU = cmath.pi * 2 ...
output
1
96,061
23
192,123
Provide a correct Python 3 solution for this coding contest problem. Find common tangent lines of two circles $c1$ and $c2$. Constraints * $-1,000 \leq c1x, c1y, c2x, c2y \leq 1,000$ * $1 \leq c1r, c2r \leq 1,000$ * $c1$ and $c2$ are different Input Center coordinates ($cix$, $ciy$) and radii $cir$ of two circles ...
instruction
0
96,062
23
192,124
"Correct Solution: ``` #!/usr/bin/env python3 # CGL_7_G: Circles - Common Tangent from math import acos, atan2, cos, hypot, isclose, pi, sin def tangent_points(circle1, circle2): x1, y1, r1 = circle1 x2, y2, r2 = circle2 c1c2 = hypot(x2-x1, y2-y1) t0 = atan2(y2-y1, x2-x1) ps = [] r1r2 = r1+...
output
1
96,062
23
192,125
Provide a correct Python 3 solution for this coding contest problem. Find common tangent lines of two circles $c1$ and $c2$. Constraints * $-1,000 \leq c1x, c1y, c2x, c2y \leq 1,000$ * $1 \leq c1r, c2r \leq 1,000$ * $c1$ and $c2$ are different Input Center coordinates ($cix$, $ciy$) and radii $cir$ of two circles ...
instruction
0
96,063
23
192,126
"Correct Solution: ``` from math import acos, atan2, cos, hypot, isclose, pi, sin from typing import List, Tuple def tangent_points(c1x: float, c1y: float, c1r: float, c2x: float, c2y: float, c2r: float) -> List[Tuple[float, float]]: c1c2 = hypot(c2x - c1x, c2y - c1y) t0 = atan2(c2y - c1y, ...
output
1
96,063
23
192,127
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,535
23
193,070
Tags: greedy, math, sortings Correct Solution: ``` #!/c/Python34/python # coding: utf-8 ans def main(): n = int(input()) L = sorted(map(int, input().split())) L.reverse() K = [] i = 1 while(i < n): if L[i-1] == L[i]: K.append(L[i]) i += 1 elif L[i-1]-L[i...
output
1
96,535
23
193,071
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,536
23
193,072
Tags: greedy, math, sortings Correct Solution: ``` n = int(input()) a = [int(x) for x in input().split()] a.sort() res = 0 i = n-1 b = [] while i > 0: if a[i] - a[i-1] < 2: b.append(a[i-1]) i -= 1 i -= 1 #print(b) for i in range(0, len(b)-1, 2): res += b[i] * b[i+1] print(res) ```
output
1
96,536
23
193,073
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,537
23
193,074
Tags: greedy, math, sortings Correct Solution: ``` n = int(input()) s = map(int, input().split()) s = list(reversed(sorted(s))) i = 1 k =[] while i < n: if s[i-1] - s[i] == 1: k.append(s[i]) i += 1 elif s[i-1] == s[i]: k.append(s[i]) i += 1 i +=1 ans = 0 for i in range(1, len...
output
1
96,537
23
193,075
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,538
23
193,076
Tags: greedy, math, sortings Correct Solution: ``` n = int(input()) l = list(map(int, input().split())) l.sort() side = [] i = n - 1 while i > 0: s = l[i] if s == l[i - 1]: side.append(s) i -= 2 elif s == l[i - 1] + 1: side.append(s - 1) i -= 2 else: i -= 1 side.s...
output
1
96,538
23
193,077
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,539
23
193,078
Tags: greedy, math, sortings Correct Solution: ``` n=int(input()) l=[int(i) for i in input().split()] l=sorted(l) # d=dict() # for i in set(l): # d[i]=l.count(i) # ans=[] # de=list(sorted(d.items())) # d=[] # for i in de: # d.append(list(i)) # #print('d' ,d) # for i in range(len(d)-1,-1,-1): # if d[i][1]...
output
1
96,539
23
193,079
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,540
23
193,080
Tags: greedy, math, sortings Correct Solution: ``` arr = [0] * (10 ** 6 + 1) n = int(input()) for i in input().split(): arr[int(i)] += 1 i = 10 ** 6 j = i k = i c = 0 while j > 0: if arr[j] % 2 == 1 and (arr[j] > 1 or c == 0): arr[j - 1] += 1 c = 1 else: c = 0 j -= 1 r = 0 while ...
output
1
96,540
23
193,081
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,541
23
193,082
Tags: greedy, math, sortings Correct Solution: ``` n = int(input()) arr = sorted(list(map(int, input().split()))) p, res = [], 0 while n >= 2: if arr[n-1] - arr[n-2] <= 1: p.append(arr[n-2]) n -= 2 else: n -= 1 for i in range(0, len(p)-1, 2): res += p[i] * p[i+1] print(res) ```
output
1
96,541
23
193,083
Provide tags and a correct Python 3 solution for this coding contest problem. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li. Ilya decided to make a rectangle from the sti...
instruction
0
96,542
23
193,084
Tags: greedy, math, sortings Correct Solution: ``` n=int(input()) l=list(map(int,input().split())) l=sorted(l) l=l[::-1] k=0 b=-1 for i in range(n-1) : if l[i]==l[i+1] and b==-1 : b=l[i] l[i+1]=-1 if l[i]==l[i+1] and b!=-1 : k+=b*l[i] b=-1 l[i+1]=-1 if l[i]==l[i+1]+1...
output
1
96,542
23
193,085
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,543
23
193,086
Yes
output
1
96,543
23
193,087
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,544
23
193,088
Yes
output
1
96,544
23
193,089
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,545
23
193,090
Yes
output
1
96,545
23
193,091
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,546
23
193,092
Yes
output
1
96,546
23
193,093
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,547
23
193,094
No
output
1
96,547
23
193,095
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,548
23
193,096
No
output
1
96,548
23
193,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,549
23
193,098
No
output
1
96,549
23
193,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. In the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li....
instruction
0
96,550
23
193,100
No
output
1
96,550
23
193,101
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,858
23
193,716
"Correct Solution: ``` d=[[-3,0],[-2,0],[-1,0],[1,0],[2,0],[3,0],[0,-3],[0,-2],[0,-1],[0,1],[0,2],[0,3]] def f(x,y,a): a[y][x]='0' for dx,dy in d: if 0<=x+dx<8 and 0<=y+dy<8 and a[y+dy][x+dx]=='1':f(x+dx,y+dy,a) return a for i in range(int(input())): print('Data %d:'%(i+1)) input() a=[l...
output
1
96,858
23
193,717
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,859
23
193,718
"Correct Solution: ``` def paint(f_inp, x, y): if f_inp[y][x]: f_inp[y][x] = False if f_inp[y][x - 1]: f_inp = paint(f_inp, x - 1, y) if f_inp[y][x - 2]: f_inp = paint(f_inp, x - 2, y) if f_inp[y][x - 3]: f_inp = paint(f_inp, x - 3, y) if f...
output
1
96,859
23
193,719
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,860
23
193,720
"Correct Solution: ``` def print_table(t): for c in t: for r in c: print("{0:d}".format(r),end="") print("") def play(t,x,y): q = [[x,y]] while True: p = q.pop(0) x = p[0] y = p[1] t[y][x] = 0 for i in range(1,4): if x+i < 8:...
output
1
96,860
23
193,721
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,861
23
193,722
"Correct Solution: ``` from collections import deque import sys readline = sys.stdin.readline write = sys.stdout.write def solve(): N = int(readline()) dd = ((-1, 0), (0, -1), (1, 0), (0, 1)) L = 8 for i in range(N): readline() G = [list(map(int, readline().strip())) for i in range(L)] ...
output
1
96,861
23
193,723
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,862
23
193,724
"Correct Solution: ``` def e(x,y): A[y][x]='0' for dx,dy in[[-3,0],[-2,0],[-1,0],[1,0],[2,0],[3,0],[0,-3],[0,-2],[0,-1],[0,1],[0,2],[0,3]]: if 0<=x+dx<8 and 0<=y+dy<8 and A[y+dy][x+dx]=='1':e(x+dx,y+dy) for i in range(int(input())): print(f'Data {i+1}:') input() A=[list(input())for _ in[0]*8] e(int(input())-1,...
output
1
96,862
23
193,725
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,863
23
193,726
"Correct Solution: ``` def e(x,y): A[y][x]='0' for d in range(-3,4): 0<=x+d<8 and A[y][x+d]=='1'and e(x+d,y) 0<=y+d<8 and A[y+d][x]=='1'and e(x,y+d) for i in range(int(input())): print(f'Data {i+1}:') input() A=[list(input())for _ in[0]*8] e(int(input())-1,int(input())-1) for r in A:print(*r,sep='') ```
output
1
96,863
23
193,727
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,864
23
193,728
"Correct Solution: ``` def f(x,y,a): a[y][x]='0' for dx,dy in [[-3,0],[-2,0],[-1,0],[1,0],[2,0],[3,0],[0,-3],[0,-2],[0,-1],[0,1],[0,2],[0,3]]: if 0<=x+dx<8 and 0<=y+dy<8 and a[y+dy][x+dx]=='1':f(x+dx,y+dy,a) return a for i in range(int(input())): print('Data %d:'%(i+1)) input() a=[list(...
output
1
96,864
23
193,729
Provide a correct Python 3 solution for this coding contest problem. There is a plane like Figure 1 with 8 vertical and 8 horizontal squares. There are several bombs on that plane. Figure 2 shows an example (● = bomb). | □ | □ | □ | □ | □ | □ | □ | □ --- | --- | --- | --- | --- | --- | --- | --- □ | □ | □ | □ | □ | □...
instruction
0
96,865
23
193,730
"Correct Solution: ``` def bumb(i, j) : global M M[j][i] = 0 for p in range(-3, 4) : if 0 <= i+p < 8 : if M[j][i+p] == '1' : bumb(i+p, j) if 0 <= j+p < 8 : if M[j+p][i] == '1' : bumb(i, j+p) n = int(input()) for i in range(n) : M =...
output
1
96,865
23
193,731
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,903
23
193,806
"Correct Solution: ``` # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline def solve(): N = int(input()) if N == 0: exit() n = int(input()) true_Poly = [list(map(int, input().split())) for _ in range(n)] serach_Polys = [] for _ in range(N)...
output
1
96,903
23
193,807
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,904
23
193,808
"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
96,904
23
193,809
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,905
23
193,810
"Correct Solution: ``` from sys import exit, stderr, stdin input = stdin.readline # setrecursionlimit(10**7) def debug(var, name="hoge"): print(name +":" + str(type(var)) + " = " + repr(var), file=stderr) return def main(): while(1): N = int(input()) if N == 0: break l...
output
1
96,905
23
193,811
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,906
23
193,812
"Correct Solution: ``` ans_list = [] while True: n = int(input()) if not n: break xy = [] for i in range(n + 1): xy.append([]) m = int(input()) x, y = map(int, input().split()) for j in range(m - 1): a, b = map(int, input().split()) xy[i].a...
output
1
96,906
23
193,813
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,907
23
193,814
"Correct Solution: ``` # coding: utf-8 while 1: n=int(input()) if n==0: break data=[[] for i in range(n+1)] for i in range(n+1): m=int(input()) x,y=map(int,input().split()) for j in range(m-1): _x,_y=map(int,input().split()) data[i].append((abs(_x+...
output
1
96,907
23
193,815
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,908
23
193,816
"Correct Solution: ``` class Line: def __init__(self, n, points): self.n = n self.points = points def getDesc(self): desc1 = self.getDist(self.points[0], self.points[1]) faceDir = self.getDir(self.points[0], self.points[1]) for i in range(1, self.n - 1): newD...
output
1
96,908
23
193,817
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,909
23
193,818
"Correct Solution: ``` def check(a, b): for _ in range(4): if a == b: return True b = list(map(lambda x: [-x[1], x[0]], b)) return False def main(n): lines = [None] * n for i in range(n): m = int(input()) xy = [None] * m for j in range(m): x...
output
1
96,909
23
193,819
Provide a correct Python 3 solution for this coding contest problem. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line consists of several line segments parallel to x-axis or...
instruction
0
96,910
23
193,820
"Correct Solution: ``` # -*- coding: utf-8 -*- def main(): N = int(input()) while N: lines = [] for _ in range(N+1): tmp = [] M = int(input()) x0, y0 = map(int, input().split()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input...
output
1
96,910
23
193,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line...
instruction
0
96,911
23
193,822
Yes
output
1
96,911
23
193,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line...
instruction
0
96,912
23
193,824
Yes
output
1
96,912
23
193,825
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Multiple polygonal lines are given on the xy-plane. Given a list of polygonal lines and a template, you must find out polygonal lines which have the same shape as the template. A polygonal line...
instruction
0
96,913
23
193,826
Yes
output
1
96,913
23
193,827
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,917
23
193,834
"Correct Solution: ``` #!/usr/bin/env python # -*- coding: utf-8 -*- """ input: 3 0 0 2 0 1 1 1 -1 0 0 1 1 0 1 1 0 0 0 1 1 1 0 0 1 output: 1.0000000000 0.0000000000 0.5000000000 0.5000000000 0.5000000000 0.5000000000 """ import sys class Segment(object): __slots__ = ('source', 'target') def __init__(self,...
output
1
96,917
23
193,835
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,918
23
193,836
"Correct Solution: ``` # -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C&lang=jp """ import sys from sys import stdin input = stdin.readline class Point(object): epsilon = 1e-10 def __init__(self, x=0.0, y=0.0): if isinstance(x, tuple): self.x =...
output
1
96,918
23
193,837
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,919
23
193,838
"Correct Solution: ``` def cross(a: complex, b: complex) -> float: return float(a.real * b.imag - a.imag * b.real) def cross_point(p1: complex, p2: complex, p3: complex, p4: complex) -> complex: base = p4 - p3 hypo1 = p1 - p3 hypo2 = p2 - p3 d1 = abs(cross(base, hypo1)) / abs(base) d2 = abs(cr...
output
1
96,919
23
193,839
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,920
23
193,840
"Correct Solution: ``` EPS = 10**(-9) def is_equal(a,b): return abs(a-b) < EPS def norm(v,i=2): import math ret = 0 n = len(v) for j in range(n): ret += abs(v[j])**i return math.pow(ret,1/i) class Vector(list): """ ベクトルクラス 対応演算子 + : ベクトル和 - : ベクトル差 * : スカラー倍...
output
1
96,920
23
193,841
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,921
23
193,842
"Correct Solution: ``` EPS = 1e-4 #外積 def OuterProduct(one, two): tmp = one.conjugate() * two return tmp.imag #直線の交点,平行の場合はFを返す def Crosspoint(a, b, c, d): if abs(OuterProduct(b-a, d-c)) <= EPS: return False else: u = OuterProduct(c-a, d-a) / OuterProduct(b-a, d-c) return (1-u)*a + u*b n = int(input()) for...
output
1
96,921
23
193,843
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,922
23
193,844
"Correct Solution: ``` import math class Point: def __init__(self, x, y): self.x = x self.y = y def __add__(self, other): return Point(self.x + other.x, self.y + other.y) def __sub__(self, other): return Point(self.x - other.x, self.y - other.y) def __mul__(self, other):...
output
1
96,922
23
193,845
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,923
23
193,846
"Correct Solution: ``` from sys import stdin class Vector: def __init__(self, x=None, y=None): self.x = x self.y = y def __add__(self, other): return Vector(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector(self.x - other.x, self.y - other.y) ...
output
1
96,923
23
193,847
Provide a correct Python 3 solution for this coding contest problem. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 * -10000 ≤ xpi, ypi ≤ 10000 * p0 ≠ p1 and p2 ≠ p3. * The ...
instruction
0
96,924
23
193,848
"Correct Solution: ``` class Line: def __init__(self,p1,p2): if p1[1] < p2[1]:self.s=p2;self.e=p1 elif p1[1] > p2[1]:self.s=p1;self.e=p2 else: if p1[0] < p2[0]:self.s=p1;self.e=p2 else:self.s=p2;self.e=p1 def cross(a,b):return a[0]*b[1] - a[1]*b[0] def CrossPoint(l,m...
output
1
96,924
23
193,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 *...
instruction
0
96,925
23
193,850
Yes
output
1
96,925
23
193,851
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 *...
instruction
0
96,926
23
193,852
Yes
output
1
96,926
23
193,853
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 *...
instruction
0
96,927
23
193,854
Yes
output
1
96,927
23
193,855
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For given two segments s1 and s2, print the coordinate of the cross point of them. s1 is formed by end points p0 and p1, and s2 is formed by end points p2 and p3. Constraints * 1 ≤ q ≤ 1000 *...
instruction
0
96,928
23
193,856
Yes
output
1
96,928
23
193,857