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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s715742227 | p02256 | u684325232 | 1524041053 | Python | Python | py | Runtime Error | 0 | 0 | 227 | list=[int(i) for i in input().split()]
if list[0]>list[1]:
a=list[0]
b=list[1]
else:
b=list[0]
a=list[1]
if a%b==0:
print (b)
else:
while b>0:
c=a%b
a=b
b=c
print(b)
|
s199093724 | p02256 | u684325232 | 1524041056 | Python | Python | py | Runtime Error | 0 | 0 | 227 | list=[int(i) for i in input().split()]
if list[0]>list[1]:
a=list[0]
b=list[1]
else:
b=list[0]
a=list[1]
if a%b==0:
print (b)
else:
while b>0:
c=a%b
a=b
b=c
print(b)
|
s083462596 | p02256 | u684325232 | 1524041341 | Python | Python | py | Runtime Error | 0 | 0 | 236 | list=[int(i) for i in input().split()]
if list[0]>list[1]:
a=list[0]
b=list[1]
else:
b=list[0]
a=list[1]
if a%b==0:
print (b)
else:
while b>0:
c=a%b
a=b
b=c
print(a)
|
s392278935 | p02256 | u684325232 | 1524041345 | Python | Python | py | Runtime Error | 0 | 0 | 236 | list=[int(i) for i in input().split()]
if list[0]>list[1]:
a=list[0]
b=list[1]
else:
b=list[0]
a=list[1]
if a%b==0:
print (b)
else:
while b>0:
c=a%b
a=b
b=c
print(a)
|
s393888236 | p02256 | u826549974 | 1524042015 | Python | Python3 | py | Runtime Error | 0 | 0 | 293 | # 16D8101022L 小林勇希 ID:k_mb python3
def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(w != 0):
GCD(z,w)
else:
print(z)
a = int(input())
b = int(input())
GCD(a,b)
"""実行結果
100
55
5
66
77
11
"""
|
s049139889 | p02256 | u826549974 | 1524042043 | Python | Python3 | py | Runtime Error | 0 | 0 | 293 | # 16D8101022L 小林勇希 ID:k_mb python3
def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(w != 0):
GCD(z,w)
else:
print(z)
a = int(input())
b = int(input())
GCD(a,b)
"""実行結果
100
55
5
66
77
11
"""
|
s918920345 | p02256 | u826549974 | 1524042144 | Python | Python3 | py | Runtime Error | 0 | 0 | 293 | # 16D8101022L 小林勇希 ID:k_mb python3
def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(w != 0):
GCD(z,w)
else:
print(z)
a = int(input())
b = int(input())
GCD(a,b)
"""実行結果
100
55
5
66
77
11
"""
|
s520004044 | p02256 | u826549974 | 1524210324 | Python | Python3 | py | Runtime Error | 0 | 0 | 375 | def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
while(1):
if(w != 0):
v = w
w = z%w
z = v
else:
print(z)
break
"""
if(w != 0):
if(x >=y)
GCD(z,w)
else:
print(z)
"""
a = int(input())
b = int(input())
GCD(a,b)
|
s178243333 | p02256 | u826549974 | 1524210857 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(not(w == 0)):
GCD(z,w)
else:
print(z)
a = int(input())
b = int(input())
GCD(a,b)
|
s511256363 | p02256 | u826549974 | 1524211019 | Python | Python3 | py | Runtime Error | 0 | 0 | 415 | # 16D8101022L 小林勇希 ID:k_mb python3
def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(not(w == 0)):
return GCD(z,w)
else:
print(z)
"""
while(1):
if(w != 0):
v = w
w = z%w
z = v
else:
print(z)
break
"""
a = int(input())
b = int(input())
GCD(a,b)
|
s901569367 | p02256 | u826549974 | 1524211198 | Python | Python3 | py | Runtime Error | 0 | 0 | 422 | # 16D8101022L 小林勇希 ID:k_mb python3
def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(not(w == 0)):
return GCD(z,w)
else:
return z
"""
while(1):
if(w != 0):
v = w
w = z%w
z = v
else:
print(z)
break
"""
a = int(input())
b = int(input())
print(GCD(a,b))
|
s606219833 | p02256 | u826549974 | 1524211243 | Python | Python3 | py | Runtime Error | 0 | 0 | 225 | def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(not(w == 0)):
return GCD(z,w)
else:
return z
a = int(input())
b = int(input())
print(GCD(a,b))
|
s175700858 | p02256 | u826549974 | 1524211540 | Python | Python3 | py | Runtime Error | 0 | 0 | 131 | def gc(x, y):
while y > 0:
x %= y
x, y = y, x
return x
a = int(input())
b = int(input())
print(gc(a,b))
|
s754177564 | p02256 | u826549974 | 1524213367 | Python | Python3 | py | Runtime Error | 0 | 0 | 279 | def GCD(x,y):
if(x >= y):
z = y
w = x%y
else:
z = x
w = y%x
if(not(w == 0)):
return GCD(z,w)
else:
return z
A = [int() for i in input().split()]
print(GCD(A[0],A[1]))
"""実行結果
100 55
5
66 77
11
"""
|
s904209736 | p02256 | u810922275 | 1524446810 | Python | Python | py | Runtime Error | 0 | 0 | 215 | import numpy as np
def gcd(x,y):
if y==0:
return x
else:
x=x%y
temp=x
x=y
y=temp
return gcd(x,y)
A=list(map(int,input().split(' ')))
print(gcd(A[0],A[1]))
|
s220611377 | p02256 | u663087805 | 1524582049 | Python | Python3 | py | Runtime Error | 0 | 0 | 411 | def isprime(x):
n=3
X = 0
if x ==2:
return 1
if x < 2 or x%2 == 0:
return 0
n = 3
X = math.sqrt(x)
while(3<=X):
if x % i == 0:
return 0
i = i+2
return 1
n = int(input())
cnt_ans = 0
cnt = 3
A = []
for i in range(0,n):
a = int(input())
A.append(a)
for i in range(0,n):
cnt = isprime(A[i])
if cnt == 1:
cnt_ans = cnt_ans + 1
cnt = 3
print (cnt_ans)
|
s048006879 | p02256 | u810098703 | 1524623889 | Python | Python | py | Runtime Error | 0 | 0 | 131 |
n = [int(i) for i in input().split()]
x = n[0]
y = n[1]
d = x % y
while(d != 0):
x = y
y = d
d = x % y
print(y)
|
s082093440 | p02256 | u810098703 | 1524624250 | Python | Python | py | Runtime Error | 0 | 0 | 129 | n = [int(i) for i in input().split()]
x = n[0]
y = n[1]
d = x % y
while d != 0:
x = y
y = d
d = x % y
print(y)
|
s128379461 | p02256 | u810098703 | 1524626090 | Python | Python | py | Runtime Error | 0 | 0 | 187 | #include<stdio.h>
int main(void)
{
int x, y, d;
scanf("%d", &x);
scanf("%d", &y);
d = x % y;
while (d != 0){
x = y;
y = d;
d = x % y;
}
printf("%d\n", y);
return 0;
}
|
s325528902 | p02256 | u148477094 | 1524635439 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | def gcd(a,b):
if b==0:
return a
c=a%b
return gcd(b,c)
x=int(input("x:"))
y=int(input("y:"))
if x<y:
x,y=y,x
m=gcd(x,y)
print(m)
def gcd(x,y):
|
s633245886 | p02256 | u148477094 | 1524635471 | Python | Python3 | py | Runtime Error | 0 | 0 | 216 | def gcd(a,b):
if b==0:
return a
c=a%b
return gcd(b,c)
x=int(input("x:"))
y=int(input("y:"))
if x<y:
x,y=y,x
m=gcd(x,y)
print(m)
def gcd(x,y):
if b==0:
return a
return gcd(b,c)
|
s264422865 | p02256 | u148477094 | 1524635606 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | def gcd(a,b):
if b==0:
return a
c=a%b
return gcd(b,c)
x=int(input(""))
y=int(input(""))
if x<y:
x,y=y,x
m=gcd(x,y)
print(m)
def gcd(x,y):
|
s370063369 | p02256 | u908651435 | 1524821654 | Python | Python3 | py | Runtime Error | 0 | 0 | 196 | x=input()
y=input()
x=int(x)
y=int(y)
xg=set()
yg=set()
for i in range(1,x+1):
if x%i==0:
xg.add(i)
for j in range(1,y+1):
if y%j==0:
yg.add(j)
gcd=xg & yg
print(max(gcd))
|
s102038519 | p02256 | u908651435 | 1524823360 | Python | Python3 | py | Runtime Error | 0 | 0 | 118 | x,y=map(int,input().split())
ma=max(x,y)
for i in range(1,ma):
if x%i==0 or y%i==0:
gcd=i
print(max(gcd))
|
s333643397 | p02256 | u722932083 | 1528327671 | Python | Python3 | py | Runtime Error | 0 | 0 | 300 | N = int(input())
A = list(map(int, input().split()))
flag = True
counter = 0
while flag:
flag = False
for i in range(N-1, 0, -1):
if A[i-1] > A[i]:
A[i], A[i-1] = A[i-1], A[i]
flag = True
counter += 1
print(' '.join(map(str, A)))
print(counter)
|
s535046593 | p02256 | u269568674 | 1529041726 | Python | Python3 | py | Runtime Error | 0 | 0 | 112 | l = [int(s) for s in l]
for i in range(1,l[0]):
if l[0] % i == 0 and l[1] % i == 0:
c = i
print(c)
|
s136235898 | p02256 | u298224238 | 1529092632 | Python | Python3 | py | Runtime Error | 0 | 0 | 112 | x, y = [int(n) for n in input().split()]
if (x < y):
x, y = y, x
while b > 0:
x, y = x, x % y
print(x)
|
s789882883 | p02256 | u188938853 | 1529483581 | Python | Python3 | py | Runtime Error | 20 | 5600 | 164 | def gcd(x, y):
if x < y:
swap(x, y)
if y == 0:
return x
return gcd(y, x % y)
x, y = [int(i) for i in input().split()]
print(gcd(x, y))
|
s584247380 | p02256 | u023997525 | 1529751110 | Python | Python3 | py | Runtime Error | 0 | 0 | 252 | def gcd_loop(a,b):
if a < 0: a = -a
if b < 0: b = -b
if b < a: b, a = a, b
if a == 0:
return b
while True:
if b%a == 0:
return a
a, b = b%a, a
x, y = map(int, input().split())
print(gcd(x, y))
|
s270789097 | p02256 | u501332306 | 1530097215 | Python | Python3 | py | Runtime Error | 20 | 5604 | 123 | x,y =[int(i) for i in input().split()]
if x < y :
swap(x, y)
while y > 0 :
r = x % y
x = y
y = r
print(x)
|
s202007805 | p02256 | u266872031 | 1385391147 | Python | Python | py | Runtime Error | 0 | 0 | 158 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
B=B.sort()
while B[1]%B[0] != 0:
C=B[0]
B[0]=B[1]%B[0]
B[1]=C
print B[0] |
s269513391 | p02256 | u266872031 | 1385391535 | Python | Python | py | Runtime Error | 0 | 0 | 161 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=B[1]%B[0]
C=[0]
B[0]=e
B[1]=C
print B[0] |
s372351543 | p02256 | u266872031 | 1385391650 | Python | Python | py | Runtime Error | 0 | 0 | 161 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=[0]
D[0]=e
D[1]=C
print D[0] |
s289368229 | p02256 | u266872031 | 1385391873 | Python | Python | py | Runtime Error | 0 | 0 | 158 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=[0]
D[0]=e
D[1]=C
print e |
s234820059 | p02256 | u266872031 | 1385392167 | Python | Python | py | Runtime Error | 0 | 0 | 162 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=D[0]
D[0]=e
D[1]=C
print D[0] |
s581734815 | p02256 | u266872031 | 1385392257 | Python | Python | py | Runtime Error | 0 | 0 | 176 | import sys
for line in sys.stdin:
global B
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=D[0]
D[0]=e
D[1]=C
print D[0] |
s365641316 | p02256 | u266872031 | 1385392281 | Python | Python | py | Runtime Error | 0 | 0 | 181 | import sys
B=[]
for line in sys.stdin:
global B
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=D[0]
D[0]=e
D[1]=C
print D[0] |
s383171562 | p02256 | u266872031 | 1385392336 | Python | Python | py | Runtime Error | 0 | 0 | 194 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
D=B.sort()
e=1
while e != 0:
e=D[1]%D[0]
C=D[0]
D[0]=e
D[1]=C
print D[0] |
s762617187 | p02256 | u266872031 | 1385392564 | Python | Python | py | Runtime Error | 20 | 4196 | 179 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
e=1
while e != 0:
e=B[0]%B[1]
C=B[1]
B[1]=e
B[0]=C
print B[0] |
s850847682 | p02256 | u266872031 | 1385392661 | Python | Python | py | Runtime Error | 10 | 4212 | 244 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
if B[0]<B[1]:
p=B[1]
B[1]=B[0]
B[0]=p
e=1
while e != 0:
e=B[0]%B[1]
C=B[1]
B[1]=e
B[0]=C
print B[0] |
s851137007 | p02256 | u266872031 | 1385392977 | Python | Python | py | Runtime Error | 10 | 4216 | 268 | import sys
for line in sys.stdin:
lineA=line.strip()
A=lineA.split()
B=map(int,A)
if B[0]<B[1]:
p=B[1]
B[1]=B[0]
B[0]=p
e=1
while e != 0:
e=B[0]%B[1]
C=B[1]
B[1]=e
B[0]=C
print B[0] |
s468189305 | p02256 | u266872031 | 1385393946 | Python | Python | py | Runtime Error | 20 | 4216 | 244 | import sys
for line in sys.stdin:
A=line.split()
B=map(int,A)
if B[0]<B[1]:
p=B[1]
B[1]=B[0]
B[0]=p
e=1
while e != 0:
e=B[0]%B[1]
C=B[1]
B[1]=e
B[0]=C
print B[0] |
s066309944 | p02256 | u063179562 | 1390218917 | Python | Python | py | Runtime Error | 0 | 0 | 151 | a,b = map(float,raw_input().split())
m = a
if a>b:
m = b
max = 0
for i in range(2,m+1):
if a % i == 0 and b % i == 0:
max = i
print max |
s551187378 | p02256 | u063179562 | 1390219016 | Python | Python | py | Runtime Error | 170 | 43772 | 149 | a,b = map(int,raw_input().split())
m = a
if a>b:
m = b
max = 0
for i in range(1,m+1):
if a % i == 0 and b % i == 0:
max = i
print max |
s404484118 | p02257 | u986487972 | 1530793398 | Python | Python3 | py | Runtime Error | 0 | 0 | 436 |
import numpy as np
##素数判定を行う関数
def prime(p):
if p==2 or p==3:
return True
else:
i = int(np.sqrt(p))
while i>=2:
if p%i==0:
return False
break
i-=1
return True
N = int(input())
count = 0
for i in range(N):
a = int(input())
if prime(a)==True:
count+=1
print(count)
|
s258747208 | p02257 | u313089641 | 1531318710 | Python | Python3 | py | Runtime Error | 0 | 0 | 238 | def judge(n):
if n == 2 or n == 3:
return 1
if n % 2 == 0:
return 0
i = 3
while i < n:
if n%i == 0:
return 0
else:
i += 2
return 1
print(sum(map(judge, ls)))
|
s164241106 | p02257 | u400765446 | 1531662268 | Python | Python3 | py | Runtime Error | 0 | 0 | 575 | def main():
n = int(input())
primelist = []
for _ in range(n):
x = int(input())
if isprime(x) == 1:
primelist.append(x)
print(len(primelist))
def isprime(x: int):
if x == 2:
return 1
elif x % 2 == 0:
retrn 0
else:
yesno = 1
for y in range(3, x, 2):
# 偶数は最初に除外するので、奇数で割れるかだけ見ていく
if x % y == 0:
yesno = 0
break
return yesno
if __name__ == '__main__':
main()
|
s053420830 | p02257 | u418996726 | 1535417457 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | count = 0
for _ in range(int(input())):
n = int(input())
count += 1 if mod(2, n-1, n) == 1 else 0
print(count)
|
s369845664 | p02257 | u418996726 | 1535417639 | Python | Python3 | py | Runtime Error | 0 | 0 | 121 | count = 0
for _ in range(int(input())):
n = int(input())
count += 1 if (mod(2, n-1, n) == 1) else 0
print(count)
|
s655085002 | p02257 | u418996726 | 1535417687 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | count = 0
for _ in range(int(input())):
n = int(input())
if mod(2,n-1,n) == 1:
count += 1
print(count)
|
s612635303 | p02257 | u418996726 | 1535417801 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | count = 0
for _ in range(int(input())):
n = int(input())
if mod(2,n-1,n) == 1:
count += 1
print(count)
|
s531910604 | p02257 | u418996726 | 1535417807 | Python | Python3 | py | Runtime Error | 0 | 0 | 106 | count = 0
for _ in range(int(input())):
n = int(input())
if mod(2,n-1,n) == 1:
count += 1
|
s573706930 | p02257 | u317583692 | 1535620079 | Python | Python3 | py | Runtime Error | 0 | 0 | 403 | def prime(x):
if x == 2:
return True
elif x < 2 or x %2 == 0:
return False
i = 3
while i <= x**(1/2):
if x % i == 0:
return false
i = i + 2
return true
L = []
while True:
try:
i = int(input())
L.append(i)
except EOFError:
break
K = 0
for i in range(len(L)):
if prime(L[i]):
K += 1
print(K)
|
s374731146 | p02257 | u339728776 | 1540345516 | Python | Python3 | py | Runtime Error | 0 | 0 | 217 | x = int(input())
count = 0
for i in range(0, x):
a = int(input())
for j in range ( 2, a ):
if a % j == 0:
count += 1
if j * j > a
break;
print(x-count)
|
s401286436 | p02257 | u339728776 | 1540345555 | Python | Python3 | py | Runtime Error | 0 | 0 | 218 | x = int(input())
count = 0
for i in range(0, x):
a = int(input())
for j in range ( 2, a ):
if a % j == 0:
count += 1
if j * j > a:
break;
print(x-count)
|
s245748582 | p02257 | u339728776 | 1540347104 | Python | Python3 | py | Runtime Error | 0 | 0 | 257 | x = int(input())
count = 0
for i in range(0, x):
a = int(input())
for j in range ( 2, a ):
c = int(a)
if a % j == 0:
count += 1
break;
if j * j > c:
break;
print(x-count)
|
s584305224 | p02257 | u192145025 | 1540348618 | Python | Python3 | py | Runtime Error | 0 | 0 | 318 | import math
count = 0
for i =in range(10000):
n = int(input())
if i == 2:
count += 1
else:
for j in range(3, 100000000, 2):
k = math.sqrt(n)
if j > k
break
if n % j == 0:
count += 1
break
print(count)
|
s004275751 | p02257 | u192145025 | 1540348777 | Python | Python3 | py | Runtime Error | 0 | 0 | 319 | import math
count = 0
for i =in range(10000):
n = int(input())
if i == 2:
count += 1
else:
for j in range(3, 100000000, 2):
k = math.sqrt(n)
if j > k:
break
if n % j == 0:
count += 1
break
print(count)
|
s718517787 | p02257 | u885258297 | 1540729119 | Python | Python3 | py | Runtime Error | 0 | 0 | 7 | gfsdrg
|
s127097612 | p02257 | u209940149 | 1541150598 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | import math
def isprime(n):
m = int(math.sqrt(n)) + 1
check = 1
nums = [i for i in range(2, n)]
while nums[0] <= m:
p = nums[0]
for j in range(1, int(n / p) + 1):
nums.remove(p * j)
if n not in nums:
check = 0
break
else:
pass
return check
n = int(input())
ans = 0
for k in range(n):
a = int(input())
ans += isprime(a)
print(ans)
|
s993320550 | p02257 | u209940149 | 1541150736 | Python | Python3 | py | Runtime Error | 0 | 0 | 535 | import math
def isprime(n):
check = 1
if n == 1:
check = 0
else:
m = int(math.sqrt(n)) + 1
nums = [i for i in range(2, n)]
while nums[0] <= m:
p = nums[0]
for j in range(1, int(n / p) + 1):
nums.remove(p * j)
if n not in nums:
check = 0
break
else:
pass
return check
n = int(input())
ans = 0
for k in range(n):
a = int(input())
ans += isprime(a)
print(ans)
|
s158079350 | p02257 | u670433235 | 1551503337 | Python | Python3 | py | Runtime Error | 20 | 5596 | 432 | def get_sieve_of_eratosthenes(x):
data = [True] * (x + 1)
data[0] = data[1] = False
i = 2
while i ** 2 <= x:
if data[i]:
for j in range(i + 1, x + 1):
if j % i == 0:
data[j] = False
i += 1
return data
pn = get_sieve_of_eratosthenes(1000)
n = int(input())
cnt = 0
for i in range(n):
a = int(input())
if pn[a]:
cnt += 1
print(cnt)
|
s972506762 | p02257 | u456917014 | 1555657313 | Python | Python3 | py | Runtime Error | 30 | 5636 | 233 | p=[1]*10001
i=2
while i*i<10000:
if p[i]:
j=i+i
while j<10000:
p[j]=0
j+=i
i+=1
count=0
for i in range(int(input())):
if p[int(input())]==1:
count+=1
print(count)
|
s591508153 | p02257 | u696273805 | 1556016184 | Python | Python3 | py | Runtime Error | 0 | 0 | 319 | import math
def is_prime(n):
sqrtn = math.ceil(math.sqrt(n))
for i in range(2, sqrtn + 1):
if n % i == 0:
return False
return n != 1
n = int(input())
answer = 0
for _ in range(0, n+1):
m = int(input())
if is_prime(m):
print(m)
answer = answer + 1
print(answer)
|
s486300441 | p02257 | u696273805 | 1556020739 | Python | Python3 | py | Runtime Error | 0 | 0 | 984 | def witness(a, n, t, u):
x = pow(a, u, n) # x0 = a^u mod nを計算
y = x
for _ in range(0, t):
y = (x * x) % n
# 法nの下での1の非自明な平方根が存在するのはnが合成数であるときに限る
if y == 1 and x != 1 and x != (n - 1):
return True
x = y
return y != 1
def is_probably_prime(n, witnesses):
t = 1
u = n >> 1
while u & 1 == 0:
t = t + 1
u >>= 1
assert(2**t * u == n - 1)
for a in witnesses:
if a < n and witness(a, n, t, u):
return False
return True
def is_definitely_prime(n):
'''
if ((not (n & 1)) and n != 2) or (n < 2) or ((n % 3 == 0) and (n != 3)):
return False
elif n <= 3:
return True
else:
'''
return is_probably_prime(n, [2, 7, 61])
n = int(input())
answer = 0
for _ in range(0, n):
m = int(input())
if is_definitely_prime(m):
answer = answer + 1
print(answer)
|
s646258571 | p02257 | u870370075 | 1556298716 | Python | Python3 | py | Runtime Error | 0 | 0 | 214 | import math
def prime(num):
for i in range(math.sqrt(num)+1):
if num%i==0:
return False
else:
return True
n=int(input())
ans=0
for i in range(n):
if prime(int(input())):
ans+=1
print(ans)
|
s469738814 | p02257 | u764759179 | 1559202867 | Python | Python3 | py | Runtime Error | 0 | 0 | 597 | #!/usr/bin/env python
# coding: utf-8
def gcd ( ax, ay):
x = ax
y = ay
while (True):
if x < y :
tmp = x
x = y
y = tmp
x=x %y
if x == 0:
return y
elif x == 1:
return 1
def check_pn(num):
count = 0
for i in range(3, int(num/2+0.5)):
if gcd(i, num) != 1:
return False
return True
n = int(input())
listdata = []
for i in range(n):
listdata.append(int(input()))
n=0
for data in listdata:
ch = check_pn(data)
# print(data, ch)
n += ch
print (n)
|
s877081481 | p02257 | u535719732 | 1559380654 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | n = inta(input())
c = 0
for _ in range(n):
data = int(input())
for i in range(2,data):
if(data%i == 0):
c += 1
break
print(c)
|
s533660976 | p02257 | u567380442 | 1421284859 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | primes = [2]
def is_prime(num):
root = num ** 0.5
for prime in primes:
if root < prime:
break
if num % prime == 0:
return False
return True
def create_primes(primes, max):
for i in range(primes[-1] + 1,max):
if is_prime(i):
primes += [i]
create_primes(primes, 10000)
n = int(input())
for _ in range(n):
if is_prime(int(input())):
count += 1
print(count) |
s574121785 | p02257 | u813534019 | 1423059256 | Python | Python | py | Runtime Error | 0 | 0 | 149 | :
c=input()
pc=0
for _ in range(c):
n=input()
for i in range(2, n):
if n % i == 0:
break
else:
pc+=1
print pc |
s032477981 | p02257 | u879226672 | 1424416451 | Python | Python | py | Runtime Error | 0 | 0 | 610 | def isprime_euclid2(N):
if N<1:
print 'N>2'
elif N==2:
return True
import math
def euclid(m,n):
while m%n>0:
r=m%n
m,n=n,r
else:
return n
euclid_list=[]
for k in range(1,int(round(math.sqrt(N)))+1):
euclid_list.append(euclid(N,k))
temp=set(euclid_list)
if len(temp)==1:
return True
else:
return False
while True:
n = int(raw_input())
total = 0
for k in range(n):
if isprime_euclid2(int(raw_input())):
total +=1
print total |
s608910824 | p02257 | u879226672 | 1424416498 | Python | Python | py | Runtime Error | 0 | 0 | 628 | def isprime_euclid2(N):
if N<1:
print 'N>2'
elif N==2:
return True
def euclid(m,n):
while m%n>0:
r=m%n
m,n=n,r
else:
return n
euclid_list=[]
for k in range(1,int(round(math.sqrt(N)))+1):
euclid_list.append(euclid(N,k))
temp=set(euclid_list)
if len(temp)==1:
return True
else:
return False
import math
while True:
n = int(raw_input())
total = 0
for k in range(n):
if isprime_euclid2(int(raw_input())):
total +=1
print total
|
s638010938 | p02257 | u879226672 | 1424416582 | Python | Python | py | Runtime Error | 0 | 0 | 579 | def euclid(m,n):
while m%n>0:
m,n=n,m%n
else:
return n
def isprime_euclid2(N):
if N<1:
print 'N>2'
elif N==2:
return True
euclid_list=[]
for k in range(1,int(round(math.sqrt(N)))+1):
euclid_list.append(euclid(N,k))
temp=set(euclid_list)
if len(temp)==1:
return True
else:
return False
import math
while True:
n = int(raw_input())
total = 0
for k in range(n):
if isprime_euclid2(int(raw_input())):
total +=1
print total
|
s627900548 | p02257 | u128811851 | 1429694440 | Python | Python3 | py | Runtime Error | 0 | 0 | 450 | import functools
number = int(input())
origin = [int(input()) for _ in range(number)]
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
divised = origin # initialize
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s927781513 | p02257 | u128811851 | 1429694543 | Python | Python3 | py | Runtime Error | 0 | 0 | 450 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for _ in range(number)]
divised = origin # initialize
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s192116862 | p02257 | u128811851 | 1429694662 | Python | Python3 | py | Runtime Error | 0 | 0 | 450 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin # initialize
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s534298767 | p02257 | u128811851 | 1429694926 | Python | Python3 | py | Runtime Error | 0 | 0 | 450 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin # initialize
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s630985278 | p02257 | u128811851 | 1429695185 | Python | Python3 | py | Runtime Error | 0 | 0 | 473 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin # initialize
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
else:
pass
print(len(origin)) |
s896762408 | p02257 | u128811851 | 1429695252 | Python | Python3 | py | Runtime Error | 0 | 0 | 459 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
else:
pass
print(len(origin)) |
s796791685 | p02257 | u128811851 | 1429695347 | Python | Python3 | py | Runtime Error | 0 | 0 | 472 | from functools import partial
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
else:
pass
print(len(origin)) |
s417223380 | p02257 | u128811851 | 1429695605 | Python | Python3 | py | Runtime Error | 0 | 0 | 463 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif n % divisor == 0:
return 0
else:
return n
number = int(input())
origin = list(int(input()) for x in range(number))
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
else:
pass
print(len(origin)) |
s315427607 | p02257 | u128811851 | 1429695709 | Python | Python3 | py | Runtime Error | 0 | 0 | 438 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif (n % divisor) == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for x in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s813346369 | p02257 | u128811851 | 1429695752 | Python | Python3 | py | Runtime Error | 0 | 0 | 438 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif (n % divisor) == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for i in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s788953171 | p02257 | u128811851 | 1429710055 | Python | Python3 | py | Runtime Error | 0 | 0 | 438 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif (n % divisor) == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for _ in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s755826742 | p02257 | u128811851 | 1429710722 | Python | Python3 | py | Runtime Error | 0 | 0 | 439 | import functools
def divise(n, divisor):
if n == divisor:
return n
elif (n % divisor) == 0:
return 0
else:
return n
number = int(input())
origin = [int(input()) for _ in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s070546440 | p02257 | u128811851 | 1429712783 | Python | Python3 | py | Runtime Error | 0 | 0 | 413 | import functools
def divise(n, divisor):
if n % divisor == 0 and n != divisor:
return 0
else:
return n
number = int(input())
origin = [int(input()) for _ in range(number)]
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s257393418 | p02257 | u150414576 | 1429714248 | Python | Python | py | Runtime Error | 0 | 0 | 545 | import functools
def divise(n, divisor):
if n % divisor == 0 and n != divisor:
return 0
else:
return n
if __name__ == '__main__':
number = input()
# origin = [int(input()) for _ in range(number)]
origin = []
for i in range(number):
origin.append(input())
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s632779144 | p02257 | u150414576 | 1429714273 | Python | Python3 | py | Runtime Error | 0 | 0 | 545 | import functools
def divise(n, divisor):
if n % divisor == 0 and n != divisor:
return 0
else:
return n
if __name__ == '__main__':
number = input()
# origin = [int(input()) for _ in range(number)]
origin = []
for i in range(number):
origin.append(input())
divised = origin
for i in range(2, max(origin)+1):
divised = list(map(functools.partial(divise, divisor=i), divised))
for j in range(number):
if divised[j] == 0:
origin.pop(j)
print(len(origin)) |
s139851950 | p02257 | u442472098 | 1433412160 | Python | Python3 | py | Runtime Error | 0 | 0 | 761 | #!/usr/bin/env python3
from itertools import takewhile
from math import sqrt
def is_prime(primes, i):
if i in primes:
return True
for p in takewhile(lambda x: x * x <= i, sorted(primes)):
if i % p == 0:
return False
return True
def sieve_of_eratosthenes(max):
is_prime = [True] * (max + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(sqrt(max)) + 1):
if not is_prime[i]:
continue
for j in range(i * i, max + 1, i):
is_prime[j] = False
return filter(lambda x: is_prime[x], range(max + 1))
primes = set(sieve_of_eratosthenes(10000))
n = int(input())
c = 0
for _ in range(n):
i = int(input())
if is_prime(i):
c += 1
print(c) |
s992332727 | p02257 | u938745275 | 1441063501 | Python | Python | py | Runtime Error | 0 | 0 | 495 | def judgePrime(n):
result = True
for i in xrange(2, n):
if n % i == 0:
result = False
break
return result
def getPrimeNumFromList(list):
count = 0
for i in xrange(len(list)):
target = 0
if i == 0:
target = list[0]
if judgePrime(target):
count += 1
else:
return count
n = int(raw_input())
list = []
for i in xrange(n):
list.append(int(raw_input()))
list.sort()
#print judgePrime(list[len(list) - 1])
print getPrimeNumFromList(list) |
s515988217 | p02257 | u938745275 | 1441063583 | Python | Python | py | Runtime Error | 0 | 0 | 496 | def judgePrime(n):
result = True
for i in xrange(2, n):
if n % i == 0:
result = False
break
return result
def getPrimeNumFromList(list):
count = 0
for i in xrange(len(list)):
target = 0
if i == 0:
target = list[0]
if judgePrime(target):
count += 1
else:
return count
n = int(raw_input())
list = []
for i in xrange(n):
list.append(int(raw_input()))
list.sort()
print judgePrime(list[len(list) - 1])
# print getPrimeNumFromList(list) |
s210266847 | p02257 | u938745275 | 1441203342 | Python | Python | py | Runtime Error | 1560 | 6936 | 1096 | import pdb
def judgePrime(n):
result = True
i = 2
while i < int(round(n)):
if n % i == 0:
result = False
break
i += 1
return [result, i]
def getPrimeNumFromList(list):
count = 0
for i in xrange(len(list)):
target = 0
if i == 0:
target = list[0]
if judgePrime(target):
count += 1
else:
pass
return count
n = int(raw_input())
list = []
for i in xrange(n):
list.append(int(raw_input()))
list.sort()
prime_list = []
while True:
v = list.pop(0)
result = judgePrime(v)
if result[0]:
# pdb.set_trace()
prime_list.append(v)
else:
v = result[1]
# print "list : "
# print list
# print "prime_list : "
# print prime_list
i = 0
while True:
# print "i = " + str(i)
if i >= len(list):
break
elif list[i] % v == 0:
list.pop(i)
# print "i = " + str(i) + ", list: "
# print list
else:
i += 1
if len(list) == 0:
break
elif prime_list[len(prime_list) - 1] ^ 2 >= list[len(list) - 1]:
prime_list.append(list)
break
print len(prime_list) |
s791625016 | p02257 | u729824721 | 1442210561 | Python | Python | py | Runtime Error | 0 | 0 | 295 | import sys
num_list = []
for line in sys.stdin.readlines():
num_list.append(int(line.strip()))
num_list.remove(num_list[0])
count = 0
for num in num_list:
if num != 1:
for i in range(2, num-1)
if num % i == 0:
continue
count += 1
print count |
s529765632 | p02257 | u729824721 | 1442211188 | Python | Python | py | Runtime Error | 0 | 0 | 339 | import sys
count = 0
judge = 0
for line in sys.stdin.readlines():
num = int(line.strip())
if judge == 0:
judge = 1
else:
flag = 0
for i in range(2, sqrt(num) + 1):
if num % i == 0:
flag = 1
break
if flag == 0:
count += 1
print count |
s000155885 | p02257 | u729824721 | 1442211226 | Python | Python | py | Runtime Error | 0 | 0 | 356 | import sys
import math
count = 0
judge = 0
for line in sys.stdin.readlines():
num = int(line.strip())
if judge == 0:
judge = 1
else:
flag = 0
for i in range(2, math.sqrt(num) + 1):
if num % i == 0:
flag = 1
break
if flag == 0:
count += 1
print count |
s777132691 | p02257 | u894381890 | 1442211757 | Python | Python | py | Runtime Error | 0 | 0 | 307 | import sys
import math
x_list = []
for line in sys.stdin.readlines()
x_list.append(int(line.strip()))
count = 0
num_list.remove(x_list[0])
for i in x_list:
flag = 0
for j in range(2, math.sqrt(i)+1):
if i % j == 0:
flag = 1
break
if flag == 0:
count ++
print count
|
s507267854 | p02257 | u894381890 | 1442211777 | Python | Python | py | Runtime Error | 0 | 0 | 308 | import sys
import math
x_list = []
for line in sys.stdin.readlines():
x_list.append(int(line.strip()))
count = 0
num_list.remove(x_list[0])
for i in x_list:
flag = 0
for j in range(2, math.sqrt(i)+1):
if i % j == 0:
flag = 1
break
if flag == 0:
count ++
print count
|
s609635439 | p02257 | u894381890 | 1442211796 | Python | Python | py | Runtime Error | 0 | 0 | 310 | import sys
import math
x_list = []
for line in sys.stdin.readlines():
x_list.append(int(line.strip()))
count = 0
num_list.remove(x_list[0])
for i in x_list:
flag = 0
for j in range(2, math.sqrt(i)+1):
if i % j == 0:
flag = 1
break
if flag == 0:
count += 1
print count
|
s529345335 | p02257 | u894381890 | 1442211812 | Python | Python | py | Runtime Error | 0 | 0 | 306 | import sys
import math
x_list = []
for line in sys.stdin.readlines():
x_list.append(int(line.strip()))
count = 0
x_list.remove(x_list[0])
for i in x_list:
flag = 0
for j in range(2, math.sqrt(i)+1):
if i % j == 0:
flag = 1
break
if flag == 0:
count ++
print count
|
s743599460 | p02257 | u894381890 | 1442211820 | Python | Python | py | Runtime Error | 0 | 0 | 308 | import sys
import math
x_list = []
for line in sys.stdin.readlines():
x_list.append(int(line.strip()))
count = 0
x_list.remove(x_list[0])
for i in x_list:
flag = 0
for j in range(2, math.sqrt(i)+1):
if i % j == 0:
flag = 1
break
if flag == 0:
count += 1
print count
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.