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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s752451289 | p00047 | u301729341 | 1481337874 | Python | Python3 | py | Runtime Error | 0 | 0 | 188 | Ans = "A"
while True:
Pos = list(map(str,input().split(",")))
if Pos == ['']:
print(Ans)
break
if Ans in Pos:
Ans = Pos[((Pos.index(Ans)) + 1) % 2] |
s501507460 | p00047 | u301729341 | 1481337945 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | Ans = "A"
while True:
try:
if Ans in Pos:
Ans = Pos[((Pos.index(Ans)) + 1) % 2]
except EOFError:
print(Ans)
break |
s413333798 | p00047 | u301729341 | 1481338011 | Python | Python3 | py | Runtime Error | 0 | 0 | 153 | Ans = "A"
while True:
try:
if Ans in Pos:
Ans = Pos[((Pos.index(Ans)) + 1) % 2]
except:
print(Ans)
break |
s536900963 | p00047 | u546285759 | 1484028660 | Python | Python3 | py | Runtime Error | 0 | 0 | 432 | cups=[True, False, False]
for line in sys.stdin:
l= line.strip().split(",")
if "A"in l and "B"in l:
cups[0], cups[1]= cups[1], cups[1]
elif "A"in l and "C"in l:
cups[0], cups[2]= cups[2], cups[0]
else:
cups[1], cups[2]= cups[2], cups[1]
for i in range(3):
if cups[i]:
if i== 0:
print('A')
elif i== 1:
print('B')
else:
print('C') |
s323539676 | p00047 | u024715419 | 1517900389 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | d = {"A":1, "B":0, "C":0}
while True:
try:
swap1, awap2 = input().split(",")
d[swap1], d[swap2] = d[swap2], d[swap1]
except:
break
print(d.keys()[d.values().index(1)])
|
s767977443 | p00047 | u763301852 | 1364904860 | Python | Python | py | Runtime Error | 0 | 0 | 190 | p = "A"
while True:
try:
s, t = raw_input().split(",")
except EOFError as e:
break
if s == p:
p = t
elif t == p:
p = s
print("%s" % (chA, )) |
s606769558 | p00047 | u633068244 | 1393585218 | Python | Python | py | Runtime Error | 0 | 0 | 274 | ls = {"A":0, "B":1, "C":2}
cup = [1,0,0]
while 1:
try:
x, y = map(str, raw_input().split(","))
tmp = cup[ls[x]]
cup[ls[x]] = cup[ls[y]]
cup[ls[y]] = cup[ls[x]]
except:
break
p = cup.index(1)
if c == 0:
print "A"
else:
print "B" if c == 1 else "C" |
s040075443 | p00048 | u897769968 | 1556747590 | Python | Python3 | py | Runtime Error | 0 | 0 | 740 | while(True):
try:
weight = float(input())
if(weight <= 48.00):
print("light fly")
elif(weight <= 51.00):
print("fly")
elif(weight <= 54.00):
print("bantam")
elif(weight <= 57.00):
print("feather")
elif(weight <= 60.00):
print("light")
elif(weight <= 64.00):
print("light welter")
elif(weight <= 69.00):
print("welter")
elif(weight <= 75.00):
print("light middle")
elif(weight <= 81.00):
print("middle")
elif(weight <= 91.00):
print("light heavy")
else:
print("heavy")
except ValueError:
break;
|
s777091276 | p00048 | u897769968 | 1556747956 | Python | Python3 | py | Runtime Error | 0 | 0 | 736 | while 1:
try:
weight = float(input())
if(weight <= 48.00):
print("light fly")
elif(weight <= 51.00):
print("fly")
elif(weight <= 54.00):
print("bantam")
elif(weight <= 57.00):
print("feather")
elif(weight <= 60.00):
print("light")
elif(weight <= 64.00):
print("light welter")
elif(weight <= 69.00):
print("welter")
elif(weight <= 75.00):
print("light middle")
elif(weight <= 81.00):
print("middle")
elif(weight <= 91.00):
print("light heavy")
else:
print("heavy")
except ValueError:
break;
|
s389111010 | p00048 | u075836834 | 1458322774 | Python | Python3 | py | Runtime Error | 0 | 0 | 502 | def Class(x):
if x<=48.0:
print("light fly")
elif 48.0<x<=51.0:
print("fly")
elif 51.0<x<=54.0:
print("bantam")
elif 54.0<x<=57.0:
print("feather")
elif 57.0<x<=60.0:
print("light")
elif 60.0<x<=64.0:
print("light welter")
elif 64.0<x<=69.0:
print("welter")
elif 69.0<x<=75.0:
print("light middle")
elif 75.0<x<=81.0:
print("middle")
elif 81.0<x<=91.0:
print("light heavy")
else:
ptinr("heavy")
while True:
try:
x=float(input())
Class(x)
except EOFError:
break |
s588785287 | p00048 | u300946041 | 1473689930 | Python | Python3 | py | Runtime Error | 0 | 0 | 697 | # -*- coding: utf-8 -*-
def judge_class(s):
if s <= 48.00:
return 'light fly'
elif 48.00 < s <= 51.00:
return 'fly'
elif 51.00 < s <= 54.00:
return 'bantam'
elif 54.00 < s <= 57.00:
return 'feather'
elif 57.00 < s <= 60.00:
return 'light'
elif 60.00 < s <= 64.00:
return 'light welter'
elif 64.00 < s <= 69.00:
return 'welter'
elif 69.00 < s <= 75.00:
return 'light middle'
elif 75.00 < s <= 81.00:
return 'middle'
elif 81.00 < s <= 91.00:
return 'light heavy'
elif 91.00 <= s:
return 'heavy'
if __name__ == '__main__':
s = input()
print(judge_class(s)) |
s954816895 | p00048 | u498511622 | 1501490380 | Python | Python3 | py | Runtime Error | 0 | 0 | 437 | while True:
w=float(input())
if w<=48:
judge='light fly'
elif 48<=w<=51:
judge='fly'
elif 51<=w<=54:
judge='bantam'
elif 54<=w<=57:
judge='feather'
elif 57<=w<=60:
judge='light'
elif 60<=w<=64:
judge='light welter'
elif 64<=w<=69:
judge='welter'
elif 69<=w<=75:
judge='light middle'
elif 75<=w<=81:
judge='middle'
elif 81<=w<=91:
judge='light heavy'
elif w>=91:
judge='heavy'
print(judge) |
s978803030 | p00048 | u498511622 | 1501490534 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | while True:
w=float(input())
if w<=48:
judge='light fly'
elif 48<=w<=51:
judge='fly'
elif 51<=w<=54:
judge='bantam'
elif 54<=w<=57:
judge='feather'
elif 57<=w<=60:
judge='light'
elif 60<=w<=64:
judge='light welter'
elif 64<=w<=69:
judge='welter'
elif 69<=w<=75:
judge='light middle'
elif 75<=w<=81:
judge='middle'
elif 81<=w<=91:
judge='light heavy'
elif w>91:
judge='heavy'
print(judge) |
s599683040 | p00048 | u498511622 | 1501490543 | Python | Python3 | py | Runtime Error | 0 | 0 | 446 | while True:
w=int(input())
if w<=48:
judge='light fly'
elif 48<=w<=51:
judge='fly'
elif 51<=w<=54:
judge='bantam'
elif 54<=w<=57:
judge='feather'
elif 57<=w<=60:
judge='light'
elif 60<=w<=64:
judge='light welter'
elif 64<=w<=69:
judge='welter'
elif 69<=w<=75:
judge='light middle'
elif 75<=w<=81:
judge='middle'
elif 81<=w<=91:
judge='light heavy'
elif w>91:
judge='heavy'
print(judge) |
s105229632 | p00048 | u912237403 | 1388464218 | Python | Python | py | Runtime Error | 0 | 0 | 263 | import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0;
while w[i]<s:
i+=1
print c[i] |
s476992766 | p00048 | u912237403 | 1388464410 | Python | Python | py | Runtime Error | 0 | 0 | 262 | import sys
c=["light fly", "fly", "bantam", "feather", "light", "light welter",
"welter", "light middle", "middle", "light heavy", "heavy"]
w=[48,51,54,57,60,64,69,75,81,91]
for s in map(float,sys.stdin):
i=0
while w[i]<s:
i+=1
print c[i] |
s160360204 | p00048 | u633068244 | 1393665582 | Python | Python | py | Runtime Error | 0 | 0 | 640 | while True:
try:
w = float(raw_input())
if w <= 48.0:
print "light fly"
elif w <= 51.0:
print "fly"
elif w <= 54.0:
print "bantam"
elif w <= 57.0:
print "feather"
elif w <= 60:
print "light"
elif w <= 64.0:
print "light welter"
elif w <= 69.0:
print "welter"
elif w <= 75.0:
print "light middle"
elif w <= 81.0
print "middle"
elif w <= 91.0:
print "light heavy"
else:
print "heavy"
except:
break |
s909360134 | p00049 | u560838141 | 1410782343 | Python | Python | py | Runtime Error | 0 | 0 | 174 | d = {};
d["A"] = 0;
d["B"] = 0;
d["AB"] = 0;
d["O"] = 0;
while True:
b = raw_input().strip().split(",")[1]
d[b] += 1;
print d["A"]
print d["B"]
print d["AB"]
print d["O"] |
s366697547 | p00049 | u130979865 | 1461298170 | Python | Python | py | Runtime Error | 0 | 0 | 190 | # -*- coding: utf-8 -*-
import sys
dic = {'A':0, 'B':0, 'AB':0, 'O':0}
for line in sys.stdin:
id, type = map(int, line.split(','))
dic[type] += 1
for key in dic:
print dic[key] |
s388857335 | p00049 | u765849500 | 1462263730 | Python | Python | py | Runtime Error | 0 | 0 | 271 | a = 0
b= 0
ab = 0
o = 0
n = 0
while n < 15:
temp = input.split(",")[1]
if 'A' in temp:
a += 1
elif 'B' in temp:
b += 1
elif 'AB' in temp:
ab += 1
elif'O' in temp:
o += 1
print a
print b
print ab
print o |
s267104724 | p00049 | u765849500 | 1462263889 | Python | Python | py | Runtime Error | 0 | 0 | 299 | #coding: UTF-8
a = 0
b= 0
ab = 0
o = 0
n = 0
while n < 15:
temp = input.split(",")[1]
if temp == 'A':
a += 1
elif temp == 'B':
b += 1
elif temp == 'AB':
ab += 1
elif temp == 'O':
o += 1
print a
print b
print ab
print o
n += 1 |
s544928026 | p00049 | u765849500 | 1462264171 | Python | Python | py | Runtime Error | 0 | 0 | 263 | a = 0
b= 0
ab = 0
o = 0
while True:
temp = input.split(',')[1]
if temp == 'A':
a += 1
elif temp == 'B':
b += 1
elif temp == 'AB':
ab += 1
elif temp == 'O':
o += 1
print a
print b
print ab
print o |
s322153908 | p00049 | u032662562 | 1487258514 | Python | Python3 | py | Runtime Error | 0 | 0 | 261 | hist = {}
while True:
try:
i,b = input().strip().split(',')
if b in hist:
hist[b] += 1
else:
hist[b] = 1
except EOFError:
break
print("%d\n%d\n%d\n%d" % (hist['A'],hist['B'],hist['AB'],hist['O'])) |
s879439147 | p00049 | u912237403 | 1388471363 | Python | Python | py | Runtime Error | 0 | 0 | 146 | import sys
b={}
for s in sys.stdin:
i = s[s.index(',')+1:-1]
try: b[i]+=1
except: b[i]=1
for e in [0,1,3,2]:
print b[b.keys()[e]] |
s855568053 | p00049 | u912237403 | 1388471602 | Python | Python | py | Runtime Error | 0 | 0 | 162 | import sys
b={}
for s in sys.stdin:
i = s[s.index(',')+1:-1]
try:
b[i]+=1
except:
b[i]=1
for e in [0,1,3,2]:
print b[b.keys()[e]] |
s776994192 | p00050 | u560838141 | 1410782535 | Python | Python | py | Runtime Error | 0 | 0 | 101 | print raw_input().replace("apple", "!#$%!"#$").replace("peach", "apple").replace("!#$%!"#$", "peach") |
s913060153 | p00050 | u140201022 | 1449764367 | Python | Python | py | Runtime Error | 0 | 0 | 208 | ans=[]
for i in l:
if 'peach' in i:
ans.append(i.replace('peach','apple'))
elif 'apple' in i:
ans.append(i.replace('apple','peach'))
else:
ans.append(i)
print ' '.join(ans) |
s398242724 | p00050 | u140201022 | 1449764402 | Python | Python | py | Runtime Error | 0 | 0 | 218 | import re
ans=[]
for i in l:
if 'peach' in i:
ans.append(i.replace('peach','apple'))
elif 'apple' in i:
ans.append(i.replace('apple','peach'))
else:
ans.append(i)
print ' '.join(ans) |
s958276032 | p00050 | u894114233 | 1468655273 | Python | Python | py | Runtime Error | 0 | 0 | 380 | import string
sen=map(str,raw_input().split())
ans=[]
for i in sen:
if i[0:5]=="apple":
if len(i)>5:
ans.append("peach"+i[5:])
else:
ans.appned("peach")
elif i[0:5]=="peach":
if len(i)>5:
ans.append("apple"+i[5:])
else:
ans.append("apple")
else:
ans.append(i)
print(" ".join(ans)) |
s434377738 | p00050 | u894114233 | 1468655382 | Python | Python | py | Runtime Error | 0 | 0 | 464 | sen=map(str,raw_input().split())
ans=[]
for i in sen:
if len(i)>=5:
if i[0:5]=="apple":
if len(i)>5:
ans.append("peach"+i[5:])
else:
ans.appned("peach")
elif i[0:5]=="peach":
if len(i)>5:
ans.append("apple"+i[5:])
else:
ans.append("apple")
else:
ans.append(i)
else:
ans.append(i)
print(" ".join(ans)) |
s130297182 | p00050 | u300946041 | 1471305447 | Python | Python3 | py | Runtime Error | 0 | 0 | 340 | sentence = input().split()
# sentence = 'the cost of one peach is higher than that of one apple.'.split()
def converter(s):
if 'apple' == s or 'apple.' == s:
return s.replace('apple', 'peach')
elif 'peach' == s or 'peach.' == s:
return s.replace('peach', 'apple')
print(' '.join(map(converter, sentence)), end='') |
s924304061 | p00050 | u661290476 | 1483189946 | Python | Python | py | Runtime Error | 0 | 0 | 191 | s=input().rstrip(".").split()
v=[]
for i in s:
if i=="peach":
v.append("apple")
elif i=="apple":
v.append("peach")
else:
v.append(i)
print(" ".join(v)+".") |
s314281080 | p00050 | u519227872 | 1497627560 | Python | Python3 | py | Runtime Error | 0 | 0 | 239 | s = input().split()
ss = []
for w in s:
a = w.find('apple')
p = w.find('peach')
if a != -1:
w = w.replace('apple','peach')
elif p != -1:
w = w.replace('peach','apple')
ss.append(word)
print(' '.join(ss)) |
s540260124 | p00050 | u150984829 | 1519073682 | Python | Python3 | py | Runtime Error | 0 | 0 | 136 | a,p='apple','peach'
t={a:p,p:a}
print(*[t[w]if 5==len(w)and if w in t else t[w[:5]]+w[5:]if w[:5]in t else w for w in input().split()])
|
s323556369 | p00051 | u145563629 | 1428811334 | Python | Python | py | Runtime Error | 0 | 0 | 118 | st = []
n = raw_input()
for s in n:
st.append(s)
s.sort()
a = int("".join())
b = int("".join(s[::-1]))
print b - a |
s701366904 | p00051 | u145563629 | 1428811425 | Python | Python | py | Runtime Error | 0 | 0 | 162 | i = raw_input()
while (i):
i -= 1
st = []
n = raw_input()
for s in n:
st.append(s)
s.sort()
a = int("".join())
b = int("".join(s[::-1]))
print b - a |
s442154464 | p00051 | u145563629 | 1428811449 | Python | Python | py | Runtime Error | 0 | 0 | 167 | i = int(raw_input())
while (i):
i -= 1
st = []
n = raw_input()
for s in n:
st.append(s)
s.sort()
a = int("".join())
b = int("".join(s[::-1]))
print b - a |
s544728849 | p00051 | u145563629 | 1428811501 | Python | Python | py | Runtime Error | 0 | 0 | 169 | i = int(raw_input())
while (i):
i -= 1
st = []
n = raw_input()
for s in n:
st.append(s)
st.sort()
a = int("".join())
b = int("".join(st[::-1]))
print b - a |
s608508303 | p00051 | u148101999 | 1460267163 | Python | Python | py | Runtime Error | 0 | 0 | 171 | for i in xrange(input()):
n = sorted(raw_input())
x = int("".join(n[::-1]))
for j in xrange(len(n)):
if n[i] == "0": del n[i]
else: break
print x - int("".join(n)) |
s009233044 | p00051 | u148101999 | 1460267280 | Python | Python | py | Runtime Error | 0 | 0 | 188 | #encoding=utf-8
for i in xrange(input()):
n = sorted(raw_input())
x = int("".join(n[::-1]))
for j in xrange(len(n)):
if n[i] == "0": del n[i]
else: break
print x - int("".join(n)) |
s106249151 | p00051 | u150984829 | 1519074648 | Python | Python3 | py | Runtime Error | 0 | 0 | 104 | for _ in[0]*int(input()):
M=''.join(sorted(input()))[::-1]
print(int(M)-int(M[::-1].replace('0','')))
|
s175781671 | p00051 | u150984829 | 1519074947 | Python | Python3 | py | Runtime Error | 0 | 0 | 98 | for _ in[0]*int(input()):
M=''.join(sorted(input()))
print(int(M[::-1])-int(M.replace('0','')))
|
s788781635 | p00051 | u553148578 | 1530524959 | Python | Python3 | py | Runtime Error | 0 | 0 | 167 | while True:
x = int(input())
for i in range(x):
li = list(input())
li1 = int("".join(sorted(li)))
li2 = int("".join(sorted(li,reverse=True)))
print(li2-li1)
|
s466467686 | p00051 | u553148578 | 1530524992 | Python | Python3 | py | Runtime Error | 0 | 0 | 194 | while True:
x = int(input())
for i in range(x):
try:
li = list(input())
except:
break
li1 = int("".join(sorted(li)))
li2 = int("".join(sorted(li,reverse=True)))
print(li2-li1)
|
s286254584 | p00051 | u553148578 | 1530525106 | Python | Python3 | py | Runtime Error | 0 | 0 | 194 | while True:
x = int(input())
for i in range(x):
try:
li = list(input())
except:
break
li1 = int("".join(sorted(li)))
li2 = int("".join(sorted(li,reverse=True)))
print(li2-li1)
|
s371147592 | p00052 | u553148578 | 1531293734 | Python | Python3 | py | Runtime Error | 0 | 0 | 167 | import math
while True:
x = math.factorial(int(input()))
n = list(str(x))
con = 0
for i in range(len(n)-1,0,-1):
if n[i] != '0':
break
con += 1
print(con)
|
s972104841 | p00052 | u553058997 | 1475660805 | Python | Python3 | py | Runtime Error | 0 | 0 | 281 | #! /usr/bin/env python
import math
while True:
inp = input()
if inp == '0': break
num = math.factorial(int(inp))
cnt = 0
while True:
if num % 10 == 0:
cnt = cnt + 1
num = num / 10
else:
break
print(cnt) |
s638108952 | p00052 | u553058997 | 1475660819 | Python | Python3 | py | Runtime Error | 0 | 0 | 258 | import math
while True:
inp = input()
if inp == '0': break
num = math.factorial(int(inp))
cnt = 0
while True:
if num % 10 == 0:
cnt = cnt + 1
num = num / 10
else:
break
print(cnt) |
s501188128 | p00052 | u553058997 | 1475661285 | Python | Python3 | py | Runtime Error | 0 | 0 | 341 | def factorial(n):
res = 1
for i in range(1, n+1):
res = res * i
return res
while True:
inp = input()
if inp == '0': break
num = factorial(int(inp))
cnt = 0
while True:
if num % 10 == 0:
cnt = cnt + 1
num = int(num / 10)
else:
break
print(cnt) |
s104281037 | p00052 | u553058997 | 1475661306 | Python | Python3 | py | Runtime Error | 0 | 0 | 341 | def factorial(n):
res = 1
for i in range(1, n+1):
res = res * i
return res
while True:
inp = input()
if inp == '0': break
num = factorial(int(inp))
cnt = 0
while True:
if num % 10 == 0:
cnt = cnt + 1
num = int(num / 10)
else:
break
print(cnt) |
s741943419 | p00052 | u553058997 | 1475661414 | Python | Python3 | py | Runtime Error | 0 | 0 | 283 | while True:
inp = input()
if inp == '0': break
num = 1
for i in range(1, int(inp)):
num = num * i
cnt = 0
while True:
if num % 10 == 0:
cnt = cnt + 1
num = int(num / 10)
else:
break
print(cnt) |
s876958006 | p00052 | u553058997 | 1475661843 | Python | Python | py | Runtime Error | 0 | 0 | 312 | while True:
inp = input()
if inp == '0': break
num = 1
for i in range(1, int(inp)+1):
num = num * i
cnt = 0
strnum = str(num)
while True:
if strnum[-1] == '0':
cnt = cnt + 1
strnum = strnum[:-1]
else:
break
print(cnt) |
s549392819 | p00052 | u078042885 | 1484109687 | Python | Python3 | py | Runtime Error | 0 | 0 | 122 | while 1:
n,i=int(input()),0
if n==0:break
n=str(math.factorial(n))[::-1]
while n[i]=='0':i+=1
print(i) |
s356257280 | p00052 | u150984829 | 1519211877 | Python | Python3 | py | Runtime Error | 0 | 0 | 77 | for e in iter(input,'0'):
e=int(e)
print(sum(n//5**i)for i in range(1,6)))
|
s482005356 | p00052 | u150984829 | 1519211901 | Python | Python3 | py | Runtime Error | 0 | 0 | 77 | for e in iter(input,'0'):
e=int(e)
print(sum(e//5**i)for i in range(1,6)))
|
s863684038 | p00052 | u150984829 | 1519211915 | Python | Python3 | py | Runtime Error | 0 | 0 | 76 | for e in iter(input,'0'):
e=int(e)
print(sum(e//5**ifor i in range(1,6)))
|
s073386084 | p00052 | u912237403 | 1388838459 | Python | Python | py | Runtime Error | 0 | 0 | 138 | import sys
for n in sys.stdin:
c=0
for i in range(1,int(n)+1):
while i%5==0:
i/=5
c+=1
print c |
s391135431 | p00052 | u912237403 | 1388838934 | Python | Python | py | Runtime Error | 0 | 0 | 150 | import sys
for n in sys.stdin:
c=0
for i in range(1,int(n)+1):
j=i
while j%5==0:
j/=5
c+=1
print c |
s924554871 | p00053 | u553148578 | 1531294544 | Python | Python3 | py | Runtime Error | 0 | 0 | 290 | import math
n = []
li = []
li = [i for i in range(2,100000)]
while li[0] <= int(math.sqrt(100000)):
n.append(li[0])
sss = li[0]
li = [i for i in li if i % sss != 0]
n.extend(li)
while True:
ans = 0
x = int(input())
if x == 0: break
for i in range(x):
ans += n[i]
print(ans)
|
s637131398 | p00053 | u553148578 | 1531294631 | Python | Python3 | py | Runtime Error | 0 | 0 | 290 | import math
n = []
li = []
li = [i for i in range(2,100000)]
while li[0] <= int(math.sqrt(100000)):
n.append(li[0])
sss = li[0]
li = [i for i in li if i % sss != 0]
n.extend(li)
while True:
ans = 0
x = int(input())
if x == 0: break
for i in range(x):
ans += n[i]
print(ans)
|
s675561746 | p00053 | u553148578 | 1531294686 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | import math
n = []
li = []
li = [i for i in range(2,10000)]
while li[0] <= int(math.sqrt(10000)):
n.append(li[0])
sss = li[0]
li = [i for i in li if i % sss != 0]
n.extend(li)
while True:
ans = 0
x = int(input())
if x == 0: break
for i in range(x):
ans += n[i]
print(ans)
|
s338865477 | p00053 | u579833671 | 1410916886 | Python | Python | py | Runtime Error | 0 | 0 | 427 | isPrime = [True] * 10001
sum = 0
sumPrime = [sum]
def calcPrime():
global sum
isPrime[0] = isPrime[1] = False
for i in range(len(isPrime)):
if(isPrime[i]):
sum += i
sumPrime.append(sum)
for j in range(2 * i, len(isPrime), i):
isPrime[j] = False
calcPrime()
while(True):
n = input()
if(n == 0):
break
print(sumPrime[n]) |
s461405570 | p00053 | u744114948 | 1426155210 | Python | Python3 | py | Runtime Error | 0 | 0 | 381 | def pri(s,n):
tab=[i for i in range(n+1) if s[i] and i>=2]
return(tab)
s=[True for _ in range(999999+1)]
i=2
while i**2<=999999:
if s[i]:
j=i*2
while j<=999999:
s[j]=False
j+=i
i+=1
s=pri(s,10000)
while True:
n = int(input())
if n == 0: break
sum = 0
for i in range(n):
sum += s[i]
print(sum) |
s515843932 | p00053 | u994049982 | 1458660072 | Python | Python | py | Runtime Error | 0 | 0 | 229 | a=map(int,raw_input().split())[1:]
import math
def p(a):
b,c,i=range(2,2*math.log(a)*a)),[],0
while len(b)!=0:
c.append(b[0])
b=[i for i in b[1:] if i%b[0]!=0]
return sum(c)
for i in a:print(str(p(i))) |
s842137713 | p00053 | u994049982 | 1458660120 | Python | Python | py | Runtime Error | 0 | 0 | 234 | a=map(int,raw_input().split())
a=a[:-1]
import math
def p(a):
b,c,i=range(2,2*math.log(a)*a)),[],0
while len(b)!=0:
c.append(b[0])
b=[i for i in b[1:] if i%b[0]!=0]
return sum(c)
for i in a:print(str(p(i))) |
s873064494 | p00053 | u994049982 | 1458660790 | Python | Python | py | Runtime Error | 0 | 0 | 274 | import math
def p(a):
b,c,i=range(2,int(10+2*math.log(a)*a)),[],0
while len(c)!=a:
c.append(b[0])
b=[i for i in b[1:] if i%b[0]!=0]
return sum(c)
a=map(int,input().split())
for i in a:
if i!=0:
print(str(p(i)))
else:
break |
s864335841 | p00053 | u994049982 | 1458662009 | Python | Python3 | py | Runtime Error | 0 | 0 | 310 | def p(a):
b=[]
i=1
while len(b)!=a:
i+=1
if ip(i):b.append(i)
return sum(b)
def ip(a):
i=2
while a>=i**2:
if a%i==0:return False
i+=1
return True
a=map(int,raw_input().split())
for i in a:
if i!=0:
print(str(p(i)))
else:
break |
s115060570 | p00053 | u130979865 | 1461300197 | Python | Python | py | Runtime Error | 0 | 0 | 353 | # -*- coding: utf-8 -*-
primes = [2]
n = 3
while n < 10000:
flag = True
for p in primes:
if n % p == 0:
flag = False
break
if flag:
primes.append(n)
n += 1
while True:
n = int(raw_input())
if n == 0:
break
sum = 0
for i in range(n):
sum += primes[i]
print sum |
s950248350 | p00053 | u546285759 | 1483587752 | Python | Python3 | py | Runtime Error | 0 | 0 | 278 | import sys
pn, tmp = [], [i for i in range(2, 10000)]
while tmp[0] < 100:
v = tmp.pop(0)
pn.append(v)
tmp = list(filter(lambda x: x%v!=0, tmp))
for t in tmp: pn.append(t)
while True:
n = int(input())
if n==0: break
print(sum([pn[i] for i in range(n)])) |
s480812832 | p00053 | u711765449 | 1485700386 | Python | Python3 | py | Runtime Error | 0 | 0 | 447 | def mark(s, x):
for i in range(x + x, len(s), x):
s[i] = False
def sieve(n):
s = [True] * n
for x in range(2, int(n**0.5) + 1):
if s[x]: mark(s, x)
return [i for i in range(0,n) if s[i] and i > 1]
n = []
while True:
tmp = int(input())
if tmp == 0:
break
n.append(tmp)
m = max(n)
p = sieve(10000)
for i in range(len(n)):
sum = 0
for j in range(n[i]):
sum += p[j]
print(sum) |
s750537163 | p00053 | u711765449 | 1485700562 | Python | Python3 | py | Runtime Error | 0 | 0 | 504 | def mark(s, x):
for i in range(x + x, len(s), x):
s[i] = False
def sieve(n):
s = [True] * n
for x in range(2, int(n**0.5) + 1):
if s[x]: mark(s, x)
return [i for i in range(0,n) if s[i] and i > 1]
n = []
while True:
tmp = int(input())
if tmp == 0:
break
n.append(tmp)
m = max(n)
p = sieve(10000)
for i in range(len(n)):
sum = 0
if n[i] == 1:
print(2)
else:
for j in range(n[i]):
sum += p[j]
print(sum) |
s247075460 | p00053 | u811733736 | 1503221624 | Python | Python3 | py | Runtime Error | 0 | 0 | 626 | Primes = []
def find_nth_prime(n):
""" n??????????´???°????±??????? """
count = len(Primes)
if count >= n:
return
if count > 0:
num = Primes[-1] + 1
else:
num = 2
while True:
if is_prime(num):
count += 1
Primes.append(num)
if count >= n:
break
num += 1
if __name__ == '__main__':
# ??????????????\???
while True:
data = int(input())
if data == 0:
break
# ????????¨???????????¨???
find_nth_prime(data)
# print(Primes)
print(sum(Primes[:data])) |
s127610265 | p00053 | u600263347 | 1517147294 | Python | Python3 | py | Runtime Error | 0 | 0 | 449 | def is_prime(q):
q = abs(q)
if q == 2: return True
if q < 2 or q&1 == 0: return False
return pow(2, q-1, q) == 1
def main():
prime = []
for i in range(10001):
if is_prime(i):
prime.append(i)
while True:
n = int(input())
if n == 0:
break
s = 0
for i in range(n):
s += prime[i]
print(s)
if __name__ == '__main__':
main()
|
s167933203 | p00053 | u260980560 | 1384874970 | Python | Python | py | Runtime Error | 0 | 0 | 210 | s = [0]
M = 10001
p = [1]*M
S = 0
for i in xrange(2,M):
if p[i]:
for j in xrange(i*i,M,i):
p[j] = 0
S += i; s.append(S)
while 1:
n = input()
if n==0: break
print s[n] |
s262204150 | p00053 | u633068244 | 1393672976 | Python | Python | py | Runtime Error | 0 | 0 | 306 | r = 10000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
while True:
n = int(raw_input())
if not n:
break
sum = 0
for i in range(n):
if p[i] == 1:
sum += i
print sum |
s059753316 | p00053 | u633068244 | 1393673157 | Python | Python | py | Runtime Error | 0 | 0 | 356 | import math
r = 10000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
while True:
n = int(raw_input())
if not n:
break
i, num = 0, 1
while num < n:
if p[i] == 1:
num += 1
sum += i
i += 1
print sum |
s197391369 | p00053 | u633068244 | 1393673249 | Python | Python | py | Runtime Error | 0 | 0 | 364 | import math
r = 10000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
while True:
n = int(raw_input())
if not n:
break
i, num, sum = 0, 1, 0
while num < n:
if p[i] == 1:
num += 1
sum += i
i += 1
print sum |
s716433912 | p00053 | u633068244 | 1393673386 | Python | Python | py | Runtime Error | 0 | 0 | 366 | import math
r = 10000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
while True:
n = int(raw_input())
if not n:
break
i, num, sum = 0, 0, 0
while num < n:
if p[i] == 1:
num += 1
sum += i+1
i += 1
print sum |
s214315693 | p00053 | u633068244 | 1393673478 | Python | Python | py | Runtime Error | 0 | 0 | 368 | import math
r = 100000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
while True:
n = int(raw_input())
if not n:
break
i, num, sum = 0, 0, 0
while num < n:
if p[i] == 1:
num += 1
sum += i+1
i += 1
print sum |
s588657101 | p00053 | u633068244 | 1393674722 | Python | Python | py | Runtime Error | 0 | 0 | 758 | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
prime = [0 for i in ranege(10000)]
j = 0
for i in range(len(p)):
if p[i]:
prime[j] = i+1
j += 1
while True:
n = int(raw_input())
if not n:
break
print sum(prime[:n])import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
prime = [0 for i in ranege(10000)]
j = 0
for i in range(len(p)):
if p[i]:
prime[j] = i+1
j += 1
while True:
n = int(raw_input())
if not n:
break
print sum(prime[:n]) |
s878871939 | p00053 | u633068244 | 1393674755 | Python | Python | py | Runtime Error | 0 | 0 | 378 | import math
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
prime = [0 for i in range(10000)]
j = 0
for i in range(len(p)):
if p[i]:
prime[j] = i+1
j += 1
while True:
n = int(raw_input())
if not n:
break
print sum(prime[:n]) |
s576439104 | p00053 | u633068244 | 1393675013 | Python | Python | py | Runtime Error | 0 | 0 | 426 | import math
prime = [0 for i in range(11000
k = 0
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
prime[k] = i+1
k += 1
l = i
for j in range(2*i+1,r,i+1):
p[j] = 0
for i in range(l,r):
if p[i]:
prime[k] = i+1
k += 1
while True:
n = int(raw_input())
if not n:
break
print sum(prime[:n]) |
s877735169 | p00053 | u633068244 | 1393675496 | Python | Python | py | Runtime Error | 0 | 0 | 389 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
prime = [0 for i in range(11000)]
prime[0] = 2
k = 0
for i in range(2,r):
if p[i]:
prime[k] = i+1+prime[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print sum(prime[:n]) |
s523592891 | p00053 | u633068244 | 1393675543 | Python | Python | py | Runtime Error | 0 | 0 | 362 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 0
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print (n) |
s041139850 | p00053 | u633068244 | 1393675603 | Python | Python | py | Runtime Error | 0 | 0 | 360 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print (n) |
s749272748 | p00053 | u633068244 | 1393675652 | Python | Python | py | Runtime Error | 0 | 0 | 361 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print s(n) |
s059134261 | p00053 | u633068244 | 1393675711 | Python | Python | py | Runtime Error | 0 | 0 | 363 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print s[n-1] |
s537463771 | p00053 | u633068244 | 1393675821 | Python | Python | py | Runtime Error | 0 | 0 | 363 | import math
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
s = [0 for i in range(11000)]
s[0] = 2
k = 1
for i in range(2,r):
if p[i]:
s[k] = i+1+s[k-1]
k += 1
while True:
n = int(raw_input())
if not n:
break
print s[n-1] |
s474595700 | p00053 | u491763171 | 1400469949 | Python | Python | py | Runtime Error | 0 | 0 | 376 | def sieve(n):
primes = [True] * n
primes[0] = primes[1] = False
for i in xrange(2, int(n ** 0.5) + 1):
if primes[i]:
for j in xrange(i * i, n, i):
primes[j] = False
return [i for i in xrange(n) if primes[i]]
prime_list = sieve(200000)
while 1:
a = input()
if a == 0:
break
prin
t sum(prime_list[:a]) |
s840300539 | p00053 | u436634575 | 1402303932 | Python | Python3 | py | Runtime Error | 0 | 0 | 271 | N = 10000
p = [1]*(N + 1)
for i in range(4, N + 1, 2): p[i] = 0
a = [2]
for i in range(3, N + 1, 2):
if p[i] == 1:
a.append(a[-1] + i)
for j in range(3*i, N + 1, 2*i): p[j] = 0
while True:
n = int(input())
if n == 0: break
print(a[n - 1]) |
s334802405 | p00053 | u436634575 | 1402304294 | Python | Python3 | py | Runtime Error | 0 | 0 | 286 | N = 104723
p = [1]*(N + 1)
for i in range(4, N + 1, 2): p[i] = 0
a = [2]
for i in range(3, N + 1, 2):
if p[i] == 1:
a.append(a[-1] + i)
for j in range(3*i, N + 1, 2*i): p[j] = 0
print(len(a))
while True:
n = int(input())
if n == 0: break
print(a[n - 1]) |
s797023802 | p00053 | u436634575 | 1402304337 | Python | Python3 | py | Runtime Error | 0 | 0 | 272 | N = 104723
p = [1]*(N + 1)
for i in range(4, N + 1, 2): p[i] = 0
a = [2]
for i in range(3, N + 1, 2):
if p[i] == 1:
a.append(a[-1] + i)
for j in range(3*i, N + 1, 2*i): p[j] = 0
while True:
n = int(input())
if n == 0: break
print(a[n - 1]) |
s003274977 | p00054 | u560838141 | 1410783160 | Python | Python | py | Runtime Error | 0 | 0 | 77 | sum(map(int, format(input()/float(input()), ".11f").split(".")[1])[:input()]) |
s256719933 | p00054 | u744114948 | 1426157657 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | while True:
try:
a, b, n = map(int, input().split())
except:
break
sum = 0
s = list(str(a/b))
for i in s[2:2+n]:
sum += int(i)
print(sum) |
s630170374 | p00054 | u744114948 | 1426157798 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | while True:
try:
a, b, n = map(int, input().split())
except:
break
sum = 0
s = list(str(a/b))
for i in s[2:2+n]:
sum += int(i)
print(sum) |
s948480527 | p00054 | u744114948 | 1426157871 | Python | Python3 | py | Runtime Error | 0 | 0 | 191 | while True:
try:
a, b, n = map(int, input().split())
s = list(str(a/b))
except:
break
sum = 0
for i in s[2:2+n]:
sum += int(i)
print(sum) |
s565776628 | p00054 | u744114948 | 1426157941 | Python | Python3 | py | Runtime Error | 0 | 0 | 181 | while True:
try:
a, b, n = map(int, input().split())
except:
break
s = str(a/b)
sum = 0
for i in s[2:2+n]:
sum += int(i)
print(sum) |
s941923249 | p00054 | u879226672 | 1426180178 | Python | Python | py | Runtime Error | 0 | 0 | 422 | def f(num, i, tmp):
for k in xrange(10):
if k * 10**(-i) <= num - tmp < (k + 1) * 10**(-i):
return k
break
while True:
try:
a,b,n = map(int,raw_input().split())
except EOFError:
break
a = float(a)
s = 0
tmp = f(a/b,0,0)
for i in range(1,n+1):
val = f(a/b, i, tmp)
s += val
tmp += float(val * 10 ** (-i))
print s |
s332775963 | p00054 | u879226672 | 1426180210 | Python | Python | py | Runtime Error | 0 | 0 | 445 | -*- coding: utf-8 -*-
def f(num, i, tmp):
for k in xrange(10):
if k * 10**(-i) <= num - tmp < (k + 1) * 10**(-i):
return k
break
while True:
try:
a,b,n = map(int,raw_input().split())
except EOFError:
break
a = float(a)
s = 0
tmp = f(a/b,0,0)
for i in range(1,n+1):
val = f(a/b, i, tmp)
s += val
tmp += float(val * 10 ** (-i))
print s |
s979099739 | p00054 | u879226672 | 1426180429 | Python | Python | py | Runtime Error | 0 | 0 | 446 | # -*- coding: utf-8 -*-
def f(num, i, tmp):
for k in xrange(10):
if k * 10**(-i) <= num - tmp < (k + 1) * 10**(-i):
return k
break
while True:
try:
a,b,n = map(int,raw_input().split())
except EOFError:
break
a = float(a)
s = 0
tmp = f(a/b,0,0)
for i in range(1,n+1):
val = f(a/b, i, tmp)
s += val
tmp += float(val * 10 ** (-i))
print s |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.