message stringlengths 2 57.2k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 61 108k | cluster float64 22 22 | __index_level_0__ int64 122 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to step 1.
Determine the number of subtrations ... | instruction | 0 | 58,030 | 22 | 116,060 |
Tags: implementation, math, number theory
Correct Solution:
```
import math
n = int(input())
count = 0
while True:
if n == 0:
break
if n % 2 == 0:
count += (n // 2)
break
i = 2
d = n
while i < int(math.sqrt(n)) + 1:
if n % i == 0:
d = i
break
i += 1
n -= d
count += 1
p... | output | 1 | 58,030 | 22 | 116,061 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to step 1.
Determine the number of subtrations ... | instruction | 0 | 58,031 | 22 | 116,062 |
Tags: implementation, math, number theory
Correct Solution:
```
import math
n=int(input())
if n%2==0:
print(n//2)
else:
i=3
f=0
c=0
while(i<=int(math.ceil(math.sqrt(n)))):
if n%i==0:
c+=1
n=n-i
if n%2==0:
f=1
print(c+n//2)
... | output | 1 | 58,031 | 22 | 116,063 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,032 | 22 | 116,064 |
Yes | output | 1 | 58,032 | 22 | 116,065 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,033 | 22 | 116,066 |
Yes | output | 1 | 58,033 | 22 | 116,067 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,034 | 22 | 116,068 |
Yes | output | 1 | 58,034 | 22 | 116,069 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,035 | 22 | 116,070 |
Yes | output | 1 | 58,035 | 22 | 116,071 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,036 | 22 | 116,072 |
No | output | 1 | 58,036 | 22 | 116,073 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,037 | 22 | 116,074 |
No | output | 1 | 58,037 | 22 | 116,075 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,038 | 22 | 116,076 |
No | output | 1 | 58,038 | 22 | 116,077 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an integer number n. The following algorithm is applied to it:
1. if n = 0, then end algorithm;
2. find the smallest prime divisor d of n;
3. subtract d from n and go to s... | instruction | 0 | 58,039 | 22 | 116,078 |
No | output | 1 | 58,039 | 22 | 116,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,011 | 22 | 118,022 |
Tags: implementation
Correct Solution:
```
for k in range(int(input())):
a,b=map(int,input().split())
count=0
if(a<b):
while(8*a<=b):
a=a*8
count+=1
while(4*a<=b):
a=a*4
count+=1
while(2*a<=b):
a=a*2
count+=1
if(a==b):
print(count)
else:
print(-1)
else:
while(a>=b*8 and a%8==0):
... | output | 1 | 59,011 | 22 | 118,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,012 | 22 | 118,024 |
Tags: implementation
Correct Solution:
```
import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase
# def gcd(a,b):
# if b==0:
# return a
# else:
# return gcd(b,a%b)
def inar():
return [int(k) for k in input().split()]
... | output | 1 | 59,012 | 22 | 118,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,013 | 22 | 118,026 |
Tags: implementation
Correct Solution:
```
z=int(input())
for q in range(z):
a,b=map(int,input().split())
j = a
a = max(a, b)
b = min(j, b)
if a == b:
print(0)
elif a % b != 0:
print(-1)
else:
x = a // b
cnt = 0
flag = 0
while True:
... | output | 1 | 59,013 | 22 | 118,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,014 | 22 | 118,028 |
Tags: implementation
Correct Solution:
```
t = int(input())
for _ in range(t):
a, b = map(int, input().split())
if(b>a):
if(b%a!=0):
print("-1")
else:
x = bin(b//a)[2::].count("1")
if(x!=1):
print("-1")
else:
y = bin... | output | 1 | 59,014 | 22 | 118,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,015 | 22 | 118,030 |
Tags: implementation
Correct Solution:
```
import math
t=int(input())
for i in range(t):
a,b=map(int,input().split())
if a==b:
print(0)
elif a>b:
if a%b==0:
c=a//b
v=1
d=0
for j in range(1,61):
v*=2
if c==v:
if j%3==0:
b=0
else:
b=1
print(b+j//3)
d=1
break... | output | 1 | 59,015 | 22 | 118,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,016 | 22 | 118,032 |
Tags: implementation
Correct Solution:
```
def foo(a,b):
ans = 0
while b!=a:
if b%8==0 and b//8>=a:
b//=8
ans += 1
continue
if b%4==0 and b//4>=a:
b//=4
ans += 1
continue
if b%2==0 and b//2>=a:
b//=2
... | output | 1 | 59,016 | 22 | 118,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,017 | 22 | 118,034 |
Tags: implementation
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in fi... | output | 1 | 59,017 | 22 | 118,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or right by at most three positions. The right shift ... | instruction | 0 | 59,018 | 22 | 118,036 |
Tags: implementation
Correct Solution:
```
t=int(input())
for i in range(t):
a,b=list(map(int,input().split()))
if a==b:
print(0)
else:
if a>b:
a,b=b,a
s1=bin(b)
s2=bin(a)
try:
if not s1.index(s2)==0:
print(-1)
continue
except ValueE... | output | 1 | 59,018 | 22 | 118,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,019 | 22 | 118,038 |
Yes | output | 1 | 59,019 | 22 | 118,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,020 | 22 | 118,040 |
Yes | output | 1 | 59,020 | 22 | 118,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,021 | 22 | 118,042 |
Yes | output | 1 | 59,021 | 22 | 118,043 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,022 | 22 | 118,044 |
Yes | output | 1 | 59,022 | 22 | 118,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,023 | 22 | 118,046 |
No | output | 1 | 59,023 | 22 | 118,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,024 | 22 | 118,048 |
No | output | 1 | 59,024 | 22 | 118,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,025 | 22 | 118,050 |
No | output | 1 | 59,025 | 22 | 118,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one operation, you can shift its bits left or rig... | instruction | 0 | 59,026 | 22 | 118,052 |
No | output | 1 | 59,026 | 22 | 118,053 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,065 | 22 | 118,130 |
Tags: brute force, math
Correct Solution:
```
import math
for _ in range(int(input())):
n=input()
while math.gcd(int(n),sum([int(i) for i in n]))==1:
n=str(int(n)+1)
print(n)
``` | output | 1 | 59,065 | 22 | 118,131 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,066 | 22 | 118,132 |
Tags: brute force, math
Correct Solution:
```
def res(n2, n3):
MAX = 0
for i in range(n3, 0, -1):
if n3%i==0 and n2%i==0:
return i
for _ in range(int(input())):
n = int(input())
n1 = sum([int(i)for i in str(n)])
while res(n, n1) == 1:
n += 1
n1 = sum([int(i)for i ... | output | 1 | 59,066 | 22 | 118,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,067 | 22 | 118,134 |
Tags: brute force, math
Correct Solution:
```
# cook your dish here
import math
t = int(input())
for i in range(t):
n = int(input())
while(1):
v = n
v1 = v
sumofv = 0
while(v>0):
k = v%10
v = v//10
sumofv+=k
n+=1
if(math.gcd(v1,... | output | 1 | 59,067 | 22 | 118,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,068 | 22 | 118,136 |
Tags: brute force, math
Correct Solution:
```
# Author : raj1307 - Raj Singh
# Date : 29.03.2021
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, ... | output | 1 | 59,068 | 22 | 118,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,069 | 22 | 118,138 |
Tags: brute force, math
Correct Solution:
```
# Har har mahadev
# author : @ harsh kanani
import math
import os
import sys
from collections import Counter
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self... | output | 1 | 59,069 | 22 | 118,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,070 | 22 | 118,140 |
Tags: brute force, math
Correct Solution:
```
from math import gcd
def check(num):
sm = sum(list(map(int,str(num))))
if gcd(num,sm) > 1:
return True
return False
for t in range(int(input())):
num = int(input())
for i in range(num,num*10):
if check(i):
print(i)
... | output | 1 | 59,070 | 22 | 118,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,071 | 22 | 118,142 |
Tags: brute force, math
Correct Solution:
```
def computeGCD(x, y):
while(y):
x, y = y, x % y
return x
T=int(input())
for i in range(T):
x=input()
flag=True
while(flag!=False):
if computeGCD(int(x),sum([int(i) for i in x]))>1:
print(x)
flag=False
else:
... | output | 1 | 59,071 | 22 | 118,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes the greatest common divisor of a and b β the lar... | instruction | 0 | 59,072 | 22 | 118,144 |
Tags: brute force, math
Correct Solution:
```
import math
def sumofdigits(n):
a = 0
while n:
a += n % 10
n //= 10
return a
for _ in range(int(input())):
n = int(input())
f = n
while True:
if math.gcd(f, sumofdigits(f)) > 1:
break
f += 1
print(f... | output | 1 | 59,072 | 22 | 118,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,073 | 22 | 118,146 |
Yes | output | 1 | 59,073 | 22 | 118,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,074 | 22 | 118,148 |
Yes | output | 1 | 59,074 | 22 | 118,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,075 | 22 | 118,150 |
Yes | output | 1 | 59,075 | 22 | 118,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,076 | 22 | 118,152 |
Yes | output | 1 | 59,076 | 22 | 118,153 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,077 | 22 | 118,154 |
No | output | 1 | 59,077 | 22 | 118,155 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,078 | 22 | 118,156 |
No | output | 1 | 59,078 | 22 | 118,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,079 | 22 | 118,158 |
No | output | 1 | 59,079 | 22 | 118,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, sum of digits of x) for a positive integer x. gcd(a, b) denotes t... | instruction | 0 | 59,080 | 22 | 118,160 |
No | output | 1 | 59,080 | 22 | 118,161 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,181 | 22 | 118,362 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, in... | output | 1 | 59,181 | 22 | 118,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,182 | 22 | 118,364 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, in... | output | 1 | 59,182 | 22 | 118,365 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,183 | 22 | 118,366 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, in... | output | 1 | 59,183 | 22 | 118,367 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,184 | 22 | 118,368 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
import math, sys
input = sys.stdin.buffer.readline
def ints():
return map(int, input().split())
n = int(input())
x = list(ints())
MAX = max(x) + 1
freq = [0] * MAX
for i in x:
freq[i] += 1
sieve ... | output | 1 | 59,184 | 22 | 118,369 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,185 | 22 | 118,370 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#arr=list(map(int, input().split()))
import os, sys, atexit
from io import BytesIO, StringIO
_OUTPUT_BUFFER = StringIO()
s... | output | 1 | 59,185 | 22 | 118,371 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,186 | 22 | 118,372 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, in... | output | 1 | 59,186 | 22 | 118,373 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,187 | 22 | 118,374 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from math import sqrt, pi, ceil, log, in... | output | 1 | 59,187 | 22 | 118,375 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, the bear started studying data structures and faced the following problem.
You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) ... | instruction | 0 | 59,188 | 22 | 118,376 |
Tags: binary search, brute force, data structures, dp, implementation, math, number theory
Correct Solution:
```
import sys
input = sys.stdin.buffer.readline
n = int(input())
x = list(map(int, input().split()))
mx = max(x)
hf = [i for i in range(mx + 1)]
p = 2
while p * p <= mx:
if hf[p] == p:
for m in ran... | output | 1 | 59,188 | 22 | 118,377 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.