message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
42
109k
cluster
float64
5
5
__index_level_0__
int64
84
217k
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,482
5
164,964
"Correct Solution: ``` def main(): n = int(input()) for x in range(1, n): n *= x print(n) if __name__ == "__main__": main() ```
output
1
82,482
5
164,965
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,483
5
164,966
"Correct Solution: ``` user = input() n = int(user) kai = 1 for i in range(1, n+1): kai *= i print(kai) ```
output
1
82,483
5
164,967
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,484
5
164,968
"Correct Solution: ``` n = int(input()) s = 1 for i in range(1,n+1): s=s*i print(s) ```
output
1
82,484
5
164,969
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,485
5
164,970
"Correct Solution: ``` import math if __name__ == '__main__': n = int(input()) print(math.factorial(n)) ```
output
1
82,485
5
164,971
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,486
5
164,972
"Correct Solution: ``` s = int(input()) k = 1 for i in range(2,s+1): k *= i print(k) ```
output
1
82,486
5
164,973
Provide a correct Python 3 solution for this coding contest problem. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120
instruction
0
82,487
5
164,974
"Correct Solution: ``` n = int(input()) def f(n): if n == 0 : return 1 else : return f(n - 1) * n print(f(n)) ```
output
1
82,487
5
164,975
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` n = int(input()) factorial = 1 for i in range(2, n + 1): factorial *= i print(factorial) ```
instruction
0
82,488
5
164,976
Yes
output
1
82,488
5
164,977
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` n = int(input()) ans = 1 while n > 1: ans *= n n -= 1 print(ans) ```
instruction
0
82,489
5
164,978
Yes
output
1
82,489
5
164,979
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` def fact(n): if(n==0): return 1 return n * fact(n-1) if __name__ == '__main__': n = int(input()) print(fact(n)) ```
instruction
0
82,490
5
164,980
Yes
output
1
82,490
5
164,981
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` from math import factorial if __name__ == '__main__': # ??????????????\??? num = int(input()) # ??????????Β¨???? result = factorial(num) # ???????????Β¨??? print(result) ```
instruction
0
82,491
5
164,982
Yes
output
1
82,491
5
164,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` from math import factorial print(factorial(int(input())) ```
instruction
0
82,492
5
164,984
No
output
1
82,492
5
164,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` x=input() def f(n): if n==0:return 1 return f(n-1)*n print(f(int(n))) ```
instruction
0
82,493
5
164,986
No
output
1
82,493
5
164,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` ret = 1 for i in range(2, int(input())): ret *= i print(ret) ```
instruction
0
82,494
5
164,988
No
output
1
82,494
5
164,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Write a program which reads an integer n and prints the factorial of n. You can assume that n ≀ 20. Input An integer n (1 ≀ n ≀ 20) in a line. Output Print the factorial of n in a line. Example Input 5 Output 120 Submitted Solution: ``` def f(x):return 1if x<2else x*f(x-1) print(f(int(input()))) ```
instruction
0
82,495
5
164,990
No
output
1
82,495
5
164,991
Provide a correct Python 3 solution for this coding contest problem. Example Input 3 3 1 2 4 1 2 2 3 3 1 Output IMPOSSIBLE
instruction
0
82,520
5
165,040
"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**13 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(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def main(): rr = [] def f(n,m,a): t = [LI() for _ in range(m)] e = collections.defaultdict(set) for b,c in t: e[b].add(c) sm = max(a) ed = {} for i in range(1, n+1): t = {} q = set([i]) for j in range(sm): nq = set() for c in q: nq |= e[c] if (j+1) in a: t[j+1] = nq q = nq ed[i] = t d = collections.defaultdict(lambda: None) d[n] = 0 def ff(i): if not d[i] is None: return d[i] d[i] = inf mr = 0 for n in a: mi = inf for ni in ed[i][n]: t = ff(ni) if mi > t: mi = t if mr < mi: mr = mi d[i] = mr + 1 return mr + 1 res = ff(1) for tt in range(n): for ti in range(1,n+1): if (not d[ti] is None) and d[ti] > tt: d[ti] = None res = ff(1) if res >= inf: return 'IMPOSSIBLE' return res while 1: n,m,a,b,c = LI() if n == 0: break rr.append(f(n,m,[a,b,c])) break return '\n'.join(map(str, rr)) print(main()) ```
output
1
82,520
5
165,041
Provide a correct Python 3 solution for this coding contest problem. Example Input 3 3 1 2 4 1 2 2 3 3 1 Output IMPOSSIBLE
instruction
0
82,521
5
165,042
"Correct Solution: ``` from collections import deque import sys def solve(): readline = sys.stdin.readline write = sys.stdout.write N, M, *V = map(int, readline().split()) G = [[] for i in range(N)] for i in range(M): u, v = map(int, readline().split()) G[u-1].append(v-1) def matmul(A, B): C = [[0]*N for i in range(N)] for i in range(N): for j in range(N): C[i][j] = +(sum(A[i][k] & B[k][j] for k in range(N)) > 0) return C def fast_pow(X, k): R = [[0]*N for i in range(N)] for i in range(N): R[i][i] = 1 while k: if k & 1: R = matmul(R, X) X = matmul(X, X) k >>= 1 return R V.sort() prv = 0 ES = [[0]*N for i in range(N)] for v in range(N): for w in G[v]: ES[v][w] = 1 EE = [] ds = [] rgs = [] for i, k in enumerate(V): d = [0]*N rg = [[] for i in range(N)] ek = fast_pow(ES, k) EE.append(ek) for v in range(N): ts = ek[v] for w in range(N): if ts[w]: d[v] += 1 rg[w].append(v) ds.append(d) rgs.append(rg) D = [0]*N for i in range(3): d = ds[i] for v in range(N): if d[v]: D[v] += 1 U = [-1]*N U[N-1] = 0 que = deque([N-1]) while que: v = que.popleft() u = U[v] for i, rg in enumerate(rgs): d = ds[i] for w in rg[v]: if d[w] == 0: continue d[w] = 0 D[w] -= 1 if D[w] == 0: if U[w] == -1: U[w] = u+1 que.append(w) write("%d\n" % U[0] if U[0] != -1 else "IMPOSSIBLE\n") solve() ```
output
1
82,521
5
165,043
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` t = int(input()) itog = [] for _ in range(t): n = int(input()) if n == 0: itog.append(['Y', 0.000000, 0.000000]) else: l = -1 r = n + 1 while l + 1 != r: mid = (l + r)//2 if mid * (n - mid) >= n: r = mid else: l = mid for i in range(100): mid = (l + r)/2 if mid * (n - mid) > n: r = mid else: l = mid if round(l * (n - l)) == n and round(l + (n - l)) == n: itog.append(['Y', n - l, l]) else: itog.append(['N']) for i in itog: print(*i) ```
instruction
0
82,604
5
165,208
Yes
output
1
82,604
5
165,209
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` import math t=int(input()) for i in range(t): k=float(input()) r=k*k-4*k if k*k-4*k<0: print("N") else: print("Y",end=" ") l=(k+math.sqrt(r))/2.0 print("%.9f"%(l),end=" ") print("%.9f"%(k-l)) ```
instruction
0
82,605
5
165,210
Yes
output
1
82,605
5
165,211
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` t = int(input()) for i in range(t): x = int(input()) if x == 0 or x >= 4: d = (x * x - 4 * x) ** 0.5 a = 0.5 * (x - d) b = 0.5 * (x + d) print("Y", b, a) else: print("N") ```
instruction
0
82,606
5
165,212
Yes
output
1
82,606
5
165,213
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` import math for i in range(int(input())): d=int(input()) D=d*d-4*d if D<0: print('N') else: a=(d+math.sqrt(D))/2 b=(d-math.sqrt(D))/2 print('Y','%.10f'%a,'%.10f'%b,sep=' ') ```
instruction
0
82,607
5
165,214
Yes
output
1
82,607
5
165,215
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` T = int(input()) for t in range(T): d = int(input()) if 0 < d < 4: print('N') continue d = float(d) left, right = 1.0000000, 2.000000 for i in range(100): mid = (left + right) / 2 if mid * mid - mid * d + d > 0: left = mid else: right = mid print('Y') print(left, d - left) ```
instruction
0
82,608
5
165,216
No
output
1
82,608
5
165,217
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` import math t = int(input()) while t> 0: d = int(input()) if d*d - 4*d < 0: print('N') t-=1 continue if d!=0: a = (d + math.sqrt( d*d - 4*d ) ) / 2 b = d / a else: a=0 b=0 print('Y %.8f %.8f'%(a,b)) t-=1 ```
instruction
0
82,609
5
165,218
No
output
1
82,609
5
165,219
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` e = 1e-9 def prob( n ): if n == 1: print( "N" ) elif n == 0: print( "Y 0.000000000 0.000000000") else: l = 0 r = n while r - l > e: a = ( r + l ) / 2 b = n - a if a * b < n: l = ( r + l ) / 2 else: r = ( r + l ) / 2 print( "Y {:.9f} {:.9f}".format( l, n - l ) ) t = int( input() ) for i in range( t ): prob( int( input() ) ) ```
instruction
0
82,610
5
165,220
No
output
1
82,610
5
165,221
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Try guessing the statement from this picture: <image> You are given a non-negative integer d. You have to find two non-negative real numbers a and b such that a + b = d and a β‹… b = d. Input The first line contains t (1 ≀ t ≀ 10^3) β€” the number of test cases. Each test case contains one integer d (0 ≀ d ≀ 10^3). Output For each test print one line. If there is an answer for the i-th test, print "Y", and then the numbers a and b. If there is no answer for the i-th test, print "N". Your answer will be considered correct if |(a + b) - a β‹… b| ≀ 10^{-6} and |(a + b) - d| ≀ 10^{-6}. Example Input 7 69 0 1 4 5 999 1000 Output Y 67.985071301 1.014928699 Y 0.000000000 0.000000000 N Y 2.000000000 2.000000000 Y 3.618033989 1.381966011 Y 997.998996990 1.001003010 Y 998.998997995 1.001002005 Submitted Solution: ``` T = int(input()) for _ in range(T): d = int(input()) if d==0: print("Y 0.000000000 0.000000000") continue l = 0.0 h = d EPS = 0.0000001 b = True while h-l>EPS and b: m = (l+h)/2 if abs(d-(m+(d/m)))<EPS and abs((m*(d/m))-(m+(d/m)))<EPS: print('Y {0} {1}'.format(m,(d-m))) b = not b elif (m+(d/m))<d: l = m else: h = m if b: print("N") ```
instruction
0
82,611
5
165,222
No
output
1
82,611
5
165,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To become the king of Codeforces, Kuroni has to solve the following problem. He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≀ i<j≀ n} |a_i - a_j|. As result can be very big, output it modulo m. If you are not familiar with short notation, ∏_{1≀ i<j≀ n} |a_i - a_j| is equal to |a_1 - a_2|β‹…|a_1 - a_3|β‹… ... β‹…|a_1 - a_n|β‹…|a_2 - a_3|β‹…|a_2 - a_4|β‹… ... β‹…|a_2 - a_n| β‹… ... β‹… |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≀ i < j ≀ n. Input The first line contains two integers n, m (2≀ n ≀ 2β‹… 10^5, 1≀ m ≀ 1000) β€” number of numbers and modulo. The second line contains n integers a_1, a_2, ..., a_n (0 ≀ a_i ≀ 10^9). Output Output the single number β€” ∏_{1≀ i<j≀ n} |a_i - a_j| mod m. Examples Input 2 10 8 5 Output 3 Input 3 12 1 4 5 Output 0 Input 3 7 1 4 9 Output 1 Note In the first sample, |8 - 5| = 3 ≑ 3 mod 10. In the second sample, |1 - 4|β‹…|1 - 5|β‹…|4 - 5| = 3β‹… 4 β‹… 1 = 12 ≑ 0 mod 12. In the third sample, |1 - 4|β‹…|1 - 9|β‹…|4 - 9| = 3 β‹… 8 β‹… 5 = 120 ≑ 1 mod 7. Submitted Solution: ``` n,m = map(int,input().split()) a = list(map(int,input().split())) ans=1 if n > m: print('0') else: for i in range(n): for j in range(i+1,n): ans*=abs(a[i]-a[j]) ans%=m print(ans) ```
instruction
0
82,733
5
165,466
Yes
output
1
82,733
5
165,467
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To become the king of Codeforces, Kuroni has to solve the following problem. He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≀ i<j≀ n} |a_i - a_j|. As result can be very big, output it modulo m. If you are not familiar with short notation, ∏_{1≀ i<j≀ n} |a_i - a_j| is equal to |a_1 - a_2|β‹…|a_1 - a_3|β‹… ... β‹…|a_1 - a_n|β‹…|a_2 - a_3|β‹…|a_2 - a_4|β‹… ... β‹…|a_2 - a_n| β‹… ... β‹… |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≀ i < j ≀ n. Input The first line contains two integers n, m (2≀ n ≀ 2β‹… 10^5, 1≀ m ≀ 1000) β€” number of numbers and modulo. The second line contains n integers a_1, a_2, ..., a_n (0 ≀ a_i ≀ 10^9). Output Output the single number β€” ∏_{1≀ i<j≀ n} |a_i - a_j| mod m. Examples Input 2 10 8 5 Output 3 Input 3 12 1 4 5 Output 0 Input 3 7 1 4 9 Output 1 Note In the first sample, |8 - 5| = 3 ≑ 3 mod 10. In the second sample, |1 - 4|β‹…|1 - 5|β‹…|4 - 5| = 3β‹… 4 β‹… 1 = 12 ≑ 0 mod 12. In the third sample, |1 - 4|β‹…|1 - 9|β‹…|4 - 9| = 3 β‹… 8 β‹… 5 = 120 ≑ 1 mod 7. Submitted Solution: ``` def main(): n,m =list(map(int,input().split())) a =list(map(int,input().split())) s=1 if(n>m): s=0 else: for i in range(n): for j in range(i+1,n): if(s!=0): s=(s*abs(a[i]-a[j]))%m else: break print(s) main() ```
instruction
0
82,734
5
165,468
Yes
output
1
82,734
5
165,469
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To become the king of Codeforces, Kuroni has to solve the following problem. He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≀ i<j≀ n} |a_i - a_j|. As result can be very big, output it modulo m. If you are not familiar with short notation, ∏_{1≀ i<j≀ n} |a_i - a_j| is equal to |a_1 - a_2|β‹…|a_1 - a_3|β‹… ... β‹…|a_1 - a_n|β‹…|a_2 - a_3|β‹…|a_2 - a_4|β‹… ... β‹…|a_2 - a_n| β‹… ... β‹… |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≀ i < j ≀ n. Input The first line contains two integers n, m (2≀ n ≀ 2β‹… 10^5, 1≀ m ≀ 1000) β€” number of numbers and modulo. The second line contains n integers a_1, a_2, ..., a_n (0 ≀ a_i ≀ 10^9). Output Output the single number β€” ∏_{1≀ i<j≀ n} |a_i - a_j| mod m. Examples Input 2 10 8 5 Output 3 Input 3 12 1 4 5 Output 0 Input 3 7 1 4 9 Output 1 Note In the first sample, |8 - 5| = 3 ≑ 3 mod 10. In the second sample, |1 - 4|β‹…|1 - 5|β‹…|4 - 5| = 3β‹… 4 β‹… 1 = 12 ≑ 0 mod 12. In the third sample, |1 - 4|β‹…|1 - 9|β‹…|4 - 9| = 3 β‹… 8 β‹… 5 = 120 ≑ 1 mod 7. Submitted Solution: ``` # problem 1305 c N,mod=map(int,input().split()) a=list(map(int,input().split())) if N>=mod: print(0) elif N<mod: ans=1 for i in range(N): for j in range(i+1,N): ans*=abs(a[j]-a[i]) ans%=mod print(ans) ```
instruction
0
82,737
5
165,474
No
output
1
82,737
5
165,475
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. To become the king of Codeforces, Kuroni has to solve the following problem. He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≀ i<j≀ n} |a_i - a_j|. As result can be very big, output it modulo m. If you are not familiar with short notation, ∏_{1≀ i<j≀ n} |a_i - a_j| is equal to |a_1 - a_2|β‹…|a_1 - a_3|β‹… ... β‹…|a_1 - a_n|β‹…|a_2 - a_3|β‹…|a_2 - a_4|β‹… ... β‹…|a_2 - a_n| β‹… ... β‹… |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≀ i < j ≀ n. Input The first line contains two integers n, m (2≀ n ≀ 2β‹… 10^5, 1≀ m ≀ 1000) β€” number of numbers and modulo. The second line contains n integers a_1, a_2, ..., a_n (0 ≀ a_i ≀ 10^9). Output Output the single number β€” ∏_{1≀ i<j≀ n} |a_i - a_j| mod m. Examples Input 2 10 8 5 Output 3 Input 3 12 1 4 5 Output 0 Input 3 7 1 4 9 Output 1 Note In the first sample, |8 - 5| = 3 ≑ 3 mod 10. In the second sample, |1 - 4|β‹…|1 - 5|β‹…|4 - 5| = 3β‹… 4 β‹… 1 = 12 ≑ 0 mod 12. In the third sample, |1 - 4|β‹…|1 - 9|β‹…|4 - 9| = 3 β‹… 8 β‹… 5 = 120 ≑ 1 mod 7. Submitted Solution: ``` n,m=map(int,input().split()) a=[int(i) for i in input().split()] p=1 for i in range(n-1): for j in range(i+1,n): p*=a[i]-a[j] print(p%m) ```
instruction
0
82,739
5
165,478
No
output
1
82,739
5
165,479
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` n,s=map(int,input().split()) flag=False smallest=[] longest=[] i,p=n,s while i>0: if p==0: longest.append('0') else: longest.append(str(min(p,9))) p-=int(longest[len(longest)-1]) i-=1 if n>1 and s==0: #print("pointed at line 14") flag=True if p>0: #print("pointed at line 17") flag=True i,p=n,s p-=1 while i>1: smallest.append(str(min(p,9))) p-=int(smallest[len(smallest)-1]) i-=1 smallest.append(str(1+p)) p-=int(smallest[len(smallest)-1]) if p>0: #print("pointed at line 30") flag=True if not flag: print(''.join(smallest[::-1]),''.join(longest)) else: print(-1,-1) ```
instruction
0
82,934
5
165,868
Yes
output
1
82,934
5
165,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` m, s = list(map(int, input().split())) def find_min(m, s): result = [] s -= 1 for k in range(m): if s >= 9: result.append(9) s -= 9 else: result.append(s % 9) s -= s % 9 result[-1] += 1 return "".join(list(map(str, reversed(result)))) def find_max(m, s): result = [] for k in range(m): if s >= 9: result.append(9) s -= 9 else: result.append(s % 9) s -= s % 9 return "".join(list(map(str, result))) if m * 9 < s: print(-1, -1) else: if s == 0: if m == 1: minimal, maximal = 0, 0 else: minimal, maximal = -1, -1 else: minimal = find_min(m, s) maximal = find_max(m, s) print(minimal, maximal) ```
instruction
0
82,935
5
165,870
Yes
output
1
82,935
5
165,871
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` m, s = map(int, input().split()) if s == 0 and m == 1: print(0, 0) elif s == 0: print(-1, -1) elif m * 9 < s: print(-1, -1) else: nums = [] while len(nums) < m: nums.append(min(9, s)) s = s - min(9, s) max_nums = [str(i) for i in nums] max_num = ''.join(max_nums) min_nums = nums[::-1] if min_nums[0] == 0: for j, num in enumerate(min_nums): if num != 0: min_nums[j] = num - 1 break min_nums[0] = 1 min_nums = [str(i) for i in min_nums] min_num = ''.join(min_nums) print(min_num, max_num) ```
instruction
0
82,936
5
165,872
Yes
output
1
82,936
5
165,873
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` #from collections import Counter,defaultdict,deque #alph = 'abcdefghijklmnopqrstuvwxyz' #from math import factorial as fact #import math t = 1#int(input()) #total=0 #n = int(input()) #n,m,k = [int(x) for x in input().split()] for i in range(t): m,s = [int(x) for x in input().split()] nines = s//9 if m==1 and s==0: print(0,0) continue if nines>m or s==0 or m*9<s: print('-1 -1') continue if s<10: if m==1: print(s,s) else: mn = '1'+'0'*(m-2)+str(s-1) mx = str(s)+'0'*(m-1) print(mn,mx) continue if m*9==s: print('9'*m,'9'*m) continue rem = s%9 if nines+1 == m and rem!=0: mn = str(rem)+'9'*nines else: if rem ==0: mn = '1'+ '0'*(m-nines-1) + '8'+ '9'*(nines-1) else: mn = '1'+ '0'*(m-nines-2) + str(rem-1)+ '9'*nines mx = (nines*'9'+str(rem)+'0'*101)[:m] print(mn,mx) ```
instruction
0
82,937
5
165,874
Yes
output
1
82,937
5
165,875
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` import sys def rs(): return sys.stdin.readline().rstrip() def ri(): return int(sys.stdin.readline()) def ria(): return list(map(int, sys.stdin.readline().split())) def ws(s): sys.stdout.write(s + '\n') def wi(n): sys.stdout.write(str(n) + '\n') def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n') import math from collections import defaultdict n,s=ria() if s==0:print(-1,-1) else: m='' k=s//9 m=m+'9'*k s=s%9 m+=str(s) l=len(m) if l>n: print(-1,-1) else: m=m+'0'*(n-l) print(int(m[::-1]),m) ```
instruction
0
82,938
5
165,876
No
output
1
82,938
5
165,877
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` """ Author : co_devil Chirag Garg Institute : JIIT """ from __future__ import division, print_function import itertools, os, sys, threading from collections import deque, Counter, OrderedDict, defaultdict import heapq from math import ceil,floor,log,sqrt,factorial,pow,pi # from bisect import bisect_left,bisect_right # from decimal import *,threading """from io import BytesIO, IOBase if sys.version_info[0] < 3: from __builtin__ import xrange as range from future_builtins import ascii, filter, hex, map, oct, zip else: from builtins import str as __str__ str = lambda x=b'': x if type(x) is bytes else __str__(x).encode() BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._buffer = BytesIO() self._fd = file.fileno() self._writable = 'x' in file.mode or 'r' not in file.mode self.write = self._buffer.write if self._writable else None def read(self): return self._buffer.read() if self._buffer.tell() else os.read(self._fd, os.fstat(self._fd).st_size) def readline(self): while self.newlines == 0: b, ptr = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)), self._buffer.tell() self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr) self.newlines += b.count(b'\n') + (not b) self.newlines -= 1 return self._buffer.readline() def flush(self): if self._writable: os.write(self._fd, self._buffer.getvalue()) self._buffer.truncate(0), self._buffer.seek(0) sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout) input = lambda: sys.stdin.readline().rstrip(b'\r\n') def print(*args, **kwargs): sep, file = kwargs.pop('sep', b' '), kwargs.pop('file', sys.stdout) at_start = True for x in args: if not at_start: file.write(sep) file.write(str(x)) at_start = False file.write(kwargs.pop('end', b'\n')) if kwargs.pop('flush', False): file.flush() """ def ii(): return int(input()) def si(): return str(input()) def mi(): return map(int,input().split()) def li(): return list(mi()) abc = 'abcdefghijklmnopqrstuvwxyz' abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25} mod = 1000000007 dx, dy = [-1, 1, 0, 0], [0, 0, 1, -1] def getKey(item): return item[0] def sort2(l): return sorted(l, key=getKey) def d2(n, m, num): return [[num for x in range(m)] for y in range(n)] def isPowerOfTwo(x): return (x and (not (x & (x - 1)))) def decimalToBinary(n): return bin(n).replace("0b", "") def ntl(n): return [int(i) for i in str(n)] def powerMod(x, y, p): res = 1 x %= p while y > 0: if y & 1: res = (res * x) % p y = y >> 1 x = (x * x) % p return res def gcd(x, y): while y: x, y = y, x % y return x # For getting input from input.txt file # sys.stdin = open('input.txt', 'r') # Printing the Output to output.txt file # sys.stdout = open('output.txt', 'w') graph = defaultdict(list) visited = [0] * 1000000 col = [-1] * 1000000 def dfs(v, c): if visited[v]: if col[v] != c: print('-1') exit() return col[v] = c visited[v] = 1 for i in graph[v]: dfs(i, c ^ 1) def bfs(d,v): q=[] q.append(v) visited[v]=1 while len(q)!=0: x=q[0] q.pop(0) for i in d[x]: if visited[i]!=1: visited[i]=1 q.append(i) print(x) print(l) def make_graph(e): d={} for i in range(e): x,y=mi() if x not in d.keys(): d[x]=[y] else: d[x].append(y) if y not in d.keys(): d[y] = [x] else: d[y].append(x) return d def gr2(n): d={} for i in range(n): x,y=mi() if x not in d.keys(): d[x]=[y] else: d[x].append(y) return d def connected_components(graph): seen = set() def dfs(v): vs = set([v]) component=[] while vs: v = vs.pop() seen.add(v) vs |= set(graph[v]) - seen component.append(v) return component ans=[] for v in graph: if v not in seen: d=dfs(v) ans.append(d) return ans m,s=mi() x='' while s>0: if s>=9: z=9 else: z=s x+=str(z) s-=z if len(x)==m: y=str(int(x[::-1])) x=str(int(x)) if len(x)==m and len(y)==m: print(y,x) elif len(x)==m and len(y)!=m: print(x,x) elif len(x)!=m and len(y)==m: print(y,y) else: print(-1,-1) elif len(x)>0: z=m-len(x) x=list(map(int,list(x))) for i in range(z): x[-1]-=1 x.append(1) x=''.join(map(str,x)) y=str(int(x[::-1])) x=str(int(x)) if len(x)==m and len(y)==m: print(y,x) elif len(x)==m and len(y)!=m: print(x,x) elif len(x)!=m and len(y)==m: print(y,y) else: print(-1,-1) else: print(-1,-1) ```
instruction
0
82,939
5
165,878
No
output
1
82,939
5
165,879
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` a=input() m,s=a.split() m=int(m) s=int(s) small=[0]*m big=[0]*m t=s//9 if s>9*m or s==0: print('-1 -1') else: if s>9: for i in range(t): small[m-1-i]=9 if small[1]==9 and small[0]==0: small[0]=s%9 elif small[1]==0: small[0]=1 small[m-1-t]=s%9-1 elif m>1: small[0]=1 small[m-1]=s-1 else: small[0]=s if s<=9*m and s!=0: if s>9: for i in range(t): big[i]=9 big[t]=s%9 else: big[0]=s smallStr='' bigStr='' for i in range(m): smallStr+=str(small[i]) bigStr+=str(big[i]) print(smallStr+' '+bigStr) ```
instruction
0
82,940
5
165,880
No
output
1
82,940
5
165,881
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes. Input The single line of the input contains a pair of integers m, s (1 ≀ m ≀ 100, 0 ≀ s ≀ 900) β€” the length and the sum of the digits of the required numbers. Output In the output print the pair of the required non-negative integer numbers β€” first the minimum possible number, then β€” the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers "-1 -1" (without the quotes). Examples Input 2 15 Output 69 96 Input 3 0 Output -1 -1 Submitted Solution: ``` def maximal(m,s): if s > 9*m: return '*' if s == 0: if m == 1: return str(0) else: return '*' if m==1: if s in range(0,10): return str(s) else: return '*' else: if s < 10: return str(s*10**(m-1)) else: return str(9) + maximal(m-1,s-9) ''' def minimal(m,s): temp_out = maximal(m,s) if '*' in list(temp_out): return '*' else: if temp_out == '0': return str(0) else: index_ = 1 while(temp_out[-index_] == str('0')): index_ +=1 if index_ > 1: return temp_out[-index_] + ''.join([str(0) for i in range(1,index_)]) + temp_out[:-index_][::-1] else: return temp_out[::-1] ''' def minimal(m,s,m_start): if s > 9*m: return '*' if s == 0: if m == 1: return str(0) else: return '*' if m == 1: if s in range(0,10): return str(s) else: if m == m_start: index_list = [s - i <= 9*(m-1) for i in range(1,10)] if True in index_list: index_ = index_list.index(True) + 1 return str(index_) + minimal(m-1,s-index_,m_start) else: return '*' else: index_list = [s - i <= 9*(m-1) for i in range(10)] if True in index_list: index_ = index_list.index(True) return str(index_) + minimal(m-1,s-index_,m_start) else: return '*' input_ = list(map(int, input().split())) m, s = input_[0], input_[1] out_1, out_2 = maximal(m,s), minimal(m,s,m) if '*' in list(out_1) or '*' in list(out_2): print (str(-1) + ' ' + str(-1)) else: print(out_2, end = ' ') print(out_1) ```
instruction
0
82,941
5
165,882
No
output
1
82,941
5
165,883
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,254
5
166,508
"Correct Solution: ``` a, b, c = map(int, input().split()) for i in range(a): if (b*i+c)%a == 0: print('YES') exit() print('NO') ```
output
1
83,254
5
166,509
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,255
5
166,510
"Correct Solution: ``` A, B, C = map(int,input().split()) ans = "NO" for i in range(1,B+1): if A*i%B == C: ans = "YES" print(ans) ```
output
1
83,255
5
166,511
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,256
5
166,512
"Correct Solution: ``` a, b, c = map(int, input().split()) print('YES' if any((a*i)%b == c for i in range(1,b+1)) else 'NO') ```
output
1
83,256
5
166,513
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,257
5
166,514
"Correct Solution: ``` A,B,C = map(int,input().split()) print('YES' if any([1 if (A*i)%B == C else 0 for i in range(1,B+1)]) else 'NO') ```
output
1
83,257
5
166,515
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,258
5
166,516
"Correct Solution: ``` A, B, C = map(int, input().split()) r = [(A * k) % B for k in range(B)] print(["NO", "YES"][C in r]) ```
output
1
83,258
5
166,517
Provide a correct Python 3 solution for this coding contest problem. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO
instruction
0
83,259
5
166,518
"Correct Solution: ``` A, B, C = list(map(int, input().split())) if A>B: A,B=B,A while A: A,B = B%A, A print('YES' if C%B==0 else 'NO') ```
output
1
83,259
5
166,519
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` A,B,C=map(int,input().split()) for i in range(B): if(i+1)*A%B==C:print('YES');exit() print('NO') ```
instruction
0
83,260
5
166,520
Yes
output
1
83,260
5
166,521
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` A,B,C = map(int,input().split()) for i in range(1,B+1): if(A*i%B == C): print("YES") exit() print("NO") ```
instruction
0
83,261
5
166,522
Yes
output
1
83,261
5
166,523
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` a,b,c = map(int,input().split()) ans = 'NO' for i in range(b): if a*(i+1)%b==c: ans = 'YES' print(ans) ```
instruction
0
83,262
5
166,524
Yes
output
1
83,262
5
166,525
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` a,b,c=map(int,input().split()) print('YNEOS'[c not in [a*i%b for i in range(b)]::2]) ```
instruction
0
83,263
5
166,526
Yes
output
1
83,263
5
166,527
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` ABC = input().split() A=ABC[0] B=ABC[1] C=ABC[2] count = 50 N=0 for index in range(count+1): if (A*N-C)%B ==0: print("Yes") elif index == (count): print("NO") else: N+=1 ```
instruction
0
83,264
5
166,528
No
output
1
83,264
5
166,529
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` a, b, c = map(int, input().split()) ans = 'NO' total = 0 if a < b and c%a == 0: ans = 'YES' else: for i in range(1, 100000): total += a*i if total%b == c: ans = 'YES' break print(ans) ```
instruction
0
83,266
5
166,532
No
output
1
83,266
5
166,533
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. We ask you to select some number of positive integers, and calculate the sum of them. It is allowed to select as many integers as you like, and as large integers as you wish. You have to follow these, however: each selected integer needs to be a multiple of A, and you need to select at least one integer. Your objective is to make the sum congruent to C modulo B. Determine whether this is possible. If the objective is achievable, print `YES`. Otherwise, print `NO`. Constraints * 1 ≀ A ≀ 100 * 1 ≀ B ≀ 100 * 0 ≀ C < B Input Input is given from Standard Input in the following format: A B C Output Print `YES` or `NO`. Examples Input 7 5 1 Output YES Input 2 2 1 Output NO Input 1 100 97 Output YES Input 40 98 58 Output YES Input 77 42 36 Output NO Submitted Solution: ``` a,b,c=map(int,input().split()) moda=a%k keep=0 for i in range(0,10**8): if (moda*i)%k==c: keep=1 print("YES") break if keep==0: print("No") ```
instruction
0
83,267
5
166,534
No
output
1
83,267
5
166,535
Provide a correct Python 3 solution for this coding contest problem. Write a program which prints multiplication tables in the following format: 1x1=1 1x2=2 . . 9x8=72 9x9=81 Input No input. Output 1x1=1 1x2=2 . . 9x8=72 9x9=81 Example Input Output
instruction
0
83,278
5
166,556
"Correct Solution: ``` numbers = list(range(1, 10)) for i in numbers: for j in numbers: print("{}x{}={}".format(i, j, i*j)) ```
output
1
83,278
5
166,557