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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have to handle a very complex water distribution system. The system consists of n junctions and m pipes, i-th pipe connects junctions x_i and y_i.
The only thing you can do is adjusting the... | instruction | 0 | 19,121 | 3 | 38,242 |
No | output | 1 | 19,121 | 3 | 38,243 |
Provide a correct Python 3 solution for this coding contest problem.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemi... | instruction | 0 | 19,327 | 3 | 38,654 |
"Correct Solution:
```
from collections import defaultdict
d = defaultdict(int)
def main(s, x=1):
f = True
l = 0
r = 0
index = float("INF")
res = 0
i = 0
lis = []
if x:
while i < len(s):
if s[i].isupper():
tmp = s[i]
i += 1
... | output | 1 | 19,327 | 3 | 38,655 |
Provide a correct Python 3 solution for this coding contest problem.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemi... | instruction | 0 | 19,328 | 3 | 38,656 |
"Correct Solution:
```
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1244
from typing import List, Dict
atomic_table: Dict[str, int] = {}
class NoAppearAtomicSymbol(Exception):
pass
class Token:
s: str
index = 0
def __init__(self, s: str):
self.s = s
@property
def c(s... | output | 1 | 19,328 | 3 | 38,657 |
Provide a correct Python 3 solution for this coding contest problem.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemi... | instruction | 0 | 19,329 | 3 | 38,658 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 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 | 19,329 | 3 | 38,659 |
Provide a correct Python 3 solution for this coding contest problem.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemi... | instruction | 0 | 19,330 | 3 | 38,660 |
"Correct Solution:
```
dic = {}
while 1:
line = input()
if line == "END_OF_FIRST_PART":
break
index,num = line.split()
dic[index] = int(num)
def solve(st):
#print(st)
if st == "0":
return False
ans = 0
kigou = ""
mass = 0
num = ""
i = 0
while i < len... | output | 1 | 19,330 | 3 | 38,661 |
Provide a correct Python 3 solution for this coding contest problem.
Your mission in this problem is to write a computer program that manipulates molecular for- mulae in virtual chemistry. As in real chemistry, each molecular formula represents a molecule consisting of one or more atoms. However, it may not have chemi... | instruction | 0 | 19,331 | 3 | 38,662 |
"Correct Solution:
```
# coding: utf-8
def mole():
global p
global s
num=term()
while len(s)>p:
if s[p]=='+':
p+=1
num+=term()
else:
break
return num
def term():
global p
global s
num=factor()
while len(s)>p:
if s[p]=='*':... | output | 1 | 19,331 | 3 | 38,663 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The full exploration sister is a very talented woman. Your sister can easily count the number of routes in a grid pattern if it is in the thousands. You and your exploration sister are now in a ... | instruction | 0 | 19,365 | 3 | 38,730 |
No | output | 1 | 19,365 | 3 | 38,731 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,421 | 3 | 38,842 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
n,h=map(int,input().split())
store=[]
for i in range(n):
a,b=map(int,input().split())
store.append(a)
store.append(b)
count=0
gap=[0]
fill=[0]
for i in range(1,2*n):
if(i%2==1):
fill.append(store[i]-store[i-1])
else:
... | output | 1 | 19,421 | 3 | 38,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,422 | 3 | 38,844 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
n,h=map(int,input().split())
arr=[]
for i in range(n):
x,y=map(int,input().split())
arr.append((x,y))
arr.sort()
arr1=[]
for i in range(n-1):
if(arr[i+1][0]>=arr[i][1]):
arr1.append(arr[i+1][0]-arr[i][1])
else:
arr1... | output | 1 | 19,422 | 3 | 38,845 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,423 | 3 | 38,846 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
n,h=map(int,input().split())
seg=[]
for i in range(n):
seg.append(list(map(int,input().split())))
seg.sort()
gap=[]
for i in range(1,n):
gap.append(seg[i][0]-seg[i-1][1])
pre=0
height=h
dis=0
di=[]
for i in range(n):
if(i==(n-1) and he... | output | 1 | 19,423 | 3 | 38,847 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,424 | 3 | 38,848 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
n, h = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for j in range(n)]
r = 0
cur_h = h
ans = 0
for l in range(n):
while r < n-1 and cur_h > A[r+1][0] - A[r][1]:
cur_h -= A[r+1][0] - A[r][1]
r += 1
... | output | 1 | 19,424 | 3 | 38,849 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,425 | 3 | 38,850 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
# Glider
n, h = map(int, input().split())
s = [0 for i in range(n)]
e = [0 for i in range(n)]
for i in range(n):
s[i], e[i] = map(int, input().split())
L = 0
R = 0
H = h
M = 0
while L < n:
while (R < n-1) and (H - (s[R+1] - e[R]) > 0):... | output | 1 | 19,425 | 3 | 38,851 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,426 | 3 | 38,852 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
n, h = map(int, input().split())
a, b = map(int, input().split())
L = [[a, b]]
M = [0]
N = [0]
sum = 0
f = True
for i in range(1, n):
a, b = map(int, input().split())
L.append([a, b])
M.append(a - L[-2][1])
sum += M[-1]
if sum ... | output | 1 | 19,426 | 3 | 38,853 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,427 | 3 | 38,854 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import *
def li():return [int(i) for i in input().rstrip('\n').split(' ')]
def st():return input().rstrip('\n')
def val():return int(input())
n, h = li()
l = []
for i in range(n):l.app... | output | 1 | 19,427 | 3 | 38,855 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is inside the plane, ready to start his flight at... | instruction | 0 | 19,428 | 3 | 38,856 |
Tags: binary search, data structures, two pointers
Correct Solution:
```
from copy import deepcopy
import itertools
from bisect import bisect_left
from bisect import bisect_right
import math
from collections import deque
from collections import Counter
def read():
return int(input())
def readmap():
return m... | output | 1 | 19,428 | 3 | 38,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,429 | 3 | 38,858 |
Yes | output | 1 | 19,429 | 3 | 38,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,430 | 3 | 38,860 |
Yes | output | 1 | 19,430 | 3 | 38,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,431 | 3 | 38,862 |
Yes | output | 1 | 19,431 | 3 | 38,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,432 | 3 | 38,864 |
Yes | output | 1 | 19,432 | 3 | 38,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,433 | 3 | 38,866 |
No | output | 1 | 19,433 | 3 | 38,867 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,434 | 3 | 38,868 |
No | output | 1 | 19,434 | 3 | 38,869 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,435 | 3 | 38,870 |
No | output | 1 | 19,435 | 3 | 38,871 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A plane is flying at a constant height of h meters above the ground surface. Let's consider that it is flying from the point (-10^9, h) to the point (10^9, h) parallel with Ox axis.
A glider is... | instruction | 0 | 19,436 | 3 | 38,872 |
No | output | 1 | 19,436 | 3 | 38,873 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,566 | 3 | 39,132 |
Yes | output | 1 | 19,566 | 3 | 39,133 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,567 | 3 | 39,134 |
Yes | output | 1 | 19,567 | 3 | 39,135 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,568 | 3 | 39,136 |
Yes | output | 1 | 19,568 | 3 | 39,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,569 | 3 | 39,138 |
Yes | output | 1 | 19,569 | 3 | 39,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,570 | 3 | 39,140 |
No | output | 1 | 19,570 | 3 | 39,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,571 | 3 | 39,142 |
No | output | 1 | 19,571 | 3 | 39,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,572 | 3 | 39,144 |
No | output | 1 | 19,572 | 3 | 39,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
There is a robot on a coordinate plane. Initially, the robot is located at the point (0, 0). Its path is described as a string s of length n consisting of characters 'L', 'R', 'U', 'D'.
Each of... | instruction | 0 | 19,573 | 3 | 39,146 |
No | output | 1 | 19,573 | 3 | 39,147 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao adjusts the view in such a way that the movie ... | instruction | 0 | 19,732 | 3 | 39,464 |
Tags: greedy, math, number theory
Correct Solution:
```
def scan(type):
return list(map(type, input().split()))
def gcd(a,b):
if (b == 0):
return a
return gcd(b, a%b)
def lcm(a,b):
return a*b//gcd(a,b)
a,b,c,d = scan(int)
num = den = ans = 100000000
k = lcm(a,c)
_a = a*k//a
_b = b*k//a
_c = ... | output | 1 | 19,732 | 3 | 39,465 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao adjusts the view in such a way that the movie ... | instruction | 0 | 19,733 | 3 | 39,466 |
Tags: greedy, math, number theory
Correct Solution:
```
import math
from fractions import Fraction
a, b, c, d = map(int, input().split())
if c / d > a / b:
conversion = Fraction(a ,c)
d *= conversion
res = Fraction(b-d, b)
if res == 0: print(str(res)+'/'+str(1))
print(res)
else:
conversion = Fr... | output | 1 | 19,733 | 3 | 39,467 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao adjusts the view in such a way that the movie ... | instruction | 0 | 19,735 | 3 | 39,470 |
Tags: greedy, math, number theory
Correct Solution:
```
def scan(type):
return list(map(type, input().split()))
def gcd(a,b):
if (b == 0):
return a
return gcd(b, a%b)
def lcm(a,b):
return a*b//gcd(a,b)
a,b,c,d = scan(int)
num = den = ans = 100000000
k = lcm(a,c)
_a = a*k//a
_b = b*k//a
_c = ... | output | 1 | 19,735 | 3 | 39,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao adjusts the view in such a way that the movie ... | instruction | 0 | 19,738 | 3 | 39,476 |
Tags: greedy, math, number theory
Correct Solution:
```
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
def byt(lst):
if lst[0] * lst[3] > lst[1] * lst[2]:
tmp = lst[0]
lst[0] = lst[1]
lst[1] = tmp
tmp = lst[2]
lst[2] = lst[3]
lst[3] = tmp
m... | output | 1 | 19,738 | 3 | 39,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,739 | 3 | 39,478 |
Yes | output | 1 | 19,739 | 3 | 39,479 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,740 | 3 | 39,480 |
Yes | output | 1 | 19,740 | 3 | 39,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,741 | 3 | 39,482 |
Yes | output | 1 | 19,741 | 3 | 39,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,742 | 3 | 39,484 |
Yes | output | 1 | 19,742 | 3 | 39,485 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,743 | 3 | 39,486 |
No | output | 1 | 19,743 | 3 | 39,487 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,744 | 3 | 39,488 |
No | output | 1 | 19,744 | 3 | 39,489 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,745 | 3 | 39,490 |
No | output | 1 | 19,745 | 3 | 39,491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Manao has a monitor. The screen of the monitor has horizontal to vertical length ratio a:b. Now he is going to watch a movie. The movie's frame has horizontal to vertical length ratio c:d. Manao... | instruction | 0 | 19,746 | 3 | 39,492 |
No | output | 1 | 19,746 | 3 | 39,493 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,789 | 3 | 39,578 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
true = input()
check = input()
variants = ['']
positions = []
def divide(arr):
new_arr = []
for variant in arr:
new_arr.append(variant + '+')
new_arr.append(variant + '-')
return new_arr
for i in range(len(check)):
if c... | output | 1 | 19,789 | 3 | 39,579 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,790 | 3 | 39,580 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
# Problem: B. Dreamoon and WiFi
# Contest: Codeforces - Codeforces Round #272 (Div. 2)
# URL: https://codeforces.com/problemset/problem/476/B
# Memory Limit: 256 MB
# Time Limit: 1000 ms
#
# Powered by CP Editor (https://cpeditor... | output | 1 | 19,790 | 3 | 39,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,791 | 3 | 39,582 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
t,D,d=0,{0:1},{'+':[1],'-':[-1],'?':[-1,1]}
for si in input(): t+=d[si][0]
for pi in input():
nd={}
for x,p in D.items():
for dr in d[pi]: nd[x+dr] = nd.get(x+dr,0) + p/len(d[pi])
D=nd
print(D.get(t,0))
# Made By Mo... | output | 1 | 19,791 | 3 | 39,583 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,792 | 3 | 39,584 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
from math import factorial
s = input().strip()
new = input().strip()
questions = 0
plus = s.count('+')
minus = s.count('-')
for i in new:
if i == '+':
plus -= 1
elif i == '-':
minus -= 1
else:
questions += 1
if plus < 0 o... | output | 1 | 19,792 | 3 | 39,585 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,793 | 3 | 39,586 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
from functools import reduce
from collections import Counter
def nchoosek(n, k):
if n-k+1 <= 1:
return 1
a = reduce(lambda x, y: x * y, range(1, n+1))
b = reduce(lambda x, y: x * y, range(1, k+1))
c = re... | output | 1 | 19,793 | 3 | 39,587 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,794 | 3 | 39,588 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
s1 = input()
s2 = input()
e = 0
for i in s1:
if i == '+': e += 1
else: e -= 1
maxn = 15
c = [[0 for i in range(maxn)] for j in range(maxn)]
c[0][0] = 1
for i in range(1, maxn):
for j in range(maxn):
c[i][j... | output | 1 | 19,794 | 3 | 39,589 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them.
Each command is one of the following two types:
1. Go 1 unit towards the pos... | instruction | 0 | 19,795 | 3 | 39,590 |
Tags: bitmasks, brute force, combinatorics, dp, math, probabilities
Correct Solution:
```
from collections import Counter,defaultdict,deque
#alph = 'abcdefghijklmnopqrstuvwxyz'
#from math import factorial as fact
#import math
#nl = '\n'
#import sys
#input=sys.stdin.readline
#print=sys.stdout.write
#tt = 1#int(input())
... | output | 1 | 19,795 | 3 | 39,591 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.