message stringlengths 2 59.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 37 108k | cluster float64 20 20 | __index_level_0__ int64 74 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she ... | instruction | 0 | 50,001 | 20 | 100,002 |
No | output | 1 | 50,001 | 20 | 100,003 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she ... | instruction | 0 | 50,002 | 20 | 100,004 |
No | output | 1 | 50,002 | 20 | 100,005 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she ... | instruction | 0 | 50,003 | 20 | 100,006 |
No | output | 1 | 50,003 | 20 | 100,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Piegirl got bored with binary, decimal and other integer based counting systems. Recently she discovered some interesting properties about number <image>, in particular that q2 = q + 1, and she ... | instruction | 0 | 50,004 | 20 | 100,008 |
No | output | 1 | 50,004 | 20 | 100,009 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,042 | 20 | 100,084 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
s = input()
ans = eval(s)
for i in range(len(s)-1):
if s[i] == "*":
k = "(" + s[0:i] + ")" + s[i:len(s)]
t = eval(k)
if t > ans:
ans = t
k = s[0:i+1] + "(" + s[i+1:len(s)] + "... | output | 1 | 50,042 | 20 | 100,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,043 | 20 | 100,086 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
s = "1*" + input() + "*1"
poses = []
for i in range(len(s)):
if (s[i] == '*'):
poses.append(i)
ans = 0
for i in poses:
for j in poses:
if (i < j):
t = s[: i + 1] + "(" + s[i + 1 : j] + ")" + s[j :]
ans = max(ans... | output | 1 | 50,043 | 20 | 100,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,044 | 20 | 100,088 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
s = input()
mult_list = []
for i in range(len(s)):
if s[i] == '*':
mult_list.append(i)
best = eval(s)
for k in mult_list:
t = '('+s[:k]+')'+s[k:]
q = eval(t)
if q > best:
best = q
t = s[:... | output | 1 | 50,044 | 20 | 100,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,045 | 20 | 100,090 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
str = '1*' + input() + '*1'
n = len(str)
max_z = eval(str)
arr = []
for i in range(1, n, 2):
if str[i] == '*':
arr.append(i)
for i in range(len(arr)):
s1 = str[:arr[i]+1] + '(' + str[arr[i]+1:]
for j in range(i + 1,... | output | 1 | 50,045 | 20 | 100,091 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,046 | 20 | 100,092 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
s = input()
s = "1*"+s+"*1"
ans = 0
for i in range(len(s)):
if s[i] == "*":
checker = s[0:i+1]+"("+s[i+1:]
for j in range(i+2, len(checker)):
if checker[j] == "*":
ans = max(a... | output | 1 | 50,046 | 20 | 100,093 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,047 | 20 | 100,094 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
qw = input()
g = ['*']
s = [1]
for i in range(len(qw)):
if i % 2 == 0:
s.append(int(qw[i]))
else:
g.append(qw[i])
c = 0
g.append('*')
s.append(1)
for i in range(len(g)):
if g[i] == '*':
f... | output | 1 | 50,047 | 20 | 100,095 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,048 | 20 | 100,096 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
def mul2val(s):
res = 1
for i in s.split('*'): res *= int(i)
return res
s = '1*' + input() + '*1'
muls = s.split('+')
vals = list(map(mul2val, muls))
lvals = list(map(mul2val, [mul[:-2] if len(mul)>1 else '0'
... | output | 1 | 50,048 | 20 | 100,097 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*'. Vanya needs to add one pair of brackets in t... | instruction | 0 | 50,049 | 20 | 100,098 |
Tags: brute force, dp, expression parsing, greedy, implementation, strings
Correct Solution:
```
s = "1*" + input() + "*1"
a = ""
n = len(s)
s = s + "+"
i = 0;
while (i < n):
if(s[i + 1] == '*'):
while(s[i + 1] == '*'):
a += s[i:i + 2]
i += 2
a += s[i:i + 2]
i += 2
... | output | 1 | 50,049 | 20 | 100,099 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,050 | 20 | 100,100 |
Yes | output | 1 | 50,050 | 20 | 100,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,051 | 20 | 100,102 |
Yes | output | 1 | 50,051 | 20 | 100,103 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,052 | 20 | 100,104 |
Yes | output | 1 | 50,052 | 20 | 100,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,053 | 20 | 100,106 |
Yes | output | 1 | 50,053 | 20 | 100,107 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,054 | 20 | 100,108 |
No | output | 1 | 50,054 | 20 | 100,109 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,055 | 20 | 100,110 |
No | output | 1 | 50,055 | 20 | 100,111 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,056 | 20 | 100,112 |
No | output | 1 | 50,056 | 20 | 100,113 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Vanya is doing his maths homework. He has an expression of form <image>, where x1, x2, ..., xn are digits from 1 to 9, and sign <image> represents either a plus '+' or the multiplication sign '*... | instruction | 0 | 50,057 | 20 | 100,114 |
No | output | 1 | 50,057 | 20 | 100,115 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Champernowne constant is an irrational number. Its decimal representation starts with "0.", followed by concatenation of all positive integers in the increasing order.
You will be given a seque... | instruction | 0 | 50,486 | 20 | 100,972 |
No | output | 1 | 50,486 | 20 | 100,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Champernowne constant is an irrational number. Its decimal representation starts with "0.", followed by concatenation of all positive integers in the increasing order.
You will be given a seque... | instruction | 0 | 50,487 | 20 | 100,974 |
No | output | 1 | 50,487 | 20 | 100,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Champernowne constant is an irrational number. Its decimal representation starts with "0.", followed by concatenation of all positive integers in the increasing order.
You will be given a seque... | instruction | 0 | 50,488 | 20 | 100,976 |
No | output | 1 | 50,488 | 20 | 100,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,671 | 20 | 101,342 |
Tags: implementation, math
Correct Solution:
```
__author__ = 'Darren'
def solve():
a = int(input())
digit_sum = 0
for base in range(2, a):
a_copy = a
while a_copy:
digit_sum += a_copy % base
a_copy //= base
g = gcd(digit_sum, a - 2)
print('%d/%d' % (digit_s... | output | 1 | 50,671 | 20 | 101,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,672 | 20 | 101,344 |
Tags: implementation, math
Correct Solution:
```
from math import gcd
n = int(input())
s = 0
for i in range(2, n):
copy = n
while copy > 0:
s += copy % i
copy //= i
a = s
b = n - 2
g = gcd(a, b)
print(f"{a // g}/{b // g}")
``` | output | 1 | 50,672 | 20 | 101,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,673 | 20 | 101,346 |
Tags: implementation, math
Correct Solution:
```
import math
def f(n, i):
r = 0
while n:
r += n % i
n //= i
return r
n = int(input() )
s = 0
for i in range(2, n):
s += f(n, i)
g = math.gcd(s, n-2)
print(''.join([str(s//g), '/', str((n-2)//g) ] ) )
``` | output | 1 | 50,673 | 20 | 101,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,674 | 20 | 101,348 |
Tags: implementation, math
Correct Solution:
```
import os
import math
import sys
debug = True
if debug and os.path.exists("input.in"):
input = open("input.in", "r").readline
else:
debug = False
input = sys.stdin.readline
def inp():
return (int(input()))
def inlt():
return (list(map(int, inpu... | output | 1 | 50,674 | 20 | 101,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,675 | 20 | 101,350 |
Tags: implementation, math
Correct Solution:
```
'''
5 2
'''
def sum_in_base(num, base):
ans = 0
while num != 0:
ans += num % base
num //= base
return ans
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
A, sumOfAll = int(input()), 0
for i in range(2, A):
s... | output | 1 | 50,675 | 20 | 101,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,676 | 20 | 101,352 |
Tags: implementation, math
Correct Solution:
```
def main():
from math import gcd
a, x = int(input()), 0
for b in range(2, a):
t = a
while t:
x += t % b
t //= b
a -= 2
g = gcd(x, a)
print(x // g, a // g, sep="/")
if __name__ == "__main__":
main()
``... | output | 1 | 50,676 | 20 | 101,353 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,677 | 20 | 101,354 |
Tags: implementation, math
Correct Solution:
```
from math import gcd
A = int(input())
s = 0
for i in range(2, A):
x = A
while x!=0:
s += x%i
x = x//i
g = gcd(s, A-2)
print(str(s//g)+"/"+str((A-2)//g))
``` | output | 1 | 50,677 | 20 | 101,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he wonders what is an average value of sum of digi... | instruction | 0 | 50,678 | 20 | 101,356 |
Tags: implementation, math
Correct Solution:
```
a = int(input())
import math
g = 0
for k in range(2,a):
x=a
l=x%k
while x>1:
x=x//k
g+=x%k
g+=l
u = math.gcd(g,a-2)
print(str(g//u)+'/'+str((a-2)//u))
``` | output | 1 | 50,678 | 20 | 101,357 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,679 | 20 | 101,358 |
Yes | output | 1 | 50,679 | 20 | 101,359 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,680 | 20 | 101,360 |
Yes | output | 1 | 50,680 | 20 | 101,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,681 | 20 | 101,362 |
Yes | output | 1 | 50,681 | 20 | 101,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,682 | 20 | 101,364 |
Yes | output | 1 | 50,682 | 20 | 101,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,683 | 20 | 101,366 |
No | output | 1 | 50,683 | 20 | 101,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,684 | 20 | 101,368 |
No | output | 1 | 50,684 | 20 | 101,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,685 | 20 | 101,370 |
No | output | 1 | 50,685 | 20 | 101,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.
Now he ... | instruction | 0 | 50,686 | 20 | 101,372 |
No | output | 1 | 50,686 | 20 | 101,373 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every decimal number has a base k equivalent. The indivi... | instruction | 0 | 50,743 | 20 | 101,486 |
Tags: bitmasks, constructive algorithms, interactive, math
Correct Solution:
```
try:
import sys
def solve():
n,k = map(int,input().split())
print(0)
sys.stdout.flush()
glad = int(input())
if(glad == 1):
return
for i in range(1 , n):
... | output | 1 | 50,743 | 20 | 101,487 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every decimal number has a base k equivalent. The indivi... | instruction | 0 | 50,744 | 20 | 101,488 |
Tags: bitmasks, constructive algorithms, interactive, math
Correct Solution:
```
from sys import stdout
import sys
for _ in range(int(input())):
n, k = map(int, input().split())
cum = 0
for last in range(n):
# print('c', cum)
print(last ^ cum)
stdout.flush()
cum = last
if sys.stdin.readline().... | output | 1 | 50,744 | 20 | 101,489 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every decimal number has a base k equivalent. The indivi... | instruction | 0 | 50,745 | 20 | 101,490 |
Tags: bitmasks, constructive algorithms, interactive, math
Correct Solution:
```
# Not my code
# https://codeforces.com/contest/1543/submission/121634285
from sys import stdout
import sys
for _ in range(int(input())):
n, k = map(int, input().split())
cum = 0
for last in range(n):
# print('c', cum)
stdout.... | output | 1 | 50,745 | 20 | 101,491 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every dec... | instruction | 0 | 50,746 | 20 | 101,492 |
No | output | 1 | 50,746 | 20 | 101,493 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every dec... | instruction | 0 | 50,747 | 20 | 101,494 |
No | output | 1 | 50,747 | 20 | 101,495 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every dec... | instruction | 0 | 50,748 | 20 | 101,496 |
No | output | 1 | 50,748 | 20 | 101,497 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This is the easy version of the problem. The only difference is that here k=2. You can make hacks only if both the versions of the problem are solved.
This is an interactive problem.
Every dec... | instruction | 0 | 50,749 | 20 | 101,498 |
No | output | 1 | 50,749 | 20 | 101,499 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm.
Sereja takes a blank piece of paper. Then he starts writing out the sequence in m stages. Each time he either adds a new... | instruction | 0 | 50,841 | 20 | 101,682 |
Tags: binary search, brute force
Correct Solution:
```
MAX_LEN = int(1e5)
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
m = int(input())
b = list(map(lambda x:int(x)-1, input().split()))
curr, k, c, res = 0, 0, [], []
for i in range(n):
t = a[i]
last = curr
if t[0] == 1:
c... | output | 1 | 50,841 | 20 | 101,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm.
Sereja takes a blank piece of paper. Then he starts writing out the sequence in m stages. Each time he either adds a new... | instruction | 0 | 50,842 | 20 | 101,684 |
Tags: binary search, brute force
Correct Solution:
```
from bisect import bisect_left
m = int(input())
t, s = [input().split() for i in range(m)], [0] * m
l, n = 0, int(input())
for j, i in enumerate(t):
l += 1 if i[0] == '1' else int(i[1]) * int(i[2])
t[j], s[j] = l, i[1] if i[0] == '1' else int(i[1])
F = {}
d... | output | 1 | 50,842 | 20 | 101,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Right now you are to solve a very, very simple problem β to crack the safe. Four positive integers stand one by one on a circle protecting the safe. You know that to unlock this striking safe you have to make all four numbers equal to one. O... | instruction | 0 | 50,859 | 20 | 101,718 |
Tags: brute force, constructive algorithms
Correct Solution:
```
from sys import stdin
input = stdin.buffer.readline
ans = ''
def f(a, b, c):
global ans
if (a & 1) & (b & 1) and not a == b == 1:
ans += f'+{c}\n'
a += 1
b += 1
while (a & 1 ^ 1) & (b & 1 ^ 1):
ans += f'/{c}\n'... | output | 1 | 50,859 | 20 | 101,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Right now you are to solve a very, very simple problem β to crack the safe. Four positive integers stand one by one on a circle protecting the safe. You know that to unlock this striking safe you have to make all four numbers equal to one. O... | instruction | 0 | 50,860 | 20 | 101,720 |
Tags: brute force, constructive algorithms
Correct Solution:
```
ring = list(map(int, input().split()))
n = len(ring)
record = []
def halve(pos):
a, b = pos % n, (pos + 1) % n
ring[a] //= 2
ring[b] //= 2
record.append('/%d' % (a + 1))
def increment(pos):
a, b = pos % n, (pos + 1) % n
ring[a] += 1
ring[... | output | 1 | 50,860 | 20 | 101,721 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.