s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s447933125 | p02574 | u054471580 | 1598735771 | Python | Python (3.8.2) | py | Runtime Error | 1971 | 134508 | 1041 | import math
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError('n is int type.')
if n < 2:
raise ValueError('n is more than 2')
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
... | Traceback (most recent call last):
File "/tmp/tmpyfgqoy6l/tmpgp08uyjo.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s674694809 | p02574 | u168416324 | 1598735707 | Python | PyPy3 (7.3.0) | py | Runtime Error | 279 | 189288 | 632 | import math
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
mxa=max(a)
flg=True
table=[0]*(mxa+1)
for (i,x) in zip(a,range(len(a))):
if i==1:
continue
fc=[]
tmp=i
for j in range(2, int(-(-num**0.5//1))+1):
if tmp%j==0:
while tmp%j==0:
temp//=j
... | Traceback (most recent call last):
File "/tmp/tmpshfnjbpu/tmpceo7o6h3.py", line 4, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s456870831 | p02574 | u560988566 | 1598735686 | Python | PyPy3 (7.3.0) | py | Runtime Error | 258 | 179400 | 1611 | import math
from collections import deque
n = int(input())
als = list(map(int, input().split()))
ans = "not coprime"
a, b = als[1], als[0]
if a < b:
a,b = b,a
while a % b != 0:
a, b = b, a % b
if n == 2 and b == 1:
ans = "pairwise coprime"
failed = True
for i in range(2, n):
a = als[... | Traceback (most recent call last):
File "/tmp/tmpihakicw0/tmpe3pmls6_.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s676328769 | p02574 | u847923740 | 1598735661 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 196996 | 625 | from math import gcd
N = int(input())
A = list(map(int, input().split()))
sieve = [1] * (10**5*5+1)
for i in range(2, 10**3):
if sieve[i] == 1:
sieve[i] = i
j = 2
while(j * i <= 10**5*5):
sieve[j * i] = i
j += 1
sieve[1] = 0
g = A[0]
a = 0
for i in range(1, N):
g = gcd(g, A[i])
if A[i] == 1:
a = 1
... | Traceback (most recent call last):
File "/tmp/tmpzv8ebdbm/tmpwtwdda1j.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s475041588 | p02574 | u054471580 | 1598735659 | Python | Python (3.8.2) | py | Runtime Error | 1726 | 126952 | 1035 | import math
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError('n is int type.')
if n < 2:
raise ValueError('n is more than 2')
prime = []
limit = math.sqrt(n)
data = [i + 1 for i in range(1, n)]
while True:
p = data[0]
if limit <= p:
... | Traceback (most recent call last):
File "/tmp/tmp98_wrk75/tmp5p9crnbx.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s800466156 | p02574 | u560988566 | 1598735648 | Python | PyPy3 (7.3.0) | py | Runtime Error | 304 | 194384 | 1605 | import math
from collections import deque
n = int(input())
als = list(map(int, input().split()))
ans = "not coprime"
a, b = als[1], als[0]
if a < b:
a,b = b,a
while a % b != 0:
a, b = b, a % b
if n == 2 and b == 1:
ans = "pairwise coprime"
failed = True
for i in range(2, n):
a = als[... | Traceback (most recent call last):
File "/tmp/tmp_3m37uho/tmp6dcxu9d7.py", line 4, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s615083064 | p02574 | u127873832 | 1598735618 | Python | PyPy3 (7.3.0) | py | Runtime Error | 331 | 205244 | 762 | def arrayF(n):
F=[0]*(n+1)
i=2
while i*i<=n:
if F[i] == 0:
k=i*i
while k <= n:
if F[k] == 0:
F[k] = i
k += i
i += 1
return F
def factorization(x, F):
primeFactors = []
while F[x] > 0:
prim... | Traceback (most recent call last):
File "/tmp/tmprxgzjag8/tmp_gqxkij0.py", line 24, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s693895077 | p02574 | u804800128 | 1598735618 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9056 | 804 | import sympy
import sys
input = sys.stdin.readline
def main():
n = int( input() )
Primes = [ -1 for i in range( 10 ** 6 + 1 ) ]
Primes_num = []
I = list( map( int, input().split() ) )
for i in range( n ):
a = I[i]
x = sympy.factorint( a )
for key in x:
if Primes[... | Traceback (most recent call last):
File "/tmp/tmpv84r952p/tmpat3p54wq.py", line 37, in <module>
main()
File "/tmp/tmpv84r952p/tmpat3p54wq.py", line 6, in main
n = int( input() )
^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s231799604 | p02574 | u804800128 | 1598735575 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9000 | 804 | import sympy
import sys
input = sys.stdin.readline
def main():
n = int( input() )
Primes = [ -1 for i in range( 10 ** 6 + 1 ) ]
Primes_num = []
I = list( map( int, input().split() ) )
for i in range( n ):
a = I[i]
x = sympy.factorint( a )
for key in x:
if Primes[... | Traceback (most recent call last):
File "/tmp/tmp622100vf/tmp4xb_tj9i.py", line 37, in <module>
main()
File "/tmp/tmp622100vf/tmp4xb_tj9i.py", line 6, in main
n = int( input() )
^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s217382144 | p02574 | u133864042 | 1598735263 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 133128 | 623 | import math
from collections import defaultdict as dd
def get_prime_factors(n):
prime_factor = set()
divided = n
for i in range(2, int(math.sqrt(n)//1)+1):
while divided%i == 0:
prime_factor.add(i)
divided //= i
if divided != 1:
prime_factor.add(divided)
return prime_factor
N = int(input... | Traceback (most recent call last):
File "/tmp/tmptyz0sjka/tmp_vsumkvp.py", line 15, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s108186367 | p02574 | u683769494 | 1598735093 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9008 | 1903 | // lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
// -fsanitize=undefinedでオーバーフロー検出
#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"... | File "/tmp/tmpf46h_u95/tmpb7svx55h.py", line 1
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで
^^
SyntaxError: invalid syntax
| |
s608043755 | p02574 | u108617242 | 1598734936 | Python | PyPy3 (7.3.0) | py | Runtime Error | 652 | 217796 | 752 | import math
def eratos(n):
isprime = [0 for i in range(n+1)]
# isprime[0] = 0
isprime[1] = 1
for i in range(2, int(math.sqrt(n))+1):
if isprime[i] == 0:
j = i
while j <= n:
if isprime[j] == 0:
isprime[j] = i
j = j + i
... | Traceback (most recent call last):
File "/tmp/tmp6h4986e1/tmpk9eth5fm.py", line 15, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s989253088 | p02574 | u224346910 | 1598734909 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 243704 | 1321 | from math import gcd
import sys
def sieve(N):
# 昇順リストの用意
A_list = [i for i in range(2, N+1)]
limit = A_list[-1]
# ふるいにかけられたかどうかを示すbooleanの辞書
sieve = {i: True for i in A_list}
# 順にふるいにかける
for a in A_list:
if not sieve[a]:
continue
for i in range(2*a, limit+1, a)... | Traceback (most recent call last):
File "/tmp/tmpoc6wnlp0/tmpiwbs8xiq.py", line 28, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s795342282 | p02574 | u633255271 | 1598734890 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 181564 | 991 | N = int(input())
A = list(map(int, input().split()))
A.sort()
R = int(A[-1]**0.5)
is_pairwise_coprime = True
is_setwise_coprime = True
checked = [0]*(R+2)
l = 0
for i in range(2, R+2):
if checked[i]:
continue
# 調べる範囲を狭める
while A[l] < i:
l += 1
if l == N-1:
break
#... | Traceback (most recent call last):
File "/tmp/tmpznv70nm6/tmp_q12wncz.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s741625507 | p02574 | u560988566 | 1598734825 | Python | PyPy3 (7.3.0) | py | Runtime Error | 109 | 68524 | 1104 | import math
n = int(input())
als = list(map(int, input().split()))
ans = "not coprime"
a, b = als[1], als[0]
if a < b:
a,b = b,a
while a % b != 0:
a, b = b, a % b
if n == 2 and b == 1:
ans = "pairwise coprime"
failed = True
for i in range(2, n):
a = als[i]
if a < b:
a,b =... | File "/tmp/tmpy78uxxz0/tmpx0r01nfq.py", line 25
break
^^^^^
SyntaxError: 'break' outside loop
| |
s880084185 | p02574 | u270144704 | 1598734574 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 186968 | 495 | from math import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
tmp = [set() for _ in range(10**2+1)]
for i in range(2, 10**2//2+1):
for j in range(i, 10**2+1, i):
tmp[j].add(i)
flag = False
for i in range(n-1):
if len(tmp[a[i]] & tmp[max(a)]) > 0:
flag ... | Traceback (most recent call last):
File "/tmp/tmpxk63hpos/tmp98n3hai5.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s416376044 | p02574 | u021019433 | 1598734551 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8904 | 440 | = 1000001
spf = [*range(N)]
i = 2
while i * i < N:
if spf[i] == i:
for j in range(i * i, N, i):
if spf[j] == j:
spf[j] = i
i += 1
t = 'setwise', None, 'pairwise', 'not'
r = 0
input()
u = set()
i = None
for x in map(int, input().split()):
s = set()
while x > 1:
p = spf[x]
if p in u... | File "/tmp/tmpzbjp5jo6/tmprcp5yiha.py", line 1
= 1000001
IndentationError: unexpected indent
| |
s230391011 | p02574 | u627600101 | 1598734535 | Python | PyPy3 (7.3.0) | py | Runtime Error | 341 | 209828 | 974 | from math import gcd
# = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))
mA = max(A)
counter = [0 for _ in range(mA+1)]
primenum = [2]
sgn = [-1 for _ in range(int(mA**0.5)+1)]
k = 3
while k**2 <= mA:
if sgn[k] == -1:
primenum.append(k)
add = k*k
ok = k
while k**2 <= m... | Traceback (most recent call last):
File "/tmp/tmpn2dnmv6k/tmplotspbsh.py", line 4, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s553135965 | p02574 | u349449706 | 1598734445 | Python | PyPy3 (7.3.0) | py | Runtime Error | 278 | 187216 | 558 | import math
from functools import reduce
def gcbd_list(numbers):
return reduce(math.gcd, numbers)
N = int(input())
A = list(map(int, input().split()))
P = [False] * (16 + 1)
c = True
for i in range(N):
if P[A[i]] == True:
c = False
P[A[i]] = True
for j in range(2, math.floor(A[i]**0.5)+1):
... | Traceback (most recent call last):
File "/tmp/tmpbact7nuh/tmpj4_gy91m.py", line 5, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s956764078 | p02574 | u860002137 | 1598734431 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9172 | 428 | n = int(input())
arr = np.array(list(map(int, input().split())))
@njit
def solve(arr):
for i in range(arr.shape[0] - 1):
if np.gcd(arr[i], arr[i + 1]) != 1:
ans1 = False
break
else:
ans = True
return ans
ans1 = solve(arr)
ans2 = np.gcd.reduce(arr) == 1
if ans1 an... | Traceback (most recent call last):
File "/tmp/tmp_fedwnye/tmpks2w4gm2.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s608655872 | p02574 | u894258749 | 1598734414 | Python | PyPy3 (7.3.0) | py | Runtime Error | 97 | 68680 | 911 | from math import gcd
inpl = lambda: list(map(int,input().split()))
def primes(N):
P = []
for i in range(2,N):
sieve = 1
for p in P:
if p*p > i:
break
elif i % p == 0:
sieve = 0
break
if sieve == 0:
contin... | File "/tmp/tmpppdsrjtm/tmp90o4b7hl.py", line 46
exit()
TabError: inconsistent use of tabs and spaces in indentation
| |
s361814101 | p02574 | u311379832 | 1598734398 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 194220 | 624 | from collections import defaultdict
import math
def f(n):
yakusu = []
for i in range(1, int(n ** 0.5) + 1):
if n % i == 0:
yakusu.append(i)
if i != n // i:
yakusu.append(n // i)
for i in yakusu:
if i != 1:
d[i] += 1
d = defaultdict(int)
N... | Traceback (most recent call last):
File "/tmp/tmph7_k3mfg/tmpan0xqzys.py", line 16, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s166365458 | p02574 | u603958124 | 1598734396 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 138376 | 1369 | from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator impor... | Traceback (most recent call last):
File "/tmp/tmpp1plp0ta/tmp6yjx4nud.py", line 21, in <module>
n = INT()
^^^^^
File "/tmp/tmpp1plp0ta/tmp6yjx4nud.py", line 15, in INT
def INT() : return int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s458726866 | p02574 | u401487574 | 1598734389 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1212 | 201832 | 1429 | ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
def is_primes(n):
primes = [1]*n
primes[0] =0
primes[1] =0
for i in ... | Traceback (most recent call last):
File "/tmp/tmplkxlak2z/tmpkbltv_hy.py", line 37, in <module>
n =ni()
^^^^
File "/tmp/tmplkxlak2z/tmpkbltv_hy.py", line 4, in <lambda>
ni = lambda:int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s907384173 | p02574 | u391589398 | 1598734364 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2213 | 229276 | 1037 | n = int(input())
A = tuple(map(int, input().split()))
def p(n):
is_prime = [True if i%2 == 1 else False for i in range(0, n+1) ]
is_prime[0] = False
is_prime[1] = False
is_prime[2] = True # 2は素数
# 3からの奇数について
for i in range(3, int(n**0.5) + 1, 2):
# 既に素数の倍数であればスキップ
if not is_prime... | Traceback (most recent call last):
File "/tmp/tmpbzh_gw7z/tmp0r01zob6.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s460428117 | p02574 | u623283955 | 1598734320 | Python | PyPy3 (7.3.0) | py | Runtime Error | 378 | 258032 | 491 | n=int(input())
A=set(map(int,input().split()))
ma=max(A)
data=[i for i in range(2,ma+1)]
pco=True
sco=True
while len(d)>1:
d=data[0]
if d>ma**0.5:break
one=d in A
new=[]
if one:k=1
else:k=0
for e in data[1:]:
if e%d==0:
k+=1
if e in A:
if one:pco=False
else:one=True
els... | Traceback (most recent call last):
File "/tmp/tmp3t0n7xbi/tmp11dwpcxk.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s781199421 | p02574 | u401487574 | 1598734253 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1175 | 187808 | 1396 | ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
def is_primes(n):
primes = [1]*n
primes[0] =0
primes[1] =0
for i in ... | Traceback (most recent call last):
File "/tmp/tmpi5r18z25/tmp4ap3n2wn.py", line 36, in <module>
n =ni()
^^^^
File "/tmp/tmpi5r18z25/tmp4ap3n2wn.py", line 4, in <lambda>
ni = lambda:int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s120116875 | p02574 | u457901067 | 1598734227 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 214072 | 911 | def fast_prime_factorization_many(lst):
# 素因数分解(ロー法、複数)
from subprocess import Popen, PIPE
res = Popen(["factor"] + list(map(str, lst)), stdout=PIPE).communicate()[0].split(b"\n")[:-1]
return [set(list(map(int, r.split()[1:]))) for r in res]
def main():
import sys
input = sys.stdin.readline
... | Traceback (most recent call last):
File "/tmp/tmpfypjk3ir/tmp8adtptfb.py", line 34, in <module>
main()
File "/tmp/tmpfypjk3ir/tmp8adtptfb.py", line 10, in main
N = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s139525980 | p02574 | u870178975 | 1598734223 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 218148 | 530 | def resolve():
n=int(input())
a = list(map(int, input().split()))
seki=1
import math
from functools import reduce
def gcd(*numbers):
return math.gcd(*numbers)
for i in a:
seki*=i
c=seki
ch=0
for i in range(n-1):
seki=int(seki/a[i])
gc=gcd(a[i], s... | Traceback (most recent call last):
File "/tmp/tmpafk3kk83/tmpvcv8nb6i.py", line 30, in <module>
resolve()
File "/tmp/tmpafk3kk83/tmpvcv8nb6i.py", line 2, in resolve
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s630548682 | p02574 | u692054751 | 1598734121 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1319 | 253228 | 544 | N = int(input())
A = [int(s) for s in input().split()]
PRIME_LENGTH = 10**6
prime_list = [[] for _ in range(PRIME_LENGTH)]
for i in range(2, PRIME_LENGTH):
if not prime_list[i]:
idx = i
while (idx < PRIME_LENGTH):
prime_list[idx].append(i)
idx += i
vote = [0] * (PRIME_LEN... | Traceback (most recent call last):
File "/tmp/tmpqfrg03qd/tmph9pbpyzv.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s384918292 | p02574 | u588794534 | 1598734110 | Python | PyPy3 (7.3.0) | py | Runtime Error | 507 | 224444 | 854 | from math import gcd
N = int(input())
A = list(map(int,input().split()))
g = 0
for a in A:
g = gcd(g,a)
if g > 1:
print('not coprime')
exit()
sa = set(A)
if len(sa) < N:
print('setwise coprime')
exit()
MAXN = 10**10+10
sieve = [0,0] + [1]*MAXN
p = 2
small_primes = []
while p*p <= MAXN:
if sie... | Traceback (most recent call last):
File "/tmp/tmpb9l0j1gb/tmp5rcyquny.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s445965325 | p02574 | u222668979 | 1598734073 | Python | PyPy3 (7.3.0) | py | Runtime Error | 407 | 205332 | 885 | from math import gcd
def eratosthenes(n):
prime = []
data = [i for i in range(n - 1)]
while True:
p = data[0]
if n <= p ** 2:
return prime + data
prime.append(p)
data = [e for e in data if e % p != 0]
return data
def factorize(N): # 素因数分解
prime = set(... | Traceback (most recent call last):
File "/tmp/tmpecp831aj/tmpfhwbp663.py", line 29, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s449872962 | p02574 | u410558877 | 1598734071 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 132832 | 1083 | import math
def get_primenumber(number):
prime_list = []
#2からnumberまでの数字をsearch_listに入れる
search_list = list(range(2,number+1))
while True:
#search_listの先頭の値が√nの値を超えたら処理終了
if search_list[0] > math.sqrt(number):
#prime_listにsearch_listを結合
prime_list.extend(search_list)
... | Traceback (most recent call last):
File "/tmp/tmp2ar88c7i/tmpw2x1wthm.py", line 23, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s326608151 | p02574 | u391589398 | 1598734069 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2212 | 229244 | 1001 | n = int(input())
A = tuple(map(int, input().split()))
def p(n):
is_prime = [True if i%2 == 1 else False for i in range(0, n+1) ]
is_prime[0] = False
is_prime[1] = False
is_prime[2] = True # 2は素数
# 3からの奇数について
for i in range(3, int(n**0.5) + 1, 2):
# 既に素数の倍数であればスキップ
if not is_prime... | Traceback (most recent call last):
File "/tmp/tmpxkxpzh5r/tmpld9yng45.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s611532545 | p02574 | u497952650 | 1598734066 | Python | Python (3.8.2) | py | Runtime Error | 866 | 127348 | 1333 | ##https://www.codechef.com/viewsolution/20131475
from math import gcd
def main():
n = int(input())
A = list(map(int , input().split()))
N = max(A)+1
sv = [i for i in range(N)]
for i in range(2 ,int(N**2)+1) :
if sv[i] < i : continue
for j in range(i * i , N , i) :
sv[j... | Traceback (most recent call last):
File "/tmp/tmp3shcyrzx/tmpxjc904pf.py", line 65, in <module>
main()
File "/tmp/tmp3shcyrzx/tmpxjc904pf.py", line 6, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s294375551 | p02574 | u497952650 | 1598734047 | Python | Python (3.8.2) | py | Runtime Error | 816 | 127228 | 1331 | ##https://www.codechef.com/viewsolution/20131475
from math import gcd
def main():
n = int(input())
A = list(map(int , input().split()))
N = max(A)
sv = [i for i in range(N)]
for i in range(2 ,int(N**2)+1) :
if sv[i] < i : continue
for j in range(i * i , N , i) :
sv[j] ... | Traceback (most recent call last):
File "/tmp/tmpeqnmf054/tmp5yfd010q.py", line 65, in <module>
main()
File "/tmp/tmpeqnmf054/tmp5yfd010q.py", line 6, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s719679753 | p02574 | u623283955 | 1598734046 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1006 | 249184 | 487 | n=int(input())
A=set(map(int,input().split()))
ma=max(A)
data=[i for i in range(2,ma+1)]
pco=True
sco=True
while True:
d=data[0]
if d>ma**0.5:break
one=d in A
new=[]
if one:k=1
else:k=0
for e in data[1:]:
if e%d==0:
k+=1
if e in A:
if one:pco=False
else:one=True
else:
... | Traceback (most recent call last):
File "/tmp/tmpv8_eoycq/tmpwlu_95sq.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s470721655 | p02574 | u751549333 | 1598733948 | Python | PyPy3 (7.3.0) | py | Runtime Error | 80 | 68624 | 622 | import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
flag =1
if reduce(math.gcd, a) != 1:
print("not coprime")
flag = 0
if flag == 1:
for i in range(n):
for j in range(i+1, n):
if math.gcd(a[i], a[j]) != 1... | File "/tmp/tmppp_zfvju/tmpjtyesx4b.py", line 17
else:
^
IndentationError: unindent does not match any outer indentation level
| |
s281501452 | p02574 | u257234489 | 1598733941 | Python | Python (3.8.2) | py | Runtime Error | 1159 | 134484 | 716 | import math
n=int(input())
l=list(map(int,input().split()))
e=0
e1=0
e2=0
e3=0
e4=0
e5=0
e6=0
e7=0
e8=0
c=l[0]
for i in range(1,n):
c=math.gcd(l[i],c)
for i in range(n):
if(l[i]%2==0):
e+=1
if(l[i]%3==0):
e1+=1
if(l[i]%5==0):
e2+=1
if(l[i]%7==0):
e3+=1
if(l[i]%11=... | Traceback (most recent call last):
File "/tmp/tmpjcswcrl3/tmp0qmzx4qo.py", line 2, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s259491422 | p02574 | u257234489 | 1598733884 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9056 | 715 | import math
n=int(input())
l=list(map(int,input().split()))
e=0
e1=0
e2=0
e3=0
e4=0
e5=0
e6=0
e7=0
e8=0
c=l[0]
for i in range(1,n):
c=math.gcd(l[i],c)
for i in range(n):
if(l[i]%2==0):
e+=1
if(l[i]%3==0):
e1+=1
if(l[i]%5==0):
e2+=1
if(l[i]%7==0):
e3+=1
if(l[i]%11=... | File "/tmp/tmpg9n97r39/tmpsf1xrti6.py", line 37
break
TabError: inconsistent use of tabs and spaces in indentation
| |
s866896500 | p02574 | u623283955 | 1598733839 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 159876 | 486 | n=int(input())
A=set(map(int,input().split()))
ma=max(A)
data=[i for i in range(2,ma+1)]
pco=True
sco=True
while True:
d=data[0]
if d>ma**0.5:break
one=d in A
new=[]
if one:k=1
else:k=0
for e in data[1:]:
if e%d==0:
k+=1
if e in A:
if one:pco=False
else:one=True
else:
... | Traceback (most recent call last):
File "/tmp/tmp2h4gb15h/tmpj81tqysq.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s239437855 | p02574 | u028072025 | 1598733812 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 127440 | 571 | def g(a,b):
if(b==0):
return a
else:
return g(b,a%b)
def gcdarr(arr):
ans=arr[0]
for val in arr:
ans=g(ans,val)
return ans
def lcm(a,b):
return (a*b) / g(a,b)
def lcmarr(arr):
ans=arr[0]
for val in arr:
ans=lcm(ans,val)
return ans
n=int(input())
arr=list(map(int,input().split())) ... | Traceback (most recent call last):
File "/tmp/tmpwsbz45ef/tmplnl573_n.py", line 22, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s813432992 | p02574 | u123579949 | 1598733755 | Python | PyPy3 (7.3.0) | py | Runtime Error | 89 | 68712 | 1632 | import math
# 素数判定関数
def isPrime(num):
# 2未満の数字は素数ではない
if num < 2: return False
# 2は素数
elif num == 2: return True
# 偶数は素数ではない
elif num % 2 == 0: return False
# 3 ~ numまでループし、途中で割り切れる数があるか検索
# 途中で割り切れる場合は素数ではない
for i in range(3, math.floor(math.sqrt(num))+1, 2):
if num % i ==... | File "/tmp/tmptlg_w3t9/tmp8ynk4_vt.py", line 67
A=[x if x>=i for x in A]
^^^^^^^^^
SyntaxError: expected 'else' after 'if' expression
| |
s454424111 | p02574 | u919730120 | 1598733727 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2214 | 250900 | 498 | def prime_numbers(N):
A=list(range(2,N+1))
p=list()
while A[0]**2<=N:
tmp=A[0]
p.append(tmp)
A=[e for e in A if e%tmp!=0]
return p+A
n=int(input())
a=sorted(list(map(int,input().split())))
prit=prime_numbers(a[-1])
ans=2
for i in prit:
cnt=0
for j in a:
if i>j:
continue
if j%i==0... | Traceback (most recent call last):
File "/tmp/tmpf9kc71rn/tmp1ozoaqle.py", line 10, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s571324822 | p02574 | u550279454 | 1598733661 | Python | Python (3.8.2) | py | Runtime Error | 354 | 132628 | 444 | import math
N = int(input())
numbers = list(map(int, input().split()))
ans = 'pairwise coprime'
max_tmp = float('inf')
min_tmp = 0
for i in range(N - 1):
tmp = math.gcd(numbers[i], numbers[i + 1])
if (tmp > 1):
max_tmp = max(tmp, max_tmp)
min_tmp = min(tmp, min_tmp)
i... | Traceback (most recent call last):
File "/tmp/tmporcnlmq4/tmp5beaixx1.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s278304582 | p02574 | u919730120 | 1598733650 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2213 | 235072 | 498 | def prime_numbers(N):
A=list(range(2,N+1))
p=list()
while A[0]**2<=N:
tmp=A[0]
p.append(tmp)
A=[e for e in A if e%tmp!=0]
return p+A
n=int(input())
a=sorted(list(map(int,input().split())))
prit=prime_numbers(a[-1])
ans=2
for i in prit:
cnt=0
for j in a:
if i>j:
continue
if j%i==0... | Traceback (most recent call last):
File "/tmp/tmpb02wr3wn/tmp_36znfb0.py", line 10, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s740834379 | p02574 | u659159398 | 1598733647 | Python | PyPy3 (7.3.0) | py | Runtime Error | 900 | 188760 | 1470 | import sys
input = sys.stdin.readline
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def sieve_optimized(limit):
# Preprocessing step takes O(N log log N) time complexity.
n = limit
# Filimitd all primes upto n (including n)
sievebound = (n-1)//2
sieve = [-1]*(sievebound ... | Traceback (most recent call last):
File "/tmp/tmp1bz7ctgd/tmpwqf8d_5v.py", line 44, in <module>
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s984740859 | p02574 | u659159398 | 1598733608 | Python | PyPy3 (7.3.0) | py | Runtime Error | 773 | 177028 | 1464 | import sys
input = sys.stdin.readline
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def sieve_optimized(limit):
# Preprocessing step takes O(N log log N) time complexity.
n = limit
# Filimitd all primes upto n (including n)
sievebound = (n-1)//2
sieve = [-1]*(sievebound ... | Traceback (most recent call last):
File "/tmp/tmp2kmuo4hf/tmpk0nvj_ue.py", line 44, in <module>
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s548643654 | p02574 | u255943004 | 1598733608 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 68592 | 1147 | from math import gcd
from collections import defaultdict
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1:
... | File "/tmp/tmpaafq3wox/tmpwlup927u.py", line 18
if a = [1]:
^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s672020468 | p02574 | u331327289 | 1598733605 | Python | Python (3.8.2) | py | Runtime Error | 2157 | 107612 | 749 | import sys
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(math.gcd, numbers)
def main():
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
a.sort()
if gcd_list(a) != ... | Traceback (most recent call last):
File "/tmp/tmp_xlt0oox/tmp55m0x2p9.py", line 36, in <module>
main()
File "/tmp/tmp_xlt0oox/tmp55m0x2p9.py", line 16, in main
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: b''
| |
s723750592 | p02574 | u860002137 | 1598733603 | Python | Python (3.8.2) | py | Runtime Error | 28 | 8920 | 380 | import numpy as np
n = int(input())
arr = np.array(list(map(int, input().split())))
def solve()
for i in range(arr.shape[0] - 1):
if np.gcd(arr[i], arr[i + 1]) != 1:
ans1 = False
break
else:
ans1 = True
ans2 = np.gcd.reduce(arr) == 1
if ans1 and ans2:
print("pairwise coprime")
elif ans2:... | File "/tmp/tmpvxx0j2l7/tmpbtuasa16.py", line 6
def solve()
^
SyntaxError: expected ':'
| |
s688824701 | p02574 | u270144704 | 1598733602 | Python | PyPy3 (7.3.0) | py | Runtime Error | 390 | 214768 | 653 | from math import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
tmp = [set() for _ in range(10**2+1)]
for i in range(2, 10**2//2+1):
for j in range(i, 10**2+1, i):
tmp[j].add(i)
acc = [set() for _ in range(n)]
for i, v in enumerate(a):
if i == 0:
acc[i] =... | Traceback (most recent call last):
File "/tmp/tmp07k1lg9i/tmpkyrdp35i.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s143354814 | p02574 | u952467214 | 1598733600 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 206632 | 1207 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
from math import gcd
n = int(input())
a = list( map(int, input().split()))
a.sort()
lc = [0]
for aa in a:
lc.append(gcd(lc[-1], aa))
if lc[-1] != 1:
print('not coprime')
exit()
def eratosthenes(limit):
import math
if not isin... | Traceback (most recent call last):
File "/tmp/tmpd8bqgjt4/tmp3la_9zm_.py", line 8, in <module>
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s583113150 | p02574 | u123579949 | 1598733598 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 205268 | 1617 | import math
# 素数判定関数
def isPrime(num):
# 2未満の数字は素数ではない
if num < 2: return False
# 2は素数
elif num == 2: return True
# 偶数は素数ではない
elif num % 2 == 0: return False
# 3 ~ numまでループし、途中で割り切れる数があるか検索
# 途中で割り切れる場合は素数ではない
for i in range(3, math.floor(math.sqrt(num))+1, 2):
if num % i ==... | Traceback (most recent call last):
File "/tmp/tmp76dqblbp/tmp9ydzx_ke.py", line 29, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s067308191 | p02574 | u496407619 | 1598733597 | Python | PyPy2 (7.3.0) | py | Runtime Error | 804 | 217820 | 1650 | from fractions import gcd
import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
As = map(int, input().split(" "))
is_set = False
out_min = 10**6+1
first = True
A0 = As[0]
def fctr1(n):
f=[]
c=0
r=int(n**0.5)
for i in range(2,r+2):
while n%i==0:
c+=1
... | Traceback (most recent call last):
File "/tmp/tmpz5q5qy6h/tmpw_qrfrf6.py", line 1, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s658603860 | p02574 | u595905528 | 1598733593 | Python | PyPy3 (7.3.0) | py | Runtime Error | 117 | 68672 | 2389 | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().sp... | File "/tmp/tmp6m3hpmnh/tmpzcctnim9.py", line 77
break
IndentationError: unexpected indent
| |
s573037153 | p02574 | u919730120 | 1598733589 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1005 | 234936 | 501 | def prime_numbers(N):
A=list(range(2,N+1))
p=list()
while A[0]**2<=N:
tmp=A[0]
p.append(tmp)
A=[e for e in A if e%tmp!=0]
return p+A
n=int(input())
a=sorted(list(map(int,input().split())))
pri,prit=prime_numbers(a[-1])
ans=2
for i in prit:
cnt=0
for j in a:
if i>j:
continue
if j%i... | Traceback (most recent call last):
File "/tmp/tmpzvftvq45/tmpmv36icj8.py", line 10, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s946397905 | p02574 | u751549333 | 1598733588 | Python | PyPy3 (7.3.0) | py | Runtime Error | 102 | 68564 | 658 | import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
flag =1
if reduce(math.gcd, a) != 1:
print("not coprime")
flag = 0
if flag == 1:
for i in range(n):
for j in range(i+1, n):
if i!= j:
... | File "/tmp/tmpbogj4x3v/tmp48jryjnr.py", line 13
if i!= j:
^
SyntaxError: invalid character ':' (U+FF1A)
| |
s514646877 | p02574 | u825541307 | 1598733587 | Python | Python (3.8.2) | py | Runtime Error | 3883 | 194400 | 571 | N = int(input())
A = list(map(int,input().split()))
def divisors(n):
div = [1, n]
for i in range(2, int(n**0.5)+1):
if n % i == 0:
div.append(i)
if i != n//i:
div.append(n//i)
return div
flag = False
inter = set(divisors(A[0]))
union = set(divisors(A[0]))
s = len(set(divisors(A[0])))
for i in range... | Traceback (most recent call last):
File "/tmp/tmps0n9uwvt/tmpuyho8qs3.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s027265622 | p02574 | u095426154 | 1598733585 | Python | PyPy3 (7.3.0) | py | Runtime Error | 807 | 253448 | 1723 | # coding: utf-8
from math import gcd
import math
# 素数判定関数
def isPrime(num):
# 2未満の数字は素数ではない
if num < 2: return False
# 2は素数
elif num == 2: return True
# 偶数は素数ではない
elif num % 2 == 0: return False
# 3 ~ numまでループし、途中で割り切れる数があるか検索
# 途中で割り切れる場合は素数ではない
for i in range(3, math.floor(math.sq... | Traceback (most recent call last):
File "/tmp/tmp5799naly/tmpwv4lpfbc.py", line 36, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s928881091 | p02574 | u516554284 | 1598733583 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2212 | 193996 | 1307 | import math
import copy
n=int(input())
a=list(map(int,input().split()))
ch5=0
for M in a:
if M==1:
ch5+=1
a.remove(M)
if ch5>0:
a.append(1)
B=copy.deepcopy(a)
dp=[0 for _ in range(1000000+1)]
sosuu = [2]
A = 1000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
for L2 in sosuu:
if L % L2 == 0:
... | Traceback (most recent call last):
File "/tmp/tmphpv49ryv/tmpwbyxaw_y.py", line 4, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s460092364 | p02574 | u331327289 | 1598733582 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8684 | 748 | import sys
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(math.gcd, numbers)
def main():
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
a.sort()
if gcd_list(a) != ... | File "/tmp/tmpq987z7xf/tmpuhhazmpy.py", line 28
if checked=True:
^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s374896094 | p02574 | u919730120 | 1598733574 | Python | Python (3.8.2) | py | Runtime Error | 1705 | 127332 | 501 | def prime_numbers(N):
A=list(range(2,N+1))
p=list()
while A[0]**2<=N:
tmp=A[0]
p.append(tmp)
A=[e for e in A if e%tmp!=0]
return p+A
n=int(input())
a=sorted(list(map(int,input().split())))
pri,prit=prime_numbers(a[-1])
ans=2
for i in prit:
cnt=0
for j in a:
if i>j:
continue
if j%i... | Traceback (most recent call last):
File "/tmp/tmp_dy57ufm/tmp6b0bugo7.py", line 10, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s113660434 | p02574 | u475402977 | 1598733573 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9000 | 832 | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y, x % y)
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.appen... | File "/tmp/tmpjhfjfr9w/tmpr90gck3n.py", line 35
prime=set(factorization(B[i])
^
SyntaxError: '(' was never closed
| |
s593449901 | p02574 | u815878613 | 1598733573 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 144644 | 787 | import numpy as np
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError("n is int type.")
if n < 2:
raise ValueError("n is more than 2")
prime = [2]
limit = int(n ** 0.5)
data = [i + 1 for i in range(2, n, 2)]
while True:
p = data[0]
if l... | Traceback (most recent call last):
File "/tmp/tmpn4rjvi68/tmpax34dbd7.py", line 22, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s107923951 | p02574 | u513519822 | 1598733572 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 205220 | 1050 | conf = False
#n以下の素数列挙(O(n log(n))
def primes(n):
ass = []
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
for i in ... | Traceback (most recent call last):
File "/tmp/tmpm6clcqqg/tmpquv444lh.py", line 45, in <module>
print(main())
^^^^^^
File "/tmp/tmpm6clcqqg/tmpquv444lh.py", line 31, in main
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s266474460 | p02574 | u623283955 | 1598733571 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8880 | 471 | n=int(input())
A=set(map(int,input().split()))
ma=max(A)
data=[i for i in range(2,ma)]
pco=True
sco=True
while True:
d=data[0]
if d>ma**0.5:break
one=d in A
new=[]
if one:k=1
else:k=0
for e in data[1:]:
if e%d==0:
k+=1
if e in A:
if one:pco=False
else:one=True
else:
... | File "/tmp/tmpuom86ucy/tmpx366cx8x.py", line 24
sco=False
TabError: inconsistent use of tabs and spaces in indentation
| |
s093935590 | p02574 | u920977317 | 1598733566 | Python | Python (3.8.2) | py | Runtime Error | 436 | 132568 | 601 | import math
def main():
N=int(input())
A=list(map(int,input().split()))
pairwise_flag=0
setwise_flag=1
gcd_list=[]
g=A[N-1]
for i in range(N-1,0,-1):
g=math.gcd(g,A[i-1])
gcd_list.append(g)
for i in range(N-1,0,-1):
g=gcd_list[i]
if i==0 and g==1:
... | Traceback (most recent call last):
File "/tmp/tmp7o4z4dsh/tmp8194vtj3.py", line 33, in <module>
main()
File "/tmp/tmp7o4z4dsh/tmp8194vtj3.py", line 4, in main
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s360981064 | p02574 | u595905528 | 1598733566 | Python | PyPy3 (7.3.0) | py | Runtime Error | 153 | 73784 | 2369 | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().sp... | File "/tmp/tmpu1u40382/tmpsn1ub_7w.py", line 76
break
IndentationError: unexpected indent
| |
s775695213 | p02574 | u268554510 | 1598733563 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 197704 | 654 | N = int(input())
A = list(map(int,input().split()))
from fractions import gcd
setwise = A[0]
A = sorted(A,reverse = True)
prime = [0] * (10**6+1)
judge = True
for a in A:
setwise = gcd(setwise,a)
if prime[a]:
continue
else:
prime[a] += 1
if a%2==0:
if prime[2]:
judge = False
pri... | Traceback (most recent call last):
File "/tmp/tmp8mpc_a36/tmpttc_qkvh.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s280286204 | p02574 | u518085378 | 1598733562 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9156 | 1040 | import sympy
import bisect
def fprimes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for i in range(n + ... | Traceback (most recent call last):
File "/tmp/tmpbbxpuk6g/tmp6t1cn11w.py", line 17, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s256184628 | p02574 | u773081031 | 1598733545 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8964 | 225 | import math
N = int(input())
A = list(map(int, input().split()))
g = [math.gcd(A[i], A[j]) i for in range(N-1) j for in range(i, N)]
n = 0
for i in g:
if i!=1:
break
n += 1
if n==len(g):
print("pairwise coprime") | File "/tmp/tmp4q1cp8_d/tmp90ygexbl.py", line 6
g = [math.gcd(A[i], A[j]) i for in range(N-1) j for in range(i, N)]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
| |
s127764027 | p02574 | u961223096 | 1598733531 | Python | PyPy3 (7.3.0) | py | Runtime Error | 92 | 74700 | 3671 | //////// Coprime
// https://atcoder.jp/contests/abc177/tasks/abc177_e
// date: 2020-08-29T21:00:28.779732
// memo:
//<editor-fold desc="my macro">
#include<bits/stdc++.h>
#ifdef LOCAL
#include<my/dump.h>
#else
#define dump(...) 42
#define dumpi(x) 42
#endif
typedef long long ll;
using namespace s... | File "/tmp/tmpktxzgydk/tmpatjcdoni.py", line 3
// date: 2020-08-29T21:00:28.779732
^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
| |
s550007464 | p02574 | u391382440 | 1598733522 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9020 | 329 | d = {}
N = int(input())
A = list(map(int,input().split()))
for ai in A:
for prime in factorization(ai):
if prime[0] in d.keys():
d[prime[0]] += 1
else:
d[prime[0]] = 1
if max(d.values()) == N:
print("not coprime")
elif max(d.values()) == 1:
print("pairwise coprime")
else:
print("setwise ... | File "/tmp/tmp8d7wf4hr/tmpb3omk4iy.py", line 6
if prime[0] in d.keys():
TabError: inconsistent use of tabs and spaces in indentation
| |
s905951106 | p02574 | u659159398 | 1598733522 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1001 | 188180 | 1429 |
import sys
input = sys.stdin.readline
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def sieve_optimized(limit):
# Preprocessing step takes O(N log log N) time complexity.
n = limit
# Filimitd all primes upto n (including n)
sievebound = (n-1)//2
sieve = [-1]*(sievebound... | Traceback (most recent call last):
File "/tmp/tmpnwk9hccw/tmppdj76ohc.py", line 44, in <module>
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s335596453 | p02574 | u815878613 | 1598733520 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 145296 | 785 | import numpy as np
def get_sieve_of_eratosthenes(n):
if not isinstance(n, int):
raise TypeError("n is int type.")
if n < 2:
raise ValueError("n is more than 2")
prime = [2]
limit = int(n ** 0.5)
data = [i + 1 for i in range(2, n, 2)]
while True:
p = data[0]
if l... | Traceback (most recent call last):
File "/tmp/tmpxzsiy16x/tmpryty5qg7.py", line 22, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s324242961 | p02574 | u779170803 | 1598733520 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 68620 | 1344 | import numpy as np
import math
from functools import reduce
from copy import deepcopy
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def p... | Traceback (most recent call last):
File "/tmp/tmpavjuvj1d/tmpfi2nzaj6.py", line 58, in <module>
do()
File "/tmp/tmpavjuvj1d/tmpfi2nzaj6.py", line 33, in do
n=INT()
^^^^^
File "/tmp/tmpavjuvj1d/tmpfi2nzaj6.py", line 6, in <lambda>
INT = lambda: int(input())
^^^^^^^
EOFError:... | |
s778980053 | p02574 | u516554284 | 1598733515 | Python | PyPy3 (7.3.0) | py | Runtime Error | 308 | 193704 | 1305 | import math
import copy
n=int(input())
a=list(map(int,input().split()))
ch5=0
if M in a:
if M==1:
ch5+=1
a.remove(M)
if ch5>0:
a.append(1)
B=copy.deepcopy(a)
dp=[0 for _ in range(1000000+1)]
sosuu = [2]
A = 1000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
for L2 in sosuu:
if L % L2 == 0:
... | Traceback (most recent call last):
File "/tmp/tmpv2pvefsb/tmp44r0xfy_.py", line 4, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s787789679 | p02574 | u699008198 | 1598733510 | Python | Python (3.8.2) | py | Runtime Error | 805 | 132572 | 531 | import math
N = int( input() )
A = sorted( list(map(int, input().split())))
ans = A[0]
L = []
mod = 10 ** 7 + 9
cnt = 0
for i in range(1, N):
ans = math.gcd(ans, A[i])
if ans == 1:
break
else:
cnt += 1
if ans != 1:
ret = "not coprime"
else:
if cnt > 0:
ret = "setwise coprime"
else:
... | Traceback (most recent call last):
File "/tmp/tmpyv_fpgr9/tmp_2qwhug5.py", line 2, in <module>
N = int( input() )
^^^^^^^
EOFError: EOF when reading a line
| |
s001949106 | p02574 | u633255271 | 1598733495 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 197872 | 789 | N = int(input())
A = list(map(int, input().split()))
A.sort()
m = A[0]
R = int(A[-1]**0.5)
is_pairwise_coprime = True
is_setwise_coprime = True
checked = [0]*(R+2)
l = 0
for i in range(2, R+2):
if checked[i]:
continue
while A[l] < i:
l += 1
if l == N-1:
break
tmp ... | Traceback (most recent call last):
File "/tmp/tmp2nxaih9p/tmpcj_pzani.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s221409121 | p02574 | u651109406 | 1598733461 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 197256 | 769 | N = int(input())
A = list(map(int, input().split()))
def erat():
tmp = [False if i == 0 or i == 1 else True for i in range(10 ** 3)]
for i in range(2, 10 ** 3):
if tmp[i]:
for j in range(2 * i, 10 ** 3, i):
tmp[j] = False
yield i
a = {}
for i in erat():
for ... | Traceback (most recent call last):
File "/tmp/tmpv1q8kn3a/tmprqga0rev.py", line 1, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s923772545 | p02574 | u021814034 | 1598733432 | Python | PyPy3 (7.3.0) | py | Runtime Error | 98 | 74624 | 2656 | import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input=sys.stdin.readline
from random import randint
##import numpy as np
##sys.setrecursionlimit(10**7)
mo=10**9+7
def cin():
return map(int,sin().split())
def ain():
return list(map(in... | File "/tmp/tmp6s_e0b7w/tmpxgt0zios.py", line 56
for j in lp:
^
IndentationError: unindent does not match any outer indentation level
| |
s183206846 | p02574 | u735891571 | 1598733420 | Python | PyPy3 (7.3.0) | py | Runtime Error | 388 | 207240 | 1111 | # -*- coding: utf-8 -*-
from bisect import bisect_right
import math
from functools import reduce
def gcd(*numbers):
return reduce(math.gcd, numbers)
def gcd_list(numbers):
return reduce(math.gcd, numbers)
def primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for ... | Traceback (most recent call last):
File "/tmp/tmp3nru_xx7/tmpf5jxnwxm.py", line 26, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s130260014 | p02574 | u257234489 | 1598733398 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8964 | 568 | import math
n=int(input())
l=list(map(int,input().split()))
e=0
e1=0
e2=0
e3=0
c=l[0]
for i in range(1,n):
c=math.gcd(l[i],c)
for i in range(n):
if(l[i]%2==0):
e+=1
if(l[i]%3==0):
e1+=1
if(l[i]%5==0):
e2+=1
if(l[i]%7==0):
e3+=1
l.sort()
aa=0
for i in range(n//2):
... | File "/tmp/tmp1895aa74/tmpd3fvqwqv.py", line 28
if(e<=1 and e1<=1 and e2<=1 and e3<=1 and aa=0 and c==1):
^
SyntaxError: invalid syntax
| |
s640381186 | p02574 | u498677593 | 1598733387 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 197360 | 449 | import math
N=int(input())
A=list(map(int,input().split()))
ans1 = A[0]
ans2 = 0
f = True
for i in range(1, N):
ans1 = math.gcd(ans1, A[i])
for j in range(i+1, N):
ans2 = math.gcd(A[i-1],A[j-1])
if (ans2 > 1):
f = False
break
if f==False and ans !=1:
break
i... | Traceback (most recent call last):
File "/tmp/tmpoeii3x5h/tmprobrbksa.py", line 2, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s066204457 | p02574 | u997641430 | 1598733358 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1214 | 289008 | 643 | n = int(input())
*A, = map(int, input().split())
m = max(A)
is_prime = [True] * (m + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, m + 1):
for j in range(i * 2, m + 1, i):
is_prime[j] = False
primes = [i for i in range(m + 1) if is_prime[i]]
Amap = {a: 0 for a in range(1, m + 1)}
for a in A... | Traceback (most recent call last):
File "/tmp/tmp928252w9/tmp68zleqvs.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s883154519 | p02574 | u731362892 | 1598733317 | Python | PyPy3 (7.3.0) | py | Runtime Error | 110 | 68332 | 521 |
import math
import numpy
import functools
import operator
n=int(input())
a = list(map(int, input().split()))
pair_check=[]
ans1 = a[0]
for i in range(1, n):
ans1 = ans1 * a[i] // math.gcd(ans1, a[i])
#N個の最小公倍数
ans = a[0]
pair_check_check=0
for i in range(1, n):
ans = math.gcd(ans, a[i])
#N個の最大公約数
re... | Traceback (most recent call last):
File "/tmp/tmpl34qxsmz/tmpjn_m19i2.py", line 7, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s157714875 | p02574 | u127873832 | 1598733285 | Python | PyPy3 (7.3.0) | py | Runtime Error | 85 | 68680 | 1080 | from math import sqrt
from collections import Counter
import sys
import numpy as np
def factorize(n):
rt = int(sqrt(n)+1)
facts = []
for i in range(2, rt+1):
if n % i == 0:
facts.append(i)
while n % i == 0:
n //= i
if n != 1:
facts.append(n)
r... | Traceback (most recent call last):
File "/tmp/tmpfkxijy_o/tmpch56bqrs.py", line 32, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s680383431 | p02574 | u307592354 | 1598733278 | Python | PyPy3 (7.3.0) | py | Runtime Error | 294 | 191680 | 718 | def resolve():
N = int(input())
A = list(map(int,input().split()))
sosus = set(get_primes(max(A)+1))
dvd = set()
val = A[0]
for i in A:
val = math.gcd(i,val)
if val ==1:
pass
else:
print('not coprime')
return
for i in A:
tmp=[]
for... | Traceback (most recent call last):
File "/tmp/tmpeud7vn41/tmpgs9z0mn_.py", line 40, in <module>
resolve()
File "/tmp/tmpeud7vn41/tmpgs9z0mn_.py", line 2, in resolve
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s302142092 | p02574 | u876742094 | 1598733272 | Python | PyPy3 (7.3.0) | py | Runtime Error | 343 | 205208 | 509 | def gcd(x, y):
if y == 0:
return x
else:
return gcd(y,x%y)
def lcm(a,b):
return int(a*b/gcd(a,b))
n=int(input())
a=list(map(int,input().split()))
b=gcd(a[0],a[1])
res1=True
c=[1]*n
for i in range(1,n):
c[i]=lcm(c[i-1],a[n-i])
for i in range(n-1):
d=a[i];e=a[i+1];f=c[n-i-1]
if ... | Traceback (most recent call last):
File "/tmp/tmpw779934d/tmpwrqt6wp_.py", line 10, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s238541383 | p02574 | u952467214 | 1598733251 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 215120 | 1119 | import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
from math import gcd
n = int(input())
a = list( map(int, input().split()))
a.sort()
lc = [0]
for aa in a:
lc.append(gcd(lc[-1], aa))
if lc[-1] != 1:
print('not coprime')
exit()
def eratosthenes(limit):
import math
if not isin... | Traceback (most recent call last):
File "/tmp/tmppra0mupe/tmpedpyyoqt.py", line 8, in <module>
n = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s317707994 | p02574 | u221061152 | 1598733238 | Python | PyPy3 (7.3.0) | py | Runtime Error | 113 | 68644 | 251 | prime = sieve_of_eratosthenes(2*10**5+1)
g = gcd_list(A)
if g != 1: print('not coprime');exit();
for p in prime:
cnt = 0
for a in A:
if a%p == 0: cnt += 1
if cnt == 2:
print('setwise coprime')
exit()
print('pairwise coprime')
| Traceback (most recent call last):
File "/tmp/tmp705zk8j9/tmpurhprwt2.py", line 1, in <module>
prime = sieve_of_eratosthenes(2*10**5+1)
^^^^^^^^^^^^^^^^^^^^^
NameError: name 'sieve_of_eratosthenes' is not defined
| |
s742152412 | p02574 | u768944351 | 1598733234 | Python | PyPy3 (7.3.0) | py | Runtime Error | 88 | 68584 | 567 | rom math import gcd
def MinimumGCD(arr, n):
g = 0
for i in range(n):
g = gcd(g, arr[i])
return g
def isPrime(k):
if (k == 1):
return 0
else:
i=2
while(i*i<k):
if(k%i==0):
return 1
i+=1
return 0
n=int(input())
a=list... | File "/tmp/tmp9_j3et_6/tmp3skhf016.py", line 1
rom math import gcd
^^^^
SyntaxError: invalid syntax
| |
s896707956 | p02574 | u642012866 | 1598733224 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2210 | 243352 | 811 | from collections import Counter
N = int(input())
A = list(set((map(int, input().split()))))
pc = True
if N != len(A):
pc = False
N = len(A)
gg = False
cnt = Counter()
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
while temp%i==0... | Traceback (most recent call last):
File "/tmp/tmp_z8eo046/tmpvg7s60y7.py", line 2, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s924614505 | p02574 | u762540523 | 1598733195 | Python | PyPy3 (7.3.0) | py | Runtime Error | 672 | 205896 | 888 | def PrimeFactorization(n):
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
yield i
n //= i
while n % i == 0:
n //= i
if n > 1:
yield n
def resolve():
n = int(input())
a = list(map(int, input().split()))
pairwise = True
d ... | Traceback (most recent call last):
File "/tmp/tmp4910mfh4/tmpxkvcelaq.py", line 39, in <module>
resolve()
File "/tmp/tmp4910mfh4/tmpxkvcelaq.py", line 13, in resolve
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s111121432 | p02574 | u660237354 | 1598733178 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8892 | 1972 | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define scan(a,n) for(long int index=0;index<n;index++) cin>>a[index];
#define print(a,n) for(long int index=0;index<n;index++) cout<<a[index]<<" ";cout<<endl;
#define mo... | File "/tmp/tmpqp2ftsju/tmp_c_ai3yl.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s536000887 | p02574 | u513519822 | 1598733173 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 189064 | 974 | check_list = [0]*1000010
conf = False
def get_prime(m):
global check_list
global conf
pf = {}
for i in range(2,int(m**0.5)+1):
while m%i==0:
pf[i]=pf.get(i,0)+1
m//=i
if pf[i] == 1:
if check_list[i] >= 1:
conf = True
... | Traceback (most recent call last):
File "/tmp/tmpxbvatdiu/tmpigzh6shz.py", line 41, in <module>
print(main())
^^^^^^
File "/tmp/tmpxbvatdiu/tmpigzh6shz.py", line 28, in main
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s516713032 | p02574 | u572142121 | 1598733169 | Python | PyPy3 (7.3.0) | py | Runtime Error | 638 | 203100 | 1234 | N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
import math
import bisect
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.appen... | Traceback (most recent call last):
File "/tmp/tmpmqhge16h/tmpjmh_rlaz.py", line 1, in <module>
N=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s948943773 | p02574 | u371409687 | 1598733169 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 127404 | 460 | n=int(input())
p=list(map(int,input().split()))
List=[0 for _ in range(max(p)+1)]
def L(N):
i=1
while i*i<=N:
if N%i==0:
List[i]+=1
if i!=N//i:
List[N//i]+=1
i+=1
for i in range(n):
L(p[i])
List=List[2:]
ans='pairwise coprime'
for i in range(int(len(... | Traceback (most recent call last):
File "/tmp/tmpguoib5s4/tmpp13aw_yt.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s380633325 | p02574 | u761320129 | 1598733132 | Python | PyPy3 (7.3.0) | py | Runtime Error | 86 | 68680 | 851 | from math import gcd
N = int(input())
A = list(map(int,input().split()))
g = 0
for a in A:
g = gcd(g,a)
if g > 1:
print('not coprime')
exit()
sa = set(A)
if len(sa) < N:
print('setwise coprime')
exit()
MAXN = 10**6+10
sieve = [0,0] + [1]*MAXN
p = 2
small_primes = []
while p*p <= MAXN:
if siev... | File "/tmp/tmp_0v51lch/tmpsbehsi3l.py", line 32
while a%p==0:
IndentationError: unexpected indent
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.