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. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,087
3
160,174
Tags: data structures, implementation Correct Solution: ``` import sys input=sys.stdin.readline def main(): d={'N':(0,1),'S':(0,-1),'E':(1,0),'W':(-1,0)} t=int(input()) for _ in range(t): S=input().strip() ans=0 roads=set() p=[0,0] for s in S: x,y=p ...
output
1
80,087
3
160,175
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,088
3
160,176
Tags: data structures, implementation Correct Solution: ``` def solve(): s = input() start = [0,0] visited = set() moveMap = { 'N' : [-1, 0], 'S' : [1, 0], 'W' : [0, -1], 'E' : [0, 1] } counter = 0 for i in s: move = [ a + b for a, b in zip(start,...
output
1
80,088
3
160,177
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,089
3
160,178
Tags: data structures, implementation Correct Solution: ``` from sys import stdin input=stdin.readline for _ in range(int(input())): x=y=0;d={};ans=0 for i in input().rstrip('\n'): x1=x y1=y if i=='N':y+=1 elif i=='S':y-=1 elif i=='E':x+=1 else:x-=1 if (x,y,x1,y1) in d or (x1,y1,x,y) in d:ans+=1 else:...
output
1
80,089
3
160,179
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,090
3
160,180
Tags: data structures, implementation Correct Solution: ``` # t=int(input()) # # # for _ in range(t): # s=input() # lst=set() # tt=0 # s1="" # x,y=0,0 # if(len(set(s))==1): # print(5*len(s)) # else: # for i in s: # if(i=="N"): # x1=x # ...
output
1
80,090
3
160,181
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,091
3
160,182
Tags: data structures, implementation Correct Solution: ``` for _ in range(int(input())): x,y = 0,0 t = 0 myset = set() directions = input() for d in directions: x2,y2 = x,y if d=='N': y2+=1 elif d=='S': y2-=1 elif d=='E': x2+=...
output
1
80,091
3
160,183
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,092
3
160,184
Tags: data structures, implementation Correct Solution: ``` def resolve(x,y): num = 100000 return x + y * num t = int(input()) for i in range(t): s = input() a = set() b = set() x = 0 y = 0 ans = 0 for i in s: if i == "N": x,y = x,y+1 if resolve(x,y) ...
output
1
80,092
3
160,185
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,093
3
160,186
Tags: data structures, implementation Correct Solution: ``` def reverse(char): if char == "N": return "S" if char == "S": return "N" if char == "E": return "W" if char == "W": return "E" def alternate(start_x, start_y, char): if char == "N": return (start_x,...
output
1
80,093
3
160,187
Provide tags and a correct Python 3 solution for this coding contest problem. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respectively). It is known that if he moves along a ...
instruction
0
80,094
3
160,188
Tags: data structures, implementation Correct Solution: ``` def skier(s): ans = 0 paths = set() x = y = 0 for d in s: source = '%s-%s' % (x, y) if d == 'N': y += 1 elif d == 'S': y -= 1 elif d == 'W': x -= 1 elif d == 'E': ...
output
1
80,094
3
160,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,095
3
160,190
Yes
output
1
80,095
3
160,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,096
3
160,192
Yes
output
1
80,096
3
160,193
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,097
3
160,194
Yes
output
1
80,097
3
160,195
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,098
3
160,196
Yes
output
1
80,098
3
160,197
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,099
3
160,198
No
output
1
80,099
3
160,199
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,100
3
160,200
No
output
1
80,100
3
160,201
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,101
3
160,202
No
output
1
80,101
3
160,203
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to 1 meter movement in the south, north, west or east direction respec...
instruction
0
80,102
3
160,204
No
output
1
80,102
3
160,205
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. I...
instruction
0
80,197
3
160,394
No
output
1
80,197
3
160,395
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. I...
instruction
0
80,198
3
160,396
No
output
1
80,198
3
160,397
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. I...
instruction
0
80,199
3
160,398
No
output
1
80,199
3
160,399
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. I...
instruction
0
80,200
3
160,400
No
output
1
80,200
3
160,401
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,201
3
160,402
Tags: math, ternary search Correct Solution: ``` n = int(input()) a, b, c = map(int, input().split()) s = a+b+c if(s == 0): print(0, 0, 0) else: print(n * a / s, n * b / s, n * c / s) ```
output
1
80,201
3
160,403
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,202
3
160,404
Tags: math, ternary search Correct Solution: ``` def gribnye(s, a, b, c): if a == b == c == s == 0: return [0.0] elif a == b == c == 0 and s != 0: return 0, 0, 0 a1 = a * s / (a + b + c) b1 = b * s / (a + b + c) c1 = c * s / (a + b + c) return a1, b1, c1 S = int(input()) A, B, ...
output
1
80,202
3
160,405
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,203
3
160,406
Tags: math, ternary search Correct Solution: ``` from sys import stdin, stdout s = int(stdin.readline()) a, b, c = map(int, stdin.readline().split()) E = 10 ** (-7) x, y, z = s / 3, s / 3, s / 3 ans = 1 def power(v, n): cnt = 1 while n: if n % 2: cnt *= v n >>= 1 ...
output
1
80,203
3
160,407
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,204
3
160,408
Tags: math, ternary search Correct Solution: ``` s = float(input()) a, b, c = map(float, input().split()) if (a == b and b == c and c == 0): print('0 0', end = " ") print(s) else: print(a * s / (a + b + c), end = " ") print(b * s / (a + b + c), end = " ") print(c * s / (a + b + c)) ```
output
1
80,204
3
160,409
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,205
3
160,410
Tags: math, ternary search Correct Solution: ``` sa=int(input()) a, b, c=map(int, input().split(' ')) if a==0 and b==0 and c==0: print(0, 0, 0) else: x=(a*sa/(a+b+c)) y=(b*sa/(a+b+c)) z=(c*sa/(a+b+c)) print(x, y, z) ```
output
1
80,205
3
160,411
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,206
3
160,412
Tags: math, ternary search Correct Solution: ``` a=int(input()) b=list(map(int,input().split())) if sum(b)==0:print(' '.join([str(a/3)]*3)) else:print(' '.join(map(str,map(lambda x:a*x/sum(b),b)))) ```
output
1
80,206
3
160,413
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,207
3
160,414
Tags: math, ternary search Correct Solution: ``` S = int(input()) v = [int(x) for x in input().strip().split()] zeroes = v.count(0) total = sum(v) ans = [] if zeroes == 0: ans = [S * v[i] / total for i in range(3)] elif zeroes == 1: for i in range(3): if v[i] == 0: total -= v[i] for i in...
output
1
80,207
3
160,415
Provide tags and a correct Python 3 solution for this coding contest problem. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the ce...
instruction
0
80,208
3
160,416
Tags: math, ternary search Correct Solution: ``` def count(x1, y1, z1, x2, y2, z2): if x2 == 0 and a != 0 or y2 == 0 and b != 0 or z2 == 0 and c != 0: return False if x2 == 0: x2 = 1 if y2 == 0: y2 = 1 if z2 == 0: z2 = 1 return (x1 / x2) ** a * (y1 / y2) ** b * (z1 / ...
output
1
80,208
3
160,417
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,209
3
160,418
Yes
output
1
80,209
3
160,419
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,210
3
160,420
Yes
output
1
80,210
3
160,421
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,211
3
160,422
Yes
output
1
80,211
3
160,423
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,212
3
160,424
Yes
output
1
80,212
3
160,425
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,213
3
160,426
No
output
1
80,213
3
160,427
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,214
3
160,428
No
output
1
80,214
3
160,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,215
3
160,430
No
output
1
80,215
3
160,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this...
instruction
0
80,216
3
160,432
No
output
1
80,216
3
160,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,411
3
160,822
Yes
output
1
80,411
3
160,823
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,412
3
160,824
Yes
output
1
80,412
3
160,825
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,413
3
160,826
Yes
output
1
80,413
3
160,827
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,414
3
160,828
Yes
output
1
80,414
3
160,829
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,415
3
160,830
Yes
output
1
80,415
3
160,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,416
3
160,832
No
output
1
80,416
3
160,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,417
3
160,834
No
output
1
80,417
3
160,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,418
3
160,836
No
output
1
80,418
3
160,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably)...
instruction
0
80,419
3
160,838
No
output
1
80,419
3
160,839
Provide tags and a correct Python 3 solution for this coding contest problem. At first, there was a legend related to the name of the problem, but now it's just a formal statement. You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such an integer point x on OX axis that f_k(x) is min...
instruction
0
80,887
3
161,774
Tags: binary search, brute force, greedy Correct Solution: ``` # -*- coding: utf-8 -*- # @Date : 2019-06-06 09:38:34 # @Author : raj lath (oorja.halt@gmail.com) # @Link : link # @Version : 1.0.0 import sys sys.setrecursionlimit(10**5+1) inf = int(10 ** 20) max_val = inf min_val = -inf RW = lambda : sy...
output
1
80,887
3
161,775
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. At first, there was a legend related to the name of the problem, but now it's just a formal statement. You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such a...
instruction
0
80,894
3
161,788
Yes
output
1
80,894
3
161,789
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. At first, there was a legend related to the name of the problem, but now it's just a formal statement. You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such a...
instruction
0
80,895
3
161,790
Yes
output
1
80,895
3
161,791
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. At first, there was a legend related to the name of the problem, but now it's just a formal statement. You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such a...
instruction
0
80,898
3
161,796
No
output
1
80,898
3
161,797
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. At first, there was a legend related to the name of the problem, but now it's just a formal statement. You are given n points a_1, a_2, ..., a_n on the OX axis. Now you are asked to find such a...
instruction
0
80,900
3
161,800
No
output
1
80,900
3
161,801