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 a correct Python 3 solution for this coding contest problem.
Find the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:
* The sum of the digits in base ten is a multiple of D.
Constraints
* All values in input are integers.
* 1 \leq K < 10^{10000}
* 1 \leq D... | instruction | 0 | 18,357 | 22 | 36,714 |
"Correct Solution:
```
k = input()
d = int(input())
mod = 10**9 + 7
dp = [[[0] * d for i in range(2)] for j in range(len(k)+1)]
dp[0][0][0] = 1
for i in range(len(k)):
for j in range(2):
for m in range(d):
if j == 1:
for num in range(10):
dp[i+1][j][(m+num)%... | output | 1 | 18,357 | 22 | 36,715 |
Provide a correct Python 3 solution for this coding contest problem.
Find the number of integers between 1 and K (inclusive) satisfying the following condition, modulo 10^9 + 7:
* The sum of the digits in base ten is a multiple of D.
Constraints
* All values in input are integers.
* 1 \leq K < 10^{10000}
* 1 \leq D... | instruction | 0 | 18,361 | 22 | 36,722 |
"Correct Solution:
```
mod = 10**9+7
K = input()
D = int(input())
dp = [0] * D
s = 0
for i in range(len(K)):
ndp = [0] * D
for j in range(D):
for d in range(10):
ndp[(j+d) % D] = (ndp[(j+d) % D] + dp[j]) % mod
for d in range(int(K[i])):
ndp[(s+d) % D] += 1
dp = ndp
s = (s... | output | 1 | 18,361 | 22 | 36,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,816 | 22 | 37,632 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
from math import sqrt, ceil
a, b, c = list(map(int, input().split()))
N = (a * b * c) + 1
def generate_prime(N, pp, prime):
pp[1] = False
for i in range(2, N):
if pp[i]:
prime.append(i)
x = i ** 2
... | output | 1 | 18,816 | 22 | 37,633 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,817 | 22 | 37,634 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
"""
This template is made by Satwik_Tiwari.
python programmers can use this template :)) .
"""
#===============================================================================================
#importing some useful libraries.
i... | output | 1 | 18,817 | 22 | 37,635 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,818 | 22 | 37,636 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
def easyNumbers():
a,b,c=map(int,input().split())
divisors=[1]*1000001
n=a*b*c
sum=0
modulo=1073741824
for i in range(2,n+1):
for j in range(i,n+1,i):
divisors[j] += 1
for i in range(1,a+1)... | output | 1 | 18,818 | 22 | 37,637 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,819 | 22 | 37,638 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
from collections import Counter
def factors(n):
fact = Counter()
i = 2
while i * i <= n:
while n % i == 0:
fact[i] += 1
n //= i
i += 1
if n != 1:
fact[n] += 1
fact[... | output | 1 | 18,819 | 22 | 37,639 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,820 | 22 | 37,640 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
a, b, c = map(int, input().split())
d = 1073741824
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
t = [{} for i in range(101)]
ans = {}
for i in p:
j = i
m = 1
while j < 1... | output | 1 | 18,820 | 22 | 37,641 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,821 | 22 | 37,642 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
abc=input().split(' ')
a=int(abc[0])
b=int(abc[1])
c=int(abc[2])
def product(f1,f2,f3):
fout=[]
for i in range(len(f1)):
fout.append(f1[i]+f2[i]+f3[i])
return fout
def no_of_factors(fin):
n=1
for inn in fin:
n*=(inn+1)
return ... | output | 1 | 18,821 | 22 | 37,643 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,822 | 22 | 37,644 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
import sys
def ints_input():
return [int(i) for i in sys.stdin.readline().strip("\n").split(" ")]
def print_list(arr):
sys.stdout.writelines(str(x)+" " for x in arr)
sys.stdout.write("\n")
def fast_input(type=str):
re... | output | 1 | 18,822 | 22 | 37,645 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 1073741824 (230).
Input
The first line contains three ... | instruction | 0 | 18,823 | 22 | 37,646 |
Tags: combinatorics, dp, implementation, math, number theory
Correct Solution:
```
def main():
from itertools import product
a, b, c = sorted(map(int, input().split()))
primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97)
l = [None]
for x in range... | output | 1 | 18,823 | 22 | 37,647 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,824 | 22 | 37,648 |
Yes | output | 1 | 18,824 | 22 | 37,649 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,825 | 22 | 37,650 |
Yes | output | 1 | 18,825 | 22 | 37,651 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,826 | 22 | 37,652 |
Yes | output | 1 | 18,826 | 22 | 37,653 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,827 | 22 | 37,654 |
Yes | output | 1 | 18,827 | 22 | 37,655 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,828 | 22 | 37,656 |
No | output | 1 | 18,828 | 22 | 37,657 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,829 | 22 | 37,658 |
No | output | 1 | 18,829 | 22 | 37,659 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,830 | 22 | 37,660 |
No | output | 1 | 18,830 | 22 | 37,661 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum:
<image>
Find the sum modulo 107374182... | instruction | 0 | 18,831 | 22 | 37,662 |
No | output | 1 | 18,831 | 22 | 37,663 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 18,995 | 22 | 37,990 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
is_prime = lambda n: all(n % d for d in range(2, int(n ** 0.5) + 1))
n, m = int(input()), 1
while is_prime(n * m + 1):
m += 1
print(m)
``` | output | 1 | 18,995 | 22 | 37,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 18,996 | 22 | 37,992 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
print([0, 3, 4, 1, 2, 1, 4, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1... | output | 1 | 18,996 | 22 | 37,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 18,997 | 22 | 37,994 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
def prost(numb):
kol_del = False
elem = 2
while (not kol_del) and (elem <= int(numb**0.5)):
if not(numb % elem):
return False
elem += 1
return True
n = int(input())
m = 1
Is = False
while (not Is) and (m <... | output | 1 | 18,997 | 22 | 37,995 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 18,998 | 22 | 37,996 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
from math import sqrt
from itertools import count, islice
def isPrime(n):
if n < 2: return False
for number in islice(count(2), int(sqrt(n)-1)):
if not n%number:
return False
return True
n = int(input())
for i in range... | output | 1 | 18,998 | 22 | 37,997 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 18,999 | 22 | 37,998 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
from math import sqrt
def product_remainders(number):
divisors = [str(1)]
flag = True
for i in range(2, round(sqrt(number)) + 1):
if number % i == 0:
flag = False
divisors.append(str(i))
return flag
... | output | 1 | 18,999 | 22 | 37,999 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 19,000 | 22 | 38,000 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
def ehPrimo(n):
quant = 0
for i in range(1, n+1):
if(n%i == 0):
quant += 1
if (quant == 2):
return True
else:
return False
n = int(input())
achou = False
m = 1
while not achou:
if (ehPrimo(m*n+1)):
m+=1
else:
br... | output | 1 | 19,000 | 22 | 38,001 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 19,001 | 22 | 38,002 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
n = int(input())
if n == 1:
print(3)
elif n==2:
print(4)
else:
if n%2:
print(1)
else:
print(n-2)
``` | output | 1 | 19,001 | 22 | 38,003 |
Provide tags and a correct Python 3 solution for this coding contest problem.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m + 1 is a prime number".
Unfortunately, PolandBa... | instruction | 0 | 19,002 | 22 | 38,004 |
Tags: brute force, graphs, math, number theory
Correct Solution:
```
n = int(input())
if n > 2:
print(n - 2)
elif n == 2:
print(12)
else:
print(9)
``` | output | 1 | 19,002 | 22 | 38,005 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,003 | 22 | 38,006 |
Yes | output | 1 | 19,003 | 22 | 38,007 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,004 | 22 | 38,008 |
Yes | output | 1 | 19,004 | 22 | 38,009 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,005 | 22 | 38,010 |
Yes | output | 1 | 19,005 | 22 | 38,011 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,006 | 22 | 38,012 |
Yes | output | 1 | 19,006 | 22 | 38,013 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,007 | 22 | 38,014 |
No | output | 1 | 19,007 | 22 | 38,015 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,008 | 22 | 38,016 |
No | output | 1 | 19,008 | 22 | 38,017 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,009 | 22 | 38,018 |
No | output | 1 | 19,009 | 22 | 38,019 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
PolandBall is a young, clever Ball. He is interested in prime numbers. He has stated a following hypothesis: "There exists such a positive integer n that for each positive integer m number n·m +... | instruction | 0 | 19,010 | 22 | 38,020 |
No | output | 1 | 19,010 | 22 | 38,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,027 | 22 | 38,054 |
Tags: math, number theory
Correct Solution:
```
import math
def gcdExtended(a, b):
if a == 0:
return b, 0, 1
gcd, x1, y1 = gcdExtended(b % a, a)
x = y1 - (b // a) * x1
y = x1
return gcd,x,y
a,b,c=map(int,input().split())
if a==0:
if (c%b)==0:
print(0, -c//b)
else:
... | output | 1 | 19,027 | 22 | 38,055 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,028 | 22 | 38,056 |
Tags: math, number theory
Correct Solution:
```
import sys
def gcd(a,b):
LT = []
while b > 0:
if a%b != 0:
LT.append([1,-(a//b)])
a, b = b ,a%b
return LT, a
A,B,C = map(int, input().split())
if B <= 0:
A = -1 * A
B = -1 * B
C = -1 * C
if A == 0 and B != 0:
y = -C/... | output | 1 | 19,028 | 22 | 38,057 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,029 | 22 | 38,058 |
Tags: math, number theory
Correct Solution:
```
#Se resuelve con el Algoritmo de Euclides o el Algoritmo extendido de Euclides
def main():
a, b, c = map(int, input().split())
x, x1 = 1, 0
y, y1 = 0, 1
while b != 0: #Se encuentra el mínimo común divisor y se define en "a"
q = a//b
... | output | 1 | 19,029 | 22 | 38,059 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,030 | 22 | 38,060 |
Tags: math, number theory
Correct Solution:
```
from math import *
a,b,c=list(map(int,input().split()))
if b==0:
if c%a==0:
print(round(-c/a),0)
else:
print(-1)
elif a==0:
if c%b==0:
print(0,round(-c/b))
else:
print(-1)
else:
if c%gcd(a,b)!=0:
print(-1)
el... | output | 1 | 19,030 | 22 | 38,061 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,031 | 22 | 38,062 |
Tags: math, number theory
Correct Solution:
```
"""
Codeforces
7C - Line
http://codeforces.com/contest/7/problem/C
Héctor González Belver
../07/2018
"""
import sys
def Bezout_identity(a, b):
#Find integers x and y (Bezout coefficients) ==> ax + by = gcd(a,b)
#Extendend Euclidean algorithm
r = b
x, x1 = 1, 0
... | output | 1 | 19,031 | 22 | 38,063 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,032 | 22 | 38,064 |
Tags: math, number theory
Correct Solution:
```
def gcd(a, b): return gcd(b % a, a) if a else b
def f(a, b):
if a == 1: return 1, 0
y, x = f(b % a, a)
return - x - y * (b // a), - y
a, b, c = map(int, input().split())
if c:
if a:
if b:
if c < 0: a, b, c = - a, - b, - c
i,... | output | 1 | 19,032 | 22 | 38,065 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,033 | 22 | 38,066 |
Tags: math, number theory
Correct Solution:
```
def eu(a,b,t):
if a==t:return 1,0
if b==t:return 0,1
if a==0:return 0,t//b
if b==0:return t//a,0
if a>0:sa=1
else:sa=-1
if b>0:sb=1
else:sb=-1
a,b=abs(a),abs(b)
if a>b:
x,y=eu(a%b,b,t)
return sa*x,sb*(y-(a//b)*x)
... | output | 1 | 19,033 | 22 | 38,067 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points do not exist.
Input
The firs... | instruction | 0 | 19,034 | 22 | 38,068 |
Tags: math, number theory
Correct Solution:
```
import sys
def solve():
a, b, c = map(int, input().split())
gcd, amul, bmul = egcd(a, b)
if c % gcd != 0:
print(-1)
return
first = amul * c//gcd
second = bmul * c // gcd
for i in range(-1, 2, 2):
for j in range(-1, 2, 2):
... | output | 1 | 19,034 | 22 | 38,069 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count t... | instruction | 0 | 19,066 | 22 | 38,132 |
Tags: combinatorics, dp, math, number theory
Correct Solution:
```
from array import array
md = 10 ** 9 + 7
def fact_all(N):
lp = array('Q', [2]*(N+1))
pr = array('Q', [2])
pra = pr.append
for i in range(3, N+1, 2):
if lp[i] == 2:
lp[i] = i
pra(i)
for p in pr:
... | output | 1 | 19,066 | 22 | 38,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count t... | instruction | 0 | 19,067 | 22 | 38,134 |
Tags: combinatorics, dp, math, number theory
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
fro... | output | 1 | 19,067 | 22 | 38,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count t... | instruction | 0 | 19,068 | 22 | 38,136 |
Tags: combinatorics, dp, math, number theory
Correct Solution:
```
md = 10 ** 9 + 7
def cnk(n, k):
if k > n//2:
k = n - k
ans = 1
for i in range(n-k+1, n+1):
ans *= i
for i in range(2, k+1):
ans //= i
ans = ans % md
return ans
def factor(n):
pws = []
dv = 2
... | output | 1 | 19,068 | 22 | 38,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count t... | instruction | 0 | 19,069 | 22 | 38,138 |
Tags: combinatorics, dp, math, number theory
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
#import threading... | output | 1 | 19,069 | 22 | 38,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer numbers;
* <image>.
You have to count t... | instruction | 0 | 19,070 | 22 | 38,140 |
Tags: combinatorics, dp, math, number theory
Correct Solution:
```
# from array import array
md = 10 ** 9 + 7
def fact_all(N):
# lp = array('L', [2]*(N+1))
# pr = array('L', [2])
lp = [2]*(N+1)
pr = [2]
pra = pr.append
for i in range(3, N+1, 2):
if lp[i] == 2:
lp[i] = i
... | output | 1 | 19,070 | 22 | 38,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer... | instruction | 0 | 19,071 | 22 | 38,142 |
No | output | 1 | 19,071 | 22 | 38,143 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer... | instruction | 0 | 19,072 | 22 | 38,144 |
No | output | 1 | 19,072 | 22 | 38,145 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given two positive integer numbers x and y. An array F is called an y-factorization of x iff the following conditions are met:
* There are y elements in F, and all of them are integer... | instruction | 0 | 19,073 | 22 | 38,146 |
No | output | 1 | 19,073 | 22 | 38,147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.