s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s920990644
p03651
u277429554
1593409954
Python
Python (3.8.2)
py
Runtime Error
64
19708
267
n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() a.reverse() x = a[0] for i in range (1, N): while a[i] != 0: x , a[i] = a[i] , x % a[i] if K > a[0]: print('IMPOSSIBLE') else: print('POSSIBLE' if K%x == 0 else 'IMPOSSIBLE')
s100109589
p03651
u000085263
1593389718
Python
Python (3.8.2)
py
Runtime Error
80
19952
319
n, k = map(int, input().split()) l = list(map(float, input().split())) m = max(l) def hcf(x, y): while(y): x, y = y, x % y return x num1=l[0] num2=l[1] gcd=hcf(num1,num2) for i in range(2,len(l)): gcd=hcf(gcd,l[i]) if k%gcd == 0 and k<=m: print("POSSIBLE") else: print("IMPOSSIBLE")
s168813762
p03651
u000085263
1593389235
Python
Python (3.8.2)
py
Runtime Error
73
19892
317
n, k = map(int, input().split()) l = list(map(int, input().split())) m = max(l) def hcf(x, y): while(y): x, y = y, x % y return x num1=l[0] num2=l[1] gcd=hcf(num1,num2) for i in range(2,len(l)): gcd=hcf(gcd,l[i]) if k%gcd == 0 and k<=m: print("POSSIBLE") else: print("IMPOSSIBLE")
s859461708
p03651
u000085263
1593389071
Python
Python (3.8.2)
py
Runtime Error
52
19996
316
n, k = map(int, input().split()) l = list(map(int, input().split())) m = max(a) def hcf(x, y): while(y): x, y = y, x % y return x num1=l[0] num2=l[1] gcd=hcf(num1,num2) for i in range(2,len(l)): gcd=hcf(gcd,l[i]) if k%gcd == 0 and k<=m: print("POSSIBLE") else: print("IMPOSSIBLE")
s301292135
p03651
u260216890
1592995772
Python
PyPy3 (7.3.0)
py
Runtime Error
113
74780
210
from math import gcd n=int(input()) *a, =map(int,input().split()) a=sorted(a) for i in range(len(a)): if i==0: tmp=a[0] else: tmp=gcd(tmp,a[i]) if n%tmp==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s891741452
p03651
u086503932
1592362357
Python
Python (3.4.3)
py
Runtime Error
21
3316
621
#!/usr/bin/env python3 from collections import deque, Counter from heapq import heappop, heappush from bisect import bisect_right from math import gcd def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() if K > A[N-1]: print('IMPOSSIBLE') else: ...
s297391771
p03651
u508486691
1592166118
Python
PyPy3 (2.4.0)
py
Runtime Error
223
62576
727
import sys import math from collections import defaultdict from bisect import bisect_left, bisect_right sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def I(): return int(input()) def LI(): return list(map(int, input().split())) def LIR(row,col): if row <= 0: ...
s289246523
p03651
u502731482
1591994978
Python
Python (3.4.3)
py
Runtime Error
18
3060
210
from math import gcd n, k = map(int, input().split()) a = list(map(int, input().split())) x = a[0] for i in range(1, n): x = gcd(x, a[i]) print("POSSIBLE" if k % x == 0 and max(a) >= k else "IMPOSSIBLE")
s542621162
p03651
u185948224
1591875991
Python
Python (3.4.3)
py
Runtime Error
176
15376
436
N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() da = [abs(A[i] - A[i-1]) for i in range(1, N)] da.sort() mda = min(da) ma = min(A) set1 = set() set2 = set() for a in A: if ma != 0: set1.add(a%ma) if mda != 0: set2.add(a%mda) set3 = set1 | set2 jdg = False if K <...
s943837906
p03651
u185948224
1591875726
Python
Python (3.4.3)
py
Runtime Error
137
14224
395
N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() da = [abs(A[i] - A[i-1]) for i in range(1, N)] da.sort() mda = min(da) ma = min(A) set1 = set() set2 = set() for a in A: set1.add(a%ma) set2.add(a%mda) set3 = set1 | set2 jdg = False if K <= max(A): for i in set3: if ...
s513401348
p03651
u354126779
1591669908
Python
PyPy3 (2.4.0)
py
Runtime Error
210
62576
319
import math n,k=map(int,input().split()) A=list(map(int,input().split())) M=A[0] g=A[0] for i in range(n-1): M=max(M,A[i+1]) g=math.gcd(g,A[i+1]) if k<=M: if g==1: print("POSSIBLE") elif k%g==0: print("POSSIBLE") else: print("IMPOSSIBLE") else: print("IMPOSSIBLE")
s606197007
p03651
u354126779
1591669846
Python
Python (3.4.3)
py
Runtime Error
42
15020
319
import math n,k=map(int,input().split()) A=list(map(int,input().split())) M=A[0] g=A[0] for i in range(n-1): M=max(M,A[i+1]) g=math.gcd(g,A[i+1]) if k<=M: if g==1: print("POSSIBLE") elif k%g==0: print("POSSIBLE") else: print("IMPOSSIBLE") else: print("IMPOSSIBLE")
s917589960
p03651
u354126779
1591669731
Python
Python (3.4.3)
py
Runtime Error
42
15020
329
import math n,k=map(int,input().split()) A=list(map(int,input().split())) M=A[0] gcd=A[0] for i in range(n-1): M=max(M,A[i+1]) gcd=math.gcd(gcd,A[i+1]) if k<=M: if gcd==1: print("POSSIBLE") elif k%gcd==0: print("POSSIBLE") else: print("IMPOSSIBLE") else: print("IMP...
s688968415
p03651
u588794534
1591367360
Python
PyPy3 (2.4.0)
py
Runtime Error
227
62576
475
n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() #9,4,3>7 #9-(9-4-3) #9 ;6 3 >5 if k in a: print("POSSIBLE") exit() if k>a[-1]: print("IMPOSSIBLE") exit() if a[0]==1: print("POSSIBLE") exit() flag=0 for item in a[1:]: if item%a[0]!=0: flag=1 if flag==1: ...
s236113509
p03651
u134019875
1591361584
Python
Python (3.4.3)
py
Runtime Error
42
15020
286
import math n, k = map(int, input().split()) L = list(map(int, input().split())) if n == 1: g = L[0] else: g = math.gcd(L[0], L[1]) for i in range(2, n): g = math.gcd(g, L[i]) M = max(L) if M >= k and k % g == 0: print('POSSIBLE') else: print('IMPOSSIBLE')
s030712308
p03651
u098012509
1591307594
Python
Python (3.4.3)
py
Runtime Error
81
14252
605
import sys import math sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N, K = [int(x) for x in input().split()] A = [int(x) for x in input().split()] A.sort() if N == 1: if A[0] == K: print("POSSIBLE") else: print("IMPOSSIBLE") ...
s020440935
p03651
u935558307
1591298100
Python
PyPy3 (2.4.0)
py
Runtime Error
229
62576
406
""" KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。 """ import sys sys.setrecursionlimit(200000) N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[2]) if K<=max(A) and K%g == 0: print("POSSIBLE") else: ...
s121824187
p03651
u935558307
1591298059
Python
PyPy3 (2.4.0)
py
Runtime Error
228
62576
365
""" KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。 """ N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[2]) if K<=max(A) and K%g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s606871225
p03651
u935558307
1591297870
Python
PyPy3 (2.4.0)
py
Runtime Error
226
62576
351
""" KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。 """ N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[2]) if K%g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s397775484
p03651
u060793972
1591012736
Python
Python (3.4.3)
py
Runtime Error
81
14252
218
def f(a,b): if b:return f(b,a%b) return a n,k=map(int,input().split()) a=list(map(int,input().split())) p=f(a[0],a[1]) for i in a[1:]: p=f(p,i) print('POSSIBLE' if p==f(p,k) and k<=max(a) else 'IMPOSSIBLE')
s597752328
p03651
u145950990
1590724406
Python
Python (3.4.3)
py
Runtime Error
42
14224
205
n,k = map(int,input().split()) a = list(map(int,input().split())) from math import gcd g = a[0] for i in a[1:]: g = gcd(g,i) if k<=max(a) and k%g==0: print('POSSIBLE') else: print('IMPOSSIBLE')
s913891431
p03651
u038021590
1590696795
Python
PyPy3 (2.4.0)
py
Runtime Error
228
65048
364
import math N, K = map(int, input().split()) A = list(map(int, input().split())) B = [] for a1, a2 in zip(A, A[1:]): B.append(abs(a2-a1)) if K > max(A): print('IMPOSSIBLE') exit() if K in A: print('POSSIBLE') exit() g = B[0] for b in B[1:]: g = math.gcd(g, b) if (A[0] - K) % g == 0: prin...
s838015207
p03651
u026788530
1590417482
Python
Python (3.4.3)
py
Runtime Error
17
2940
5805
// #include <bits/stdc++.h> #include <iostream> // cin, cout, string #include <algorithm> // sort, min/max, upper/lower_bound, transform, count/copy_if #include <vector> #include <utility> // pair, swap #include <functional> #include <iomanip> // setprecision #include <map> #include <set> // multiset #include <unorder...
s919189837
p03651
u034128150
1590275808
Python
Python (3.4.3)
py
Runtime Error
100
16244
353
from fractions import gcd N, K = map(int, input().split()) As = list(map(int, input().split())) if len(As) == 1: possible = (As[0] == K) else: g = As[1] - As[0] for A in As[2:]: g = gcd(g, A - As[0]) possible = ((K-As[0]) % g == 0) and (min(As) <= K <= max(As)) if possible: print("POSSIBL...
s103759042
p03651
u935558307
1590118356
Python
PyPy3 (2.4.0)
py
Runtime Error
230
62576
297
import sys sys.setrecursionlimit(2000000) N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[i]) if K <= max(A) and K%g==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s190847600
p03651
u935558307
1590118321
Python
PyPy3 (2.4.0)
py
Runtime Error
229
62576
255
N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[i]) if K <= max(A) and K%g==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s011110606
p03651
u757117214
1590115068
Python
Python (3.4.3)
py
Runtime Error
47
14564
156
import math from functools import reduce N,K,*A = map(int,open(0).read().split()) g = reduce(math.gcd,A) print("POSSIBLE" if K % g == 0 else "IMPOSSIBLE")
s743560823
p03651
u801049006
1590113662
Python
Python (3.4.3)
py
Runtime Error
48
14588
276
import functools import math n, k = map(int, input().split()) a = list(map(int, input().split())) m = max(a) if k > m: print("IMPOSSIBLE") else: gcd = functools.reduce(math.gcd, a) if k % gcd == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s758854177
p03651
u974792613
1590108115
Python
Python (3.4.3)
py
Runtime Error
17
2940
320
def gcd(a, b): return gcd(b, a % b) if b > 0 else a n, k = map(int, input().split()) a = list(map(int, input().split()) m = max(a) g = a[0] for i in range(n): g = gcd(g, a[i]) if k > m: print("IMPOSSIBLE") elif k % g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s854254792
p03651
u974792613
1590106709
Python
Python (3.4.3)
py
Runtime Error
18
2940
286
from fractions import gcd n,k = map(int, input().split()) a = list(map(int, input().split()) m = max(a) g = a[0] for i in range(n): g = gcd(g, a[i]) if k>m: print("IMPOSSIBLE") elif k % g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s576563801
p03651
u693974737
1590041115
Python
PyPy3 (2.4.0)
py
Runtime Error
236
62576
297
def gcd(a, b): if a == 0: return b if b == 0: return a return gcd(a % b, b % a) n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k//g*g == k: print("POSSIBLE") else: print("IMPOSSIBLE")
s188334114
p03651
u693974737
1590041072
Python
PyPy3 (2.4.0)
py
Runtime Error
232
62576
309
def gcd(a, b): if a == 0: return b if b == 0: return a return gcd(a % b, b % a) n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k//g*g == k: print("POSSIBLE") else: print("IMPOSSIBLE")
s391651010
p03651
u296475749
1590040863
Python
Python (3.4.3)
py
Runtime Error
17
3060
235
from math import gcd n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k%g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s747138090
p03651
u693974737
1590040741
Python
Python (3.4.3)
py
Runtime Error
18
3060
237
from math import gcd n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k//g*g == k: print("POSSIBLE") else: print("IMPOSSIBLE")
s476819043
p03651
u693974737
1590040447
Python
PyPy3 (2.4.0)
py
Runtime Error
161
38256
215
from math import gcd n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k//g*g == k: print("POSSIBLE") else: print("IMPOSSIBLE")
s818414269
p03651
u693974737
1590040334
Python
PyPy3 (2.4.0)
py
Runtime Error
161
38384
218
from math import gcd n, k = map(int, input().split()) arr = list(map(int, input().split())) g = arr[0] for e in arr[1:]: g = gcd(g, e) if k <= max(arr) and k//g*g == k: print("POSSIBLE") else: print("IMPOSSIBLE")
s483737661
p03651
u935558307
1589869833
Python
PyPy3 (2.4.0)
py
Runtime Error
229
62576
285
import sys sys.setrecursionlimit(200000) N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[i]) if K % g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s011333679
p03651
u935558307
1589869800
Python
PyPy3 (2.4.0)
py
Runtime Error
219
62576
243
N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): return a if b==0 else gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[i]) if K % g == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s893581073
p03651
u538632589
1589863000
Python
Python (3.4.3)
py
Runtime Error
23
3572
685
import sys from functools import reduce from math import gcd POSSIBLE = "POSSIBLE" IMPOSSIBLE = "IMPOSSIBLE" n, k = map(int, input().split()) a = list(map(int, input().split())) # max(a) < k → だめ # N == 1 ぴったじゃなきゃだめ # N > 1 ## 互いに素な数が含まれている → ○ ## 含まれてないが、kがその倍数 → ○ if max(a) < k: print(IMPOSSIBLE) exit() if ...
s286438553
p03651
u075595666
1589823530
Python
Python (3.4.3)
py
Runtime Error
62
16096
232
from fractions import gcd n,k = map(int,input().split()) a = [int(i) for i in input().split()] g = a[0] for i in a: g = gcd(g,a) if k%g != 0: print('IMPOSSIBLE') elif k<=max(a): print('POSSIBLE') else: print('IMPOSSIBLE')
s175345937
p03651
u060736237
1589667600
Python
Python (3.4.3)
py
Runtime Error
17
3060
284
from math import gcd N, K = map(int, input().split()) A = list(map(int, input().split())) if max(A) < K: print("IMPOSSIBLE") else: temp = A[0] for a in A[1:]: temp = gcd(a, temp) if K % temp == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
s185549433
p03651
u814781830
1589586253
Python
PyPy3 (2.4.0)
py
Runtime Error
237
62576
870
import math N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort() # いずれか2つの数字のGCDが1 必ずTrue # いずれか2つの数字のGCDが2 かつ Ai - K % 2 == 0 のものが存在する場合 True # いずれか2つのGCDが計算できれば、答えが導けるが、いずれか2つの組み合わせはA * (A-1) // 2通りあるから間に合わない # 累積GCDで1になる → どうにかこうにか1にできる # 累積GCDで2になる → どの組み合わせをとっても2にしかならない def main(): ...
s104989816
p03651
u810356688
1589491355
Python
Python (3.4.3)
py
Runtime Error
49
14612
392
import sys def input(): return sys.stdin.readline().rstrip() import math from functools import reduce def gcd(*numbers): return reduce(math.gcd, numbers) def main(): n,k=map(int,input().split()) A=list(map(int,input().split())) gcd_a=gcd(*A) if k%gcd_a==0 and max(A)>=k: print("POSSIBLE") ...
s424553273
p03651
u980205854
1589475332
Python
Python (3.4.3)
py
Runtime Error
47
14612
243
# A - Getting Difference import math from functools import reduce N, K = map(int, input().split()) A = list(map(int, input().split())) gcd = reduce(math.gcd, A) if max(A)>=K and K%gcd==0: print('POSSIBLE') else: print('IMPOSSIBLE')
s139069264
p03651
u935558307
1589448603
Python
PyPy3 (7.3.0)
py
Runtime Error
72
84812
286
N,K = map(int,input().split()) A = list(map(int,input().split())) def gcd(a,b): if b==0: return a else: return gcd(b,a%b) g = gcd(A[0],A[1]) for i in range(2,N): g = gcd(g,A[i]) if K%g==0 and K<=max(A): print("POSSIBLE") else: print("IMPOSSIBLE")
s831328497
p03651
u549579601
1589219715
Python
Python (3.4.3)
py
Runtime Error
45
14224
275
n, k = map(int, input().split()) A = list(map(int, input().split())) import math def list_gcd(X): t = max(X) for i in X: t = math.gcd(t, i) return t if k in A or (k % list_gcd(A) == 0 and max(A) >= k): print("POSSIBLE") else: print("IMPOSSIBLE")
s707938522
p03651
u093041722
1589145197
Python
PyPy3 (2.4.0)
py
Runtime Error
233
62576
567
def xgcd(a, b): x0, y0, x1, y1 = 1, 0, 0, 1 while b != 0: q, a, b = a // b, b, a % b x0, x1 = x1, x0 - q * x1 y0, y1 = y1, y0 - q * y1 return a N,K = (int(x) for x in input().split()) A = list(map(int, input().split())) m = max(A) if K > m: print('IMPOSSIBLE') else: gcd = xg...
s075950526
p03651
u607075479
1589142697
Python
Python (3.4.3)
py
Runtime Error
18
3064
297
from math import gcd N, K = map(int, input().split()) A = sorted(list(map(int, input().split())), reverse=True) gcm = 10**9+7 for i in range(N-1): gcm = min(gcm, gcd(A[i], A[i+1])) if N == 1: print('IMPOSSIBLE') exit() print('POSSIBLE' if K % gcm == 0 and K <= A[0] else 'IMPOSSIBLE')
s211115128
p03651
u731368968
1589082827
Python
Python (3.4.3)
py
Runtime Error
164
14480
434
def possible(b): print('POSSIBLE' if b else 'IMPOSSIIBLE') n, k = map(int, input().split()) A = list(map(int, input().split())) if k in A: possible(True) exit() if n == 1: possible(False) exit() A = set(A) A = list(A) n = len(A) A.sort() D = [A[i + 1] - A[i] for i in range(n - 1)] from fractions ...
s598708267
p03651
u731368968
1589082754
Python
Python (3.4.3)
py
Runtime Error
107
14480
424
def possible(b): print('POSSIBLE' if b else 'IMPOSSIIBLE') n, k = map(int, input().split()) A = list(map(int, input().split())) if k in A: possible(True) exit() if n == 1: possible(False) exit() A = set(A) A = list(A) A.sort() D = [A[i + 1] - A[i] for i in range(n - 1)] from fractions import * g...
s062193510
p03651
u731368968
1589073510
Python
Python (3.4.3)
py
Runtime Error
142
14224
401
def possible(b): print('POSSIBLE' if b else 'IMPOSSIIBLE') n, k = map(int, input().split()) A = list(map(int, input().split())) if k in A: possible(True) exit() if n == 1: possible(False) exit() A.sort() D = [A[i + 1] - A[i] for i in range(n - 1)] from fractions import * g = D[0] for d in D: ...
s726713540
p03651
u731368968
1589071821
Python
Python (3.4.3)
py
Runtime Error
94
14224
271
n, k = map(int, input().split()) A = list(map(int, input().split())) if n == 1: print('IMPOSSIBLE') exit() A.sort() D = [A[i + 1] - A[i] for i in range(n - 1)] from math import * g = D[0] for d in D: g = gcd(g, d) print('POSSIBLE'if g == 1 else 'IMPOSSIBLE')
s470508577
p03651
u940139461
1588869127
Python
PyPy3 (2.4.0)
py
Runtime Error
2129
62704
691
# https://atcoder.jp/contests/agc018/tasks/agc018_a n, k = map(int, input().split()) nums = [int(i) for i in input().split()] # ボールはどんどん増えていく nums.sort() if k <= nums[-1]: diff = set([]) for i in range(1, n): diff.add(abs(nums[i] - nums[i - 1])) diff = list(diff) dp = [False] * (k + 1) dp[...
s301710466
p03651
u827306875
1588865396
Python
Python (3.4.3)
py
Runtime Error
1594
143392
456
N, K = map(int, input().split()) A_list = list(map(int, input().split())) A_list.sort() sub_A_list = A_list.copy()[1:] if K in A_list: print('POSSIBLE') else: for i in range(N-1): sub_A_list[i] -= A_list[i] print(sub_A_list) a = [] for i in range(N-2): if sub_A_list[i] ...
s725669353
p03651
u024782094
1588812212
Python
Python (3.4.3)
py
Runtime Error
83
15148
280
import math n,k=map(int,input().split()) a=sorted(list(map(int,input().split()))) if k>max(a): print("IMPOSSIBLE") exit() g=a[0] for i in range(1,n): g=math.gcd(g,a[i]) for i in range(n): a[i]=a[i]%g if k%g in a: print("POSSIBLE") else: print("IMPOSSIBLE")
s677035850
p03651
u024782094
1588812053
Python
PyPy3 (2.4.0)
py
Runtime Error
254
62576
288
import math n,k=map(int,input().split()) a=sorted(list(map(int,input().split()))) b=[0]*n if k>max(a): print("IMPOSSIBLE") exit() g=a[0] for i in range(1,n): g=math.gcd(g,a[i]) for i in range(n): b[i]=a[i]%g if k%g in b: print("POSSIBLE") else: print("IMPOSSIBLE")
s181963395
p03651
u757117214
1588811922
Python
Python (3.4.3)
py
Runtime Error
42
14180
163
import math N,K,*A = map(int,open(0).read().split()) g = A[0] for i in A: g = math.gcd(g,i) print("POSSIBLE" if K % g == 0 and K <= max(A) else "IMPOSSIBLE")
s494055395
p03651
u075304271
1588753001
Python
Python (3.4.3)
py
Runtime Error
182
25076
412
import numpy as np import math import scipy import itertools import fractions import functools def gcd(nums): return functools.reduce(euclid, nums) def solve(): n, k = map(int, input().split()) a = list(map(int, input().split())) g = gcd(a) if k <= max(a) and k % g == 0: print("POSSIBLE") ...
s707537148
p03651
u210440747
1588684904
Python
Python (3.4.3)
py
Runtime Error
22
3572
272
from functools import reduce, gcd def main(): n, k = map(int, input().split()) la = list(map(int, input().split())) if max(la) > k and (max(la) - k) % (reduce(gcd, la)) == 0: print('POSSIBLE') else: print('IMPOSSIBLE') if __name__=='__main__': main()
s060106312
p03651
u210440747
1588684701
Python
Python (3.4.3)
py
Runtime Error
17
2940
333
#!/usr/bin/python3 # -*- coding:utf-8 -*- from math import gcd from functools import reduce def main(): n, k = map(int, input().split()) la = list(map(int, input().split())) if max(la) > k and (max(la) - k) % (reduce(gcd, la)) == 0: print('POSSIBLE') else: print('IMPOSSIBLE') if __name__=='__main__...
s910968208
p03651
u590211278
1588643501
Python
Python (3.4.3)
py
Runtime Error
77
15020
287
import math N, K = map(int,input().split(' ')) A = list(map(int,input().split(' '))) A.sort() A.reverse() t=A[0] for i in range(1,N): t=math.gcd(t,A[i]) if K > A[0]: print("IMPOSSIBLE") else: if K%t==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s246762261
p03651
u948911484
1588628366
Python
PyPy3 (2.4.0)
py
Runtime Error
330
88172
214
from fractions import gcd n,k = map(int,input().split()) a = list(map(int,input().split())) g = a[0] for i in range(n): g = gcd(g,a[1]) if k%g == 0 and k <= max(a): print("POSSIBLE") else: print("IMPOSSIBLE")
s191571232
p03651
u527993431
1588456276
Python
Python (3.4.3)
py
Runtime Error
98
16240
256
import fractions N,K=map(int,input().split()) L=list(map(int,input().split())) tmp=0 for i in range(1,N): if i==1: tmp=fractions.gcd(L[0],L[1]) else: tmp=fractions.gcd(tmp,L[i]) if max(L)>=K and K%tmp==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s521439531
p03651
u527993431
1588456159
Python
Python (3.4.3)
py
Runtime Error
93
16240
252
import fractions N,K=map(int,input().split()) L=list(map(int,input().split())) tmp=0 for i in range(1,N): if i==1: tmp=fractions.gcd(L[0],L[1]) else: tmp=fractions.gcd(tmp,L[i]) if tmp<K and K%tmp==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s162006417
p03651
u527993431
1588455758
Python
Python (3.4.3)
py
Runtime Error
17
3060
459
import fractions N,K=map(int,input().split()) L=list(map(int,input().split())) tmp=0 if max(L)<K: print("IMPOSSIBLE") exit() for i in range(1,N): if i==1: if L[0]==K or L[i]==K: print("POSSIBLE") exit() tmp=fractions.gcd(L[0],L[1]) if tmp<=K and K%tmp==0: print("POSSIBLE") exit() else: ifL[i]==K...
s303419487
p03651
u627803856
1588440331
Python
PyPy3 (2.4.0)
py
Runtime Error
249
62576
297
n, k = map(int, input().split()) A = list(map(int, input().split())) # 最大公約数 def gcd(a, b): while b: a, b = b, a % b return a MAX = max(A) GCD = gcd(A[0], A[1]) for i in range(2, n): GCD = gcd(GCD, A[i]) if k % GCD == 0 and k <= MAX: print('POSSIBLE') else: print('IMPOSSIBLE')
s335973210
p03651
u263830634
1588423165
Python
PyPy3 (2.4.0)
py
Runtime Error
295
63980
235
from fractions import gcd # from math import gcd N = int(input()) A = list(map(int, input().split())) M = max(A) g = A[0] for a in A: g = gcd(g, a) if K <= M and K % g == 0: print ('POSSIBLE') else: print ('IMPOSSIBLE')
s469870942
p03651
u263830634
1588423146
Python
PyPy3 (2.4.0)
py
Runtime Error
280
64108
233
from fractions import gcd from math import gcd N = int(input()) A = list(map(int, input().split())) M = max(A) g = A[0] for a in A: g = gcd(g, a) if K <= M and K % g == 0: print ('POSSIBLE') else: print ('IMPOSSIBLE')
s158228678
p03651
u981931040
1588421495
Python
Python (3.4.3)
py
Runtime Error
81
14224
317
N, K = map(int, input().split()) A = list(map(int, input().split())) if K in A: print("POSSIBLE") exit() if max(A) < K or N == 1: print("IMPOSSIBLE") exit() A.sort() for i in range(1, N): tmp = abs(A[i - 1] - A[i]) if K % tmp == 0: print("POSSIBLE") exit() print("IMPOSSIBLE")
s132691499
p03651
u981931040
1588421391
Python
Python (3.4.3)
py
Runtime Error
83
14224
307
N, K = map(int, input().split()) A = list(map(int, input().split())) if max(A) < K: print("IMPOSSIBLE") exit() if K in A: print("POSSIBLE") exit() A.sort() for i in range(1, N): tmp = abs(A[i - 1] - A[i]) if K % tmp == 0: print("POSSIBLE") exit() print("IMPOSSIBLE")
s641817074
p03651
u992910889
1588420181
Python
PyPy3 (2.4.0)
py
Runtime Error
220
62576
366
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n,k=map(int,input().split()) A=list(map(int,input().split())) from functools import reduce from math import gcd G=reduce(gcd,A) if k%G==0 and k<=max(A): print('POSSIBLE') ...
s121084842
p03651
u312025627
1588420072
Python
PyPy3 (2.4.0)
py
Runtime Error
241
62576
525
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] A.sort() maxA = A.pop() if maxA < K or (N == 1 and maxA != K): return print("IMPOSSIBLE") g = A[0] def gcd(x, y): if y == 0: return x while y != 0: x, y...
s579387832
p03651
u312025627
1588419972
Python
PyPy3 (2.4.0)
py
Runtime Error
278
63216
488
def main(): N, K = (int(i) for i in input().split()) A = [int(i) for i in input().split()] A.sort() maxA = A.pop() if maxA < K: return print(0) g = A[0] def gcd(x, y): if y == 0: return x while y != 0: x, y = y, x % y return x for...
s735278355
p03651
u886747123
1588152089
Python
Python (3.4.3)
py
Runtime Error
114
14352
441
N, K = map(int, input().split()) A = list(map(int, input().split())) if N == 1: if A[0] == K: print("POSSIBLE") else: print("IMPOSSIBLE") exit() if K > max(A): print("IMPOSSIBLE") exit() A = list(set(A)) N = len(A) A.sort() min_diff = min([A[i] - A[i-1] for i in range(1,N)]) for...
s352337969
p03651
u228223940
1588124687
Python
PyPy3 (2.4.0)
py
Runtime Error
388
88940
274
import fractions n,k = map(int,input().split()) ai = [int(i) for i in input().split()] g = fractions.gcd(ai[0],ai[1]) for i in range(1,n-1): #print(i) g = fractions.gcd(g,ai[i+1]) if k % g == 0 and max(ai) >= k: print('POSSIBLE') else: print('IMPOSSIBLE')
s028783065
p03651
u228223940
1588124631
Python
PyPy3 (2.4.0)
py
Runtime Error
217
62576
259
import math n,k = map(int,input().split()) ai = [int(i) for i in input().split()] g = math.gcd(ai[0],ai[1]) for i in range(1,n-1): #print(i) g = math.gcd(g,ai[i+1]) if k % g == 0 and max(ai) >= k: print('POSSIBLE') else: print('IMPOSSIBLE')
s434793909
p03651
u992910889
1587749287
Python
PyPy3 (2.4.0)
py
Runtime Error
219
62576
369
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): N,K=map(int,input().split()) A=list(map(int,input().split())) ma=max(A) from functools import reduce from math import gcd g=reduce(gcd,A) if K%g==0 and K<=ma: print('PO...
s912177966
p03651
u678167152
1587245423
Python
Python (3.4.3)
py
Runtime Error
18
3064
330
from math import gcd def check(): N, K = map(int, input().split()) A = list(map(int, input().split())) if K > max(A): return False g = A[0] for i in range(1,N): g = gcd(g,A[i]) if K%g != 0: return False return True if check(): print('POSSIBLE') else: print('IM...
s285109925
p03651
u374531474
1587181895
Python
Python (3.4.3)
py
Runtime Error
17
2940
206
from math import gcd from functools import reduce N, K = map(int, input().split()) A = list(map(int, input().split())) d = reduce(gcd, A) print('POSSIBLE' if K <= max(A) and K % d == 0 else 'IMPOSSIBLE')
s635986198
p03651
u561231954
1587171821
Python
Python (3.4.3)
py
Runtime Error
23
3564
526
INF = 10 ** 20 MOD = 10 ** 9 + 7 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from heapq import heappop,heapify,heappush from bisect import bisect_left from functools import reduce from math import gcd def main(): n,k = map(int,input().split()) a = list(map(int,input().split()))...
s902659640
p03651
u345966487
1586984396
Python
PyPy3 (2.4.0)
py
Runtime Error
355
88172
230
from fractions import gcd N,K = map(int, input().split()) A = list(map(int, input().split())) A.sort() g = A[0] for i in range(1, N): g = gcd(g, A[i]) print('POSSIBLE' if (K <= A[-1] and K % gcd_all() == 0) else 'IMPOSSIBLE')
s483186993
p03651
u210827208
1586829567
Python
Python (3.4.3)
py
Runtime Error
17
3060
333
from math import gcd n,k=map(int,input().split()) A=list(map(int,input().split())) A.sort() if k>A[-1]: print('IMPOSSIBLE') else: a=A[0] for i in range(n): a=gcd(a,A[i]) if a==1: print('POSSIBLE') else: if k%a==0: print('POSSIBLE') else: print(...
s372264650
p03651
u548303713
1586572732
Python
PyPy3 (2.4.0)
py
Runtime Error
210
62576
307
import math N,K=map(int,input().split()) a=list(map(int,input().split())) bef=a[0] gcd=a[0] max_=a[0] for i in range(1,N): if max_<a[i]: max_=a[i] gcd=math.gcd(gcd,a[i]) if max_<K: print("IMPOSSIBLE") else: if K%gcd==0: print("POSSIBLE") else: print("IMPOSSIBLE")
s476918869
p03651
u139112865
1586543689
Python
Python (3.4.3)
py
Runtime Error
17
3064
301
from math import gcd n, k = map(int, input().split()) a = list(map(int, input().split())) a_gcd = a[0] for i in range(1, n): a_gcd = gcd(a_gcd, a[i]) ans = True if k > max(a): ans = False if k % a_gcd != 0: ans = False if k in a: ans = True print('POSSIBLE' if ans else 'IMPOSSIBLE')
s227703736
p03651
u179169725
1586478997
Python
Python (3.4.3)
py
Runtime Error
17
3060
685
# https://atcoder.jp/contests/agc018/tasks/agc018_a import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def read_ints(): return list(map(int, read().split())) from math import gcd N, K = read_ints() A = read_ints() # 結論からいうとKがminとmaxの間でかつ、gcd(A)の倍数であるならば、必ずKを構成することができる...
s025022938
p03651
u995062424
1586442029
Python
Python (3.4.3)
py
Runtime Error
128
14108
405
N, K = map(int, input().split()) A = list(map(int, input().split())) max_A = max(A) A.sort() if(max_A < K): print("IMPOSSIBLE") else: num = 10**10 for i in range(N-1): num = min(num, abs(A[i]-A[i+1])) for i in range(N): if(A[i] < K): continue if((K-A[i])%num == 0): ...
s777650872
p03651
u198062737
1586203460
Python
PyPy3 (2.4.0)
py
Runtime Error
251
59092
398
N, K = map(int, input().split(" ")) A = list(map(int, input().split(" "))) A.sort() diff = 10 ** 9 for i in range(N - 1): diff = min(A[i + 1] - A[i], diff) if abs(A[0] - diff) > 0: diff = min(abs(A[0] - diff), diff) can_make = False for i in range(N): if A[i] % diff == K % diff and A[i] >= K: can...
s625076779
p03651
u896741788
1585767566
Python
Python (3.4.3)
py
Runtime Error
17
3060
234
n,k=map(int,input().split()) l=soted(list(map(int,input().split()))) def gcd(x,y): if y==0:return x return gcd(y,x%y) ans="" s=0 for i in l: s=gcd(i,s) if s==1:break else: if k%s!=l[-1]%s: ans="IM" print(ans+"POSSIBLE")
s395154796
p03651
u896741788
1585767515
Python
Python (3.4.3)
py
Runtime Error
18
3064
227
n,k=map(int,input().split()) l=soted(map(int,input().split())) def gcd(x,y): if y==0:return x return gcd(y,x%y) ans="" s=0 for i in l: s=gcd(i,s) if s==1:break else: if k%s!=l[-1]%s: ans="IM" print(ans+"POSSIBLE")
s336828504
p03651
u790710233
1585655696
Python
Python (3.4.3)
py
Runtime Error
121
14224
344
n, k = map(int, input().split()) A = sorted(map(int, input().split())) INF = 10**5 diff = INF for x, y in zip(A, A[1:]): diff = min(diff, abs(x-y)) MAX = A[-1] ans = False for a in A: if a-k < 0: continue x, r = divmod((a-k), diff) if r == 0: ans = True break print("POSSIBLE" if...
s268599570
p03651
u325282913
1585542129
Python
PyPy3 (2.4.0)
py
Runtime Error
332
88172
256
import fractions N, K = map(int, input().split()) arr = list(map(int, input().split())) t = fractions.gcd(arr[0],arr[1]) for i in range(1,N): t = fractions.gcd(t,arr[i]) if max(arr) < K or K % t != 0: print('IMPOSSIBLE') else: print('POSSIBLE')
s175530258
p03651
u535423069
1585038638
Python
Python (3.4.3)
py
Runtime Error
180
23112
860
# Author: cr4zjh0bp # Created: Mon Mar 23 15:10:04 UTC 2020 import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: f...
s782664682
p03651
u170183831
1584971747
Python
Python (3.4.3)
py
Runtime Error
73
14100
271
def gcd(a, b): if a > b: a, b = b, a while a % b != 0: a, b = b, a % b return b n, k = map(int, input().split()) A = list(map(int, input().split())) l = A.pop() for a in A: l = gcd(l, a) print('POSSIBLE' if k % l == 0 and max(A) >= k else 'IMPOSSIBLE')
s720480568
p03651
u185325486
1584626092
Python
Python (3.4.3)
py
Runtime Error
53
14612
269
import math from functools import reduce def gcd(numbers): return reduce(math.gcd, numbers) N,K = map(int, input().split()) A = [int(i) for i in input().split()] a = gcd(A) cnt = max(A) while cnt > K: cnt -= a print('POSSIBLE' if cnt == K else 'IMPOSSIBLE')
s766470552
p03651
u594244257
1584625264
Python
Python (3.4.3)
py
Runtime Error
17
3060
439
from math import gcd import functools def gcd_list(l): return functools.reduce(gcd, l) def solve(): N,K = map(int, input().split()) A = list(map(int, input().split())) d = gcd_list(A) ret = False if K > max(A): print('IMPOSSIBLE') return for a in A: if (a-K)%d ...
s068530499
p03651
u821432765
1584203706
Python
Python (3.4.3)
py
Runtime Error
117
14224
353
N, K = [int(i) for i in input().split()] A = sorted([int(i) for i in input().split()], reverse=True) for v in A: if K==v: print("POSSIBLE") quit() if K > A[0]: print("IMPOSSIBLE") quit() d = [] for i in range(N-1): d.append(A[i]-A[i+1]) for v in d: K %= v if K: print("IMPOSSI...
s125308631
p03651
u504836877
1584147645
Python
Python (3.4.3)
py
Runtime Error
120
14252
502
N,K = map(int, input().split()) A = [int(a) for a in input().split()] L = sorted(A) while True: s = set() for i in range(len(L)-1): s.add(L[i+1]-L[i]) L = list(s) L.sort() if L[0] == 1 or len(L) == 1: break if K > max(A): ans = "IMPOSSIBLE" elif K in A or L[0] == 1: ans = "...
s209819185
p03651
u504836877
1584147520
Python
Python (3.4.3)
py
Runtime Error
2104
14096
490
N,K = map(int, input().split()) A = [int(a) for a in input().split()] L = sorted(A) s = set() while len(s) != 1: for i in range(len(L)-1): s.add(L[i+1]-L[i]) L = list(s) L.sort() if L[0] == 1: break if K > max(A): ans = "IMPOSSIBLE" elif K in A or L[0] == 1: ans = "POSSIBLE" el...
s055905184
p03651
u623231048
1582779932
Python
Python (3.4.3)
py
Runtime Error
73
14252
336
n,k = map(int,input().split()) a = list(map(int,input().split())) def gcd(a, b): while b: a, b = b, a % b return a gcd1 = gcd(a[0], a[1]) for i in range(2,n): gcd1 = gcd(gcd1,a[i]) if k > max(a): print('IMPOSSIBLE') else: if k % gcd1 == 0: print('POSSIBLE') else: prin...
s548112379
p03651
u861141787
1582717355
Python
Python (3.4.3)
py
Runtime Error
80
14224
311
n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() if max(a) < k: print("IMPOSSIBLE") exit() for i in range(n-1): if k == a[i]: print("POSSIBLE") break if k % (a[i+1] - a[i]) == 0: print("POSSIBLE") break else: print("IMPOSSIBLE")