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.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,028 | 23 | 94,056 |
Yes | output | 1 | 47,028 | 23 | 94,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,029 | 23 | 94,058 |
Yes | output | 1 | 47,029 | 23 | 94,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,030 | 23 | 94,060 |
Yes | output | 1 | 47,030 | 23 | 94,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,031 | 23 | 94,062 |
Yes | output | 1 | 47,031 | 23 | 94,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,032 | 23 | 94,064 |
No | output | 1 | 47,032 | 23 | 94,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,033 | 23 | 94,066 |
No | output | 1 | 47,033 | 23 | 94,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,034 | 23 | 94,068 |
No | output | 1 | 47,034 | 23 | 94,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is... | instruction | 0 | 47,035 | 23 | 94,070 |
No | output | 1 | 47,035 | 23 | 94,071 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n points on the plane, the i-th of which is at (x_i, y_i). Tokitsukaze wants to draw a strange rectangular area and pick all the points in the area.
The strange area is enclosed by three lines, x = l, y = a and x = r, as its left ... | instruction | 0 | 47,099 | 23 | 94,198 |
Tags: data structures, divide and conquer, sortings, two pointers
Correct Solution:
```
import sys
import copy
input = sys.stdin.readline
n=int(input())
P=[list(map(int,input().split())) for i in range(n)]
SET_X=set()
SET_Y=set()
for x,y in P:
SET_X.add(x)
SET_Y.add(y)
CX=sorted(SET_X)
CY=sorted(SET_Y)
LEN... | output | 1 | 47,099 | 23 | 94,199 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,285 | 23 | 94,570 |
Tags: binary search, number theory
Correct Solution:
```
def gcd(a, b):
if(a % b == 0):
return b
return gcd(b,a%b)
a , b, x, y = map(int,input().split())
t = gcd(x,y)
x ,y= x // t , y // t
k = min(a//x,b//y)
print(k * x,k*y)
``` | output | 1 | 47,285 | 23 | 94,571 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,286 | 23 | 94,572 |
Tags: binary search, number theory
Correct Solution:
```
# Python 3
from math import gcd
a, b, x, y = list(map(int, input().split()))
g = gcd(x, y)
x //= g
y //= g
k = min(a // x, b // y)
print(k * x, k * y)
``` | output | 1 | 47,286 | 23 | 94,573 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,287 | 23 | 94,574 |
Tags: binary search, number theory
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('... | output | 1 | 47,287 | 23 | 94,575 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,288 | 23 | 94,576 |
Tags: binary search, number theory
Correct Solution:
```
import sys
from collections import defaultdict as dd
from collections import deque
def eprint(*args):
print(*args, file=sys.stderr)
pl=1
from math import *
import copy
#sys.setrecursionlimit(10**6)
if pl:
input=sys.stdin.readline
def li():
return [int(x... | output | 1 | 47,288 | 23 | 94,577 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,289 | 23 | 94,578 |
Tags: binary search, number theory
Correct Solution:
```
import sys
import math
import bisect
def solve(a, b, x, y):
t1 = a // x
t2 = b // y
t = min(t1, t2)
return (t * x, t * y)
def main():
a, b, x, y = map(int, input().split())
g = math.gcd(x, y)
x //= g
y //= g
ans = solve(a, b,... | output | 1 | 47,289 | 23 | 94,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,290 | 23 | 94,580 |
Tags: binary search, number theory
Correct Solution:
```
from math import gcd
a, b, x, y = map(int, input().split())
x, y = x // gcd(x, y), y // gcd(x, y)
q = min(a // x, b // y)
print(x * q, y * q)
``` | output | 1 | 47,290 | 23 | 94,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,291 | 23 | 94,582 |
Tags: binary search, number theory
Correct Solution:
```
from fractions import gcd
a, b, x, y = map(int, input().split())
g = gcd(x, y)
x, y, = x // g, y // g
v = min(a // x, b // y)
print(v * x, v * y)
# Made By Mostafa_Khaled
``` | output | 1 | 47,291 | 23 | 94,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popu... | instruction | 0 | 47,292 | 23 | 94,584 |
Tags: binary search, number theory
Correct Solution:
```
from fractions import gcd
a,b,x,y = map(int, input().split(" "))
g = gcd(x,y)
x,y = x//g, y//g
xmax = a//x
ymax = b//y
res = min(xmax,ymax)
print("%d %d" % (res*x, res*y))
``` | output | 1 | 47,292 | 23 | 94,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,293 | 23 | 94,586 |
Yes | output | 1 | 47,293 | 23 | 94,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,294 | 23 | 94,588 |
Yes | output | 1 | 47,294 | 23 | 94,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,295 | 23 | 94,590 |
Yes | output | 1 | 47,295 | 23 | 94,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,296 | 23 | 94,592 |
Yes | output | 1 | 47,296 | 23 | 94,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,297 | 23 | 94,594 |
No | output | 1 | 47,297 | 23 | 94,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,298 | 23 | 94,596 |
No | output | 1 | 47,298 | 23 | 94,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,299 | 23 | 94,598 |
No | output | 1 | 47,299 | 23 | 94,599 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Reca company makes monitors, the most popular of their models is AB999 with the screen size a ร b centimeters. Because of some production peculiarities a screen parameters are integer numbers. R... | instruction | 0 | 47,300 | 23 | 94,600 |
No | output | 1 | 47,300 | 23 | 94,601 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,358 | 23 | 94,716 |
Tags: sortings
Correct Solution:
```
from collections import defaultdict
maps = defaultdict(int)
maps1 = defaultdict(int)
arr = []
distinct_count = distinct_count1 = 0
for i in range(8):
temp = list(map(int, input().split()))
if temp[0] not in maps:
distinct_count += 1
if temp[1] not in maps1:
... | output | 1 | 47,358 | 23 | 94,717 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,359 | 23 | 94,718 |
Tags: sortings
Correct Solution:
```
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
arr_point = []
for i in range(8):
tmp_x, tmp_y = map(int, input().split())
arr_point.append(Point(tmp_x, tmp_y))
for i in range(8):
for j in range(i+1, 8):
if (arr_point[i].x ... | output | 1 | 47,359 | 23 | 94,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,360 | 23 | 94,720 |
Tags: sortings
Correct Solution:
```
x, y = [], []
xx, yy = {}, {}
for i in range(8):
a, b = map(int, input().split())
x.append(a)
y.append(b)
if a not in xx:
xx[a] = [b]
else:
xx[a].append(b)
if b not in yy:
yy[b] = [a]
else:
yy[b].append(a)
if len(set(x)) !... | output | 1 | 47,360 | 23 | 94,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,361 | 23 | 94,722 |
Tags: sortings
Correct Solution:
```
def Slove():
A=sorted(tuple(map(int, input().split())) for _ in range(8))
if(A[0][0] == A[1][0]==A[2][0]
< A[3][0]==A[4][0]
< A[5][0]==A[6][0]==A[7][0]
and A[0][1]==A[3][1]==A[5][1]
< A[1][1]==A[6][1]
< A[2][1]==A[4][1]==A[7]... | output | 1 | 47,361 | 23 | 94,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,362 | 23 | 94,724 |
Tags: sortings
Correct Solution:
```
lines = []
for i in range(0, 8):
lines.append(list(map(int, input().split())))
lines = sorted(lines)
countA = [lines[0][0]]
countB = [lines[0][1]]
for i in range(1, len(lines)):
if lines[i][0] != lines[i-1][0]:
countA.append(lines[i][0])
if lines[i][1] not in countB:
co... | output | 1 | 47,362 | 23 | 94,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,363 | 23 | 94,726 |
Tags: sortings
Correct Solution:
```
if __name__ == "__main__":
point_set = []
for i in range(8):
x, y = map(int, input().split())
point_set.append((x, y))
point_set.sort()
if point_set[0][0] == point_set[1][0] == point_set[2][0]\
and point_set[3][0] == point_set[4][0]\
... | output | 1 | 47,363 | 23 | 94,727 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,364 | 23 | 94,728 |
Tags: sortings
Correct Solution:
```
import sys
fin = sys.stdin
points = []
for i in range(8):
x, y = map(int, fin.readline().split())
points += [(x, y)]
def CheckPoints(p):
if not p[0][0] == p[1][0] == p[2][0]:
return False
x1 = p[0][0]
if not p[3][0] == p[4][0]:
return False
x2 = p[3][0]
if n... | output | 1 | 47,364 | 23 | 94,729 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, excep... | instruction | 0 | 47,365 | 23 | 94,730 |
Tags: sortings
Correct Solution:
```
d = [{}, {}]
t = []
for i in range(8):
x, y = [int(x) for x in input().split()]
if [x, y] in t:
print("ugly")
exit()
t.append([x, y])
if x not in d[0]:
d[0][x] = 1
else:
d[0][x] += 1
if y not in d[1]:
d[1][y] = 1
e... | output | 1 | 47,365 | 23 | 94,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,366 | 23 | 94,732 |
Yes | output | 1 | 47,366 | 23 | 94,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,367 | 23 | 94,734 |
Yes | output | 1 | 47,367 | 23 | 94,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,368 | 23 | 94,736 |
Yes | output | 1 | 47,368 | 23 | 94,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,369 | 23 | 94,738 |
Yes | output | 1 | 47,369 | 23 | 94,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,370 | 23 | 94,740 |
No | output | 1 | 47,370 | 23 | 94,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,371 | 23 | 94,742 |
No | output | 1 | 47,371 | 23 | 94,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,372 | 23 | 94,744 |
No | output | 1 | 47,372 | 23 | 94,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three di... | instruction | 0 | 47,373 | 23 | 94,746 |
No | output | 1 | 47,373 | 23 | 94,747 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,904 | 23 | 95,808 |
"Correct Solution:
```
import math
def koch(d,x1,y1,x2,y2):
if d == 0:
return
xs = (2*x1+x2)/3
ys = (2*y1+y2)/3
xt = (x1+2*x2)/3
yt = (y1+2*y2)/3
xu = (xt-xs)*math.cos(math.pi/3) - (yt-ys)*math.sin(math.pi/3) + xs
yu = (xt-xs)*math.sin(math.pi/3) + (yt-ys)*math.cos(math.pi/3) + ys... | output | 1 | 47,904 | 23 | 95,809 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,905 | 23 | 95,810 |
"Correct Solution:
```
import math
class Point:
def __init__(self,x,y):
self.x=x
self.y=y
def __str__(self):
return str(self.x)+' '+str(self.y)
def koch(n,a,b):
if n==0: return
s=Point(0,0)
t=Point(0,0)
u=Point(0,0)
th=math.pi*60/180
s.x=(2*a.x+1*b.x)/3
s.y=(2*a.y+1*b.y)/3
t.x=(1*a.x+2*b.x)/3
t.y=(1*... | output | 1 | 47,905 | 23 | 95,811 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,906 | 23 | 95,812 |
"Correct Solution:
```
import math
def show_vertex(x,y):
print("%.8f %.8f" % (x,y))
def koch(x0,y0,x1,y1,n):
if n == 0:
show_vertex(x0,y0)
else:
c1 = [(2*x0+x1)/3,(2*y0+y1)/3]
c3 = [(x0+2*x1)/3,(y0+2*y1)/3]
c2 = [(3*(x1+x0) -(y1-y0)*math.sqrt(3))/6,((x1-x0)*math.sqrt(3)+3*(y1... | output | 1 | 47,906 | 23 | 95,813 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,907 | 23 | 95,814 |
"Correct Solution:
```
import math
def koch(start, end, n, r):
if n > 0:
#้ไธญใฎ้ ็นใa, b, cใจใใ
a = [(start[0]*2 + end[0]*1) / 3, (start[1]*2 + end[1]*1) / 3]
c = [(start[0]*1 + end[0]*2) / 3, (start[1]*1 + end[1]*2) / 3]
x = c[0] - a[0]
y = c[1] - a[1]
b = [x * math.co... | output | 1 | 47,907 | 23 | 95,815 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,908 | 23 | 95,816 |
"Correct Solution:
```
import math
def kochCurve(d, p1, p2):
if d <= 0:
return
s = [(2.0*p1[0]+1.0*p2[0])/3.0, (2.0*p1[1]+1.0*p2[1])/3.0]
t = [(1.0*p1[0]+2.0*p2[0])/3.0, (1.0*p1[1]+2.0*p2[1])/3.0]
u = [(t[0]-s[0])*math.cos(math.radians(60))-(t[1]-s[1])*math.sin(math.radians(60))+s[0], (t[0]-s[0]... | output | 1 | 47,908 | 23 | 95,817 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,909 | 23 | 95,818 |
"Correct Solution:
```
d = int(input().rstrip())
import math
sin60 = math.sin(math.radians(60))
cos60 = math.cos(math.radians(60))
def make_koch(d, p1, p2):
s = ((p1[0]*2 + p2[0]) / 3, (p1[1]*2 + p2[1]) / 3)
t = ((p1[0] + p2[0]*2) / 3, (p1[1] + p2[1]*2) / 3)
u = ((t[0] - s[0]) * cos60 - (t[1] - s[1])*sin... | output | 1 | 47,909 | 23 | 95,819 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,910 | 23 | 95,820 |
"Correct Solution:
```
from math import*
a=(0,0)
b=(100,0)
def koch(n,ax,ay,bx,by):
if n==0:
return 0
th=pi/3
sx=(2*ax+bx)/3
sy=(2*ay+by)/3
tx=(ax+2*bx)/3
ty=(ay+2*by)/3
ux=(tx-sx)*cos(th)-(ty-sy)*sin(th)+sx
uy=(tx-sx)*sin(th)+(ty-sy)*cos(th)+sy
koch(n-1,ax,ay,sx,sy)
... | output | 1 | 47,910 | 23 | 95,821 |
Provide a correct Python 3 solution for this coding contest problem.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the following algorithm:
* Divide a given segment (p1, p2) into ... | instruction | 0 | 47,911 | 23 | 95,822 |
"Correct Solution:
```
import math
def kochCurve(p1, p2, n):
if n == 0:
print(p2[0], p2[1])
return
v = [(p2[0]-p1[0])/3, (p2[1]-p1[1])/3]
s = [p1[0]+v[0], p1[1]+v[1]]
t = [s[0]+v[0], s[1]+v[1]]
theta = math.atan2(v[1], v[0]) + math.pi/2
a = math.sqrt((t[0]-s[0])**2+(t[1]-s[1])**2)
h = 3**(1/2)... | output | 1 | 47,911 | 23 | 95,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.
The Koch curve is well known as a kind of fractals.
You can draw a Koch curve in the follo... | instruction | 0 | 47,912 | 23 | 95,824 |
Yes | output | 1 | 47,912 | 23 | 95,825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.