message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,707
3
191,414
Tags: dp, geometry, greedy, implementation Correct Solution: ``` def glen(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5 xa, ya, xb, yb, xt, yt = map(int,input().split()) n = int(input()) x = [0]*n y = [0]*n for i in range(n): x[i], y[i] = map(int,input().split()) inf = 10**10 afmin = [0, 0] asmin = [0, 0] f...
output
1
95,707
3
191,415
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,708
3
191,416
Tags: dp, geometry, greedy, implementation Correct Solution: ``` read = lambda : map(int, input().split()) def dis(x1, y1, x2, y2): return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 ax, ay, bx, by, tx, ty = read() n = int(input()) a, b = [], [] sum = 0 for i in range(n): x, y = read() dist = dis(tx, ty, x, y...
output
1
95,708
3
191,417
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,709
3
191,418
Tags: dp, geometry, greedy, implementation Correct Solution: ``` import math def dist(x1, y1, x2, y2): res = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) res = math.sqrt(res) return res ax, ay, bx, by, tx, ty = list(map(int, input().split())) n = int(input()) ans = 0 bottles = [(0, 0) for i in range(n)...
output
1
95,709
3
191,419
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,710
3
191,420
Tags: dp, geometry, greedy, implementation Correct Solution: ``` import math ax,ay,bx,by,tx,ty = map(float,input().split(" ")) n = int(input()) dis = 0.0 a1Dis = 100000000000.0**2 a2Dis = 100000000000.0**2 b1Dis = 100000000000.0**2 b2Dis = 100000000000.0**2 a1=0 b1=0 rec=0.0 for i in range(n): x,y = map(float,input...
output
1
95,710
3
191,421
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,711
3
191,422
Tags: dp, geometry, greedy, implementation Correct Solution: ``` import math def getdist(x,y,a,c): return math.sqrt((x-a)**2+(c-y)**2) def main(n,points,start): x1,y1=start[0],start[1] x2,y2=start[2],start[3] x3,y3=start[4],start[5] dist=[] dist_p1=[] dist_p2=[] for i in range(len(points)): ...
output
1
95,711
3
191,423
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,712
3
191,424
Tags: dp, geometry, greedy, implementation Correct Solution: ``` import math import sys def dist(u, v): return math.hypot(u[0] - v[0], u[1] - v[1]) ax, ay, bx, by, tx, ty = [int(x) for x in input().split()] a, b, t = (ax, ay), (bx, by), (tx, ty) n = int(input()) bottles = [tuple(int(x) for x in line.split()) for...
output
1
95,712
3
191,425
Provide tags and a correct Python 3 solution for this coding contest problem. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as coordinate plane. There are n bottles on the gr...
instruction
0
95,713
3
191,426
Tags: dp, geometry, greedy, implementation Correct Solution: ``` ax,ay,bx,by,rx,ry=map(int,input().split()) a,b=[],[] from math import sqrt n=int(input()) #print(n) for i in range(n): m,rn=map(int,input().split()) a.append(m) b.append(rn) #print(a,b) ra,rb=[],[] ans=0 for i in range(n): #print('i m i') ...
output
1
95,713
3
191,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,714
3
191,428
Yes
output
1
95,714
3
191,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,715
3
191,430
Yes
output
1
95,715
3
191,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,716
3
191,432
Yes
output
1
95,716
3
191,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,717
3
191,434
Yes
output
1
95,717
3
191,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,718
3
191,436
No
output
1
95,718
3
191,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,719
3
191,438
No
output
1
95,719
3
191,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,720
3
191,440
No
output
1
95,720
3
191,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin. We can think Central Perk as ...
instruction
0
95,721
3
191,442
No
output
1
95,721
3
191,443
Provide tags and a correct Python 3 solution for this coding contest problem. n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point ...
instruction
0
95,780
3
191,560
Tags: binary search, implementation, math Correct Solution: ``` import math leftpeople = set() rightpeople = set() n, vl = map(int, input().split()) def leftinterval(x0, v0, t): if x0 / v0 <= t: return (0, 10**6) if x0 / (vl + v0) > t: return (-1, -2) leftbound = x0 rightbound = (vl * ...
output
1
95,780
3
191,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his ma...
instruction
0
95,781
3
191,562
No
output
1
95,781
3
191,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his ma...
instruction
0
95,782
3
191,564
No
output
1
95,782
3
191,565
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his ma...
instruction
0
95,783
3
191,566
No
output
1
95,783
3
191,567
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his ma...
instruction
0
95,784
3
191,568
No
output
1
95,784
3
191,569
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,990
3
191,980
Yes
output
1
95,990
3
191,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,991
3
191,982
Yes
output
1
95,991
3
191,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,992
3
191,984
Yes
output
1
95,992
3
191,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,993
3
191,986
Yes
output
1
95,993
3
191,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,994
3
191,988
No
output
1
95,994
3
191,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,995
3
191,990
No
output
1
95,995
3
191,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,996
3
191,992
No
output
1
95,996
3
191,993
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Dr .: Peter, I've finally done it. Peter: See you again? What kind of silly invention is this time? Dr .: I finally came up with a revolutionary way to process mathematical formulas on a compu...
instruction
0
95,997
3
191,994
No
output
1
95,997
3
191,995
Provide a correct Python 3 solution for this coding contest problem. In the year 30XX, an expedition team reached a planet and found a warp machine suggesting the existence of a mysterious supercivilization. When you go through one of its entrance gates, you can instantaneously move to the exit irrespective of how far...
instruction
0
96,014
3
192,028
"Correct Solution: ``` N = int(input()) s = input() t = input() D = {t[-1]: 1} for i in range(N-2, 0, -1): si = s[i]; ti = t[i] v = D.get(si, 0) D[ti] = (D.get(ti, 0) + v) % (10**9+7) print(D.get(s[0], 0)) ```
output
1
96,014
3
192,029
Provide a correct Python 3 solution for this coding contest problem. In the year 30XX, an expedition team reached a planet and found a warp machine suggesting the existence of a mysterious supercivilization. When you go through one of its entrance gates, you can instantaneously move to the exit irrespective of how far...
instruction
0
96,015
3
192,030
"Correct Solution: ``` from collections import defaultdict MOD = 1000000007 n = int(input()) s = input() t = input() dic = defaultdict(int) dic[s[0]] = 1 for cs, ct in zip(s[1:n-1], t[1:n-1]): dic[cs] += dic[ct] dic[cs] %= MOD print(dic[t[-1]]) ```
output
1
96,015
3
192,031
Provide a correct Python 3 solution for this coding contest problem. An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon with 7 carbons. It has nine isomers. The str...
instruction
0
96,016
3
192,032
"Correct Solution: ``` # AOJ 1011: Finding the Largest Carbon Compound Give... # Python3 2018.7.4 bal4u a = [0]*32 a[1], a[2] = 1, 2 for i in range(3, 31): a[i] = 3*a[i-2] + 2 while True: try: i = int(input()) except: break print(a[i]) ```
output
1
96,016
3
192,033
Provide a correct Python 3 solution for this coding contest problem. After long studying how embryos of organisms become asymmetric during their development, Dr. Podboq, a famous biologist, has reached his new hypothesis. Dr. Podboq is now preparing a poster for the coming academic conference, which shows a tree repre...
instruction
0
96,017
3
192,034
"Correct Solution: ``` import sys readline = sys.stdin.readline write = sys.stdout.write def parse(S): S = S + "$" cur = 0 mp = {"01": 0} sp = {"01": {0}} sv = {"01": (0, 1)} lbl = 1 fmt = "0{}{}1".format def comp(left, right): lcs, lb = left rcs, rb = right a0, b...
output
1
96,017
3
192,035
Provide a correct Python 3 solution for this coding contest problem. A dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened. You are working at a manufacturer of dial locks. Your job is to verify that every manufactured...
instruction
0
96,034
3
192,068
"Correct Solution: ``` def solve(): def bfs(k): start, goal = file_input.readline().split() if start == goal: return 0 start = map(int, start) goal = map(int, goal) diff = [(g - s) % 10 for g, s in zip(goal, start)] q = [diff] ...
output
1
96,034
3
192,069
Provide a correct Python 3 solution for this coding contest problem. A dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened. You are working at a manufacturer of dial locks. Your job is to verify that every manufactured...
instruction
0
96,035
3
192,070
"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**13 mod = 10**9+7 dd = [(-1,0),(0,1),(1,0),(0,-1)] ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int...
output
1
96,035
3
192,071
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A dial lock is a kind of lock which has some dials with printed numbers. It has a special sequence of numbers, namely an unlocking sequence, to be opened. You are working at a manufacturer of d...
instruction
0
96,036
3
192,072
No
output
1
96,036
3
192,073
Provide a correct Python 3 solution for this coding contest problem. The trafic on the Internet is increasing these days due to smartphones. The wireless carriers have to enhance their network infrastructure. The network of a wireless carrier consists of a number of base stations and lines. Each line connects two bas...
instruction
0
96,037
3
192,074
"Correct Solution: ``` import collections class MyList(list): def __init__(self, x=[]): list.__init__(self, x) def __iadd__(self, A): ret = MyList() for a, b in zip(self, A): ret.append(a + b) return ret def __isub__(self, A): ret = MyList() fo...
output
1
96,037
3
192,075
Provide a correct Python 3 solution for this coding contest problem. The trafic on the Internet is increasing these days due to smartphones. The wireless carriers have to enhance their network infrastructure. The network of a wireless carrier consists of a number of base stations and lines. Each line connects two bas...
instruction
0
96,038
3
192,076
"Correct Solution: ``` import collections class MyList(list): def __init__(self, x=[]): list.__init__(self, x) def __iadd__(self, A): return MyList([a + b for a, b in zip(self, A)]) def __isub__(self, A): return MyList([a - b for a, b in zip(self, A)]) def __gt__(self, A): ...
output
1
96,038
3
192,077
Provide a correct Python 3 solution for this coding contest problem. The trafic on the Internet is increasing these days due to smartphones. The wireless carriers have to enhance their network infrastructure. The network of a wireless carrier consists of a number of base stations and lines. Each line connects two bas...
instruction
0
96,039
3
192,078
"Correct Solution: ``` import collections def plus_list(A, B): assert(len(A) == len(B)) return [a + b for a, b in zip(A, B)] def minus_list(A, B): assert(len(A) == len(B)) return [a - b for a, b in zip(A, B)] def gt_list(A, B): assert(len(A) == len(B)) for a, b in zip(A, B): if a !...
output
1
96,039
3
192,079
Provide a correct Python 3 solution for this coding contest problem. The trafic on the Internet is increasing these days due to smartphones. The wireless carriers have to enhance their network infrastructure. The network of a wireless carrier consists of a number of base stations and lines. Each line connects two bas...
instruction
0
96,040
3
192,080
"Correct Solution: ``` import sys readline = sys.stdin.readline write = sys.stdout.write from string import digits from collections import deque class Dinic: def __init__(self, N): self.N = N self.G = [[] for i in range(N)] def add_edge(self, fr, to, cap): forward = [to, cap, None] ...
output
1
96,040
3
192,081
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,410
3
192,820
Yes
output
1
96,410
3
192,821
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,411
3
192,822
Yes
output
1
96,411
3
192,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,412
3
192,824
No
output
1
96,412
3
192,825
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another s...
instruction
0
96,414
3
192,828
No
output
1
96,414
3
192,829
Provide tags and a correct Python 3 solution for this coding contest problem. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to make the balloons ready! There are n balloons (in...
instruction
0
96,416
3
192,832
Tags: constructive algorithms Correct Solution: ``` n = 402 print (n) print (0, 1000000) for i in range(1, n-1): print (i * 1000, n-i) print (1000000, 1000000) ```
output
1
96,416
3
192,833
Provide tags and a correct Python 3 solution for this coding contest problem. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to make the balloons ready! There are n balloons (in...
instruction
0
96,417
3
192,834
Tags: constructive algorithms Correct Solution: ``` print(302) print("0 1000000") coord, rad = 17321*2, 300 for i in range(300): print(coord, rad) coord, rad = coord+600, rad-1 print("1000000 1000000") ```
output
1
96,417
3
192,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to mak...
instruction
0
96,418
3
192,836
No
output
1
96,418
3
192,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to mak...
instruction
0
96,419
3
192,838
No
output
1
96,419
3
192,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to mak...
instruction
0
96,420
3
192,840
No
output
1
96,420
3
192,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Martha β€” as a professional problemsetter β€” proposed a problem for a world-class contest. This is the problem statement: Tomorrow is Nadia's birthday, and Bardia (her brother) is assigned to mak...
instruction
0
96,421
3
192,842
No
output
1
96,421
3
192,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types ...
instruction
0
96,731
3
193,462
No
output
1
96,731
3
193,463