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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s004111167 | p00054 | u879226672 | 1426180516 | Python | Python | py | Runtime Error | 0 | 0 | 381 |
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:
a,b,n = map(int,raw_input().split())
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 |
s010168465 | p00054 | u145563629 | 1428816242 | Python | Python | py | Runtime Error | 0 | 0 | 159 |
while (1):
ls = raw_input()
ls = ls.split()
st = str(float(ls[0]) / float(ls[1]))
print st
s = 0
for i in st[2:int(ls[2]) + 2]:
s += int(i)
print s |
s793618234 | p00054 | u145563629 | 1428816457 | Python | Python | py | Runtime Error | 0 | 0 | 196 |
while 1:
try:
ls = raw_input()
except:
break
else:
ls = ls.split()
st = str(float(ls[0]) / float(ls[1]))
print st
s = 0
for i in st[2:int(ls[2]) + 2]:
s += int(i)
print s |
s442684201 | p00054 | u145563629 | 1428816481 | Python | Python | py | Runtime Error | 0 | 0 | 197 |
while 1:
try:
ls = raw_input()
except:
exit()
else:
ls = ls.split()
st = str(float(ls[0]) / float(ls[1]))
print st
s = 0
for i in st[2:int(ls[2]) + 2]:
s += int(i)
print s |
s130475349 | p00054 | u145563629 | 1428816820 | Python | Python | py | Runtime Error | 0 | 0 | 186 | while 1:
try:
ls = raw_input()
ls = ls.split()
st = str(float(ls[0]) / float(ls[1]))
s = 0
for i in st[2:int(ls[2]) + 2]:
s += int(i)
print s
except EOFError:
break |
s136483742 | p00054 | u145563629 | 1428817248 | Python | Python | py | Runtime Error | 0 | 0 | 179 | while 1:
try:
ls = raw_input()
except EOFError:
break
ls = ls.split()
st = str(float(ls[0]) / float(ls[1]))
s = 0
for i in st[2:int(ls[2]) + 2]:
s += int(i)
print st |
s047713442 | p00054 | u489809100 | 1446465281 | Python | Python | py | Runtime Error | 0 | 0 | 246 | while True:
try:
num = raw_input().split(" ")
sum = 0
x = float(num[0]) / float(num[1])
if x < 1:
x = x + 1.0
for var in range(1, int(num[2]) + 1):
sum += int(str(x * 10**var)[var:var+1])
print sum
except EOFError:
break |
s041922535 | p00054 | u489809100 | 1446465384 | Python | Python | py | Runtime Error | 0 | 0 | 214 | while True:
num = raw_input().split(" ")
sum = 0
x = float(num[0]) / float(num[1])
if x < 1:
x = x + 1.0
for var in range(1, int(num[2]) + 1):
sum += int(str(x * 10**var)[var:var+1])
print sum |
s481355822 | p00054 | u220324665 | 1473757436 | Python | Python3 | py | Runtime Error | 0 | 0 | 159 | import sys
for line in sys.stdin:
a,b,n=map(int,line.split())
for i in range(n):a*=10
s=str(a//b)[::-1]
cnt=0
for i in range(n):cnt+=int(s[i])
print(cnt) |
s922241121 | p00054 | u220324665 | 1473757480 | Python | Python | py | Runtime Error | 0 | 0 | 159 | import sys
for line in sys.stdin:
a,b,n=map(int,line.split())
for i in range(n):a*=10
s=str(a//b)[::-1]
cnt=0
for i in range(n):cnt+=int(s[i])
print(cnt) |
s396632516 | p00054 | u220324665 | 1473757529 | Python | Python3 | py | Runtime Error | 0 | 0 | 163 | import sys
for line in sys.stdin:
a,b,n=map(int,line.split())
for i in range(n):a*=10
s=str(int(a/b))[::-1]
cnt=0
for i in range(n):cnt+=int(s[i])
print(cnt) |
s951748612 | p00054 | u220324665 | 1473757795 | Python | Python3 | py | Runtime Error | 0 | 0 | 205 | import sys
inp=[]
for line in sys.stdin:
inp.append(line)
for line in inp:
a,b,n=map(int,line.split())
for i in range(n):a*=10
s=str(int(a/b))[::-1]
cnt=0
for i in range(n):cnt+=int(s[i])
print(cnt) |
s596829242 | p00054 | u220324665 | 1473757870 | Python | Python3 | py | Runtime Error | 0 | 0 | 213 | import sys
inp=[]
for line in sys.stdin:
if line:inp.append(line)
for line in inp:
a,b,n=map(int,line.split())
for i in range(n):a*=10
s=str(int(a/b))[::-1]
cnt=0
for i in range(n):cnt+=int(s[i])
print(cnt) |
s488772793 | p00054 | u150984829 | 1519220115 | Python | Python3 | py | Runtime Error | 0 | 0 | 102 | import sys
for e in sys.stdin:
a,b,n=map(int,e.split())
print(sum(int(i)for i in str(a/b)[2:][:n]))
|
s776917234 | p00054 | u138224929 | 1526551574 | Python | Python3 | py | Runtime Error | 0 | 0 | 314 | import sys
import math as m
ans = []
for line in sys.stdin:
oneset = list(map(int,input().split()))
sums = 0
for i in range(oneset[2]):
k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** k)))
sums = sums + (int % 10)
ans.append(sums)
for i in range(len(ans)):
print(ans[i])
|
s355290704 | p00054 | u138224929 | 1526552551 | Python | Python3 | py | Runtime Error | 0 | 0 | 379 | import sys
import math as m
ans = []
for line in sys.stdin:
try:
oneset = list(map(int,line.split()))
sums = 0
for i in range(oneset[2]):
k = int(m.floor((oneset[0] / oneset[1] ) * (10 ** (i + 1))))
sums = sums + (k % 10)
ans.append(sums)
except:
break
for i in range(len(ans)):
print(strint((ans[i])))
|
s070541104 | p00054 | u138224929 | 1526555098 | Python | Python3 | py | Runtime Error | 0 | 0 | 285 | import sys
import math as m
ans = []
for line in sys.stdin:
oneset = list(map(int,input().split()))
sums = 0
for i in range(oneset[2]):
k = int(m.floor((oneset[0] * (10 ** (i + 1)/ oneset[1] ) ))
sums = sums + (k % 10)
ans.append(sums)
print(sums)
|
s731802996 | p00054 | u138224929 | 1526555154 | Python | Python3 | py | Runtime Error | 0 | 0 | 285 | import sys
import math as m
ans = []
for line in sys.stdin:
oneset = list(map(int,input().split()))
sums = 0
for i in range(oneset[2]):
k = int(m.floor((oneset[0] * (10 ** (i + 1)/ oneset[1] ) ))
sums = sums + (k % 10)
ans.append(sums)
print(sums)
|
s618053484 | p00054 | u093607836 | 1382285848 | Python | Python | py | Runtime Error | 0 | 0 | 168 | import sys
import itertools
for s in sys.stdin:
input = int(s)
cnt = 0
for i in itertools.product(range(10), repeat=4):
if sum(i) == input:
cnt += 1
print cnt |
s552443977 | p00054 | u238820099 | 1387803568 | Python | Python | py | Runtime Error | 0 | 0 | 386 | import sys
#getInt = lambda x, a : int((x % 10 ** a - x % 10 ** (a - 1))/10**(a-1))
getNum = lambda x, a : int(x / 10 ** a % 10)
for str in iter(sys.stdin.readline, ""):
str.split()
firstnum = float(str[0])
secondnum = float(str[2])
therdnum = int(str[4])
ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])
print ans |
s738826827 | p00054 | u238820099 | 1387803636 | Python | Python | py | Runtime Error | 0 | 0 | 393 | import sys
#getInt = lambda x, a : int((x % 10 ** a - x % 10 ** (a - 1))/10**(a-1))
getNum = lambda x, a : int(x / 10 ** a % 10)
for str in iter(sys.stdin.readline, ""):
str.split()
firstnum = float(str[0])
secondnum = float(str[2])
therdnum = int(str[4])
ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])
print ans |
s330773232 | p00054 | u238820099 | 1387803753 | Python | Python | py | Runtime Error | 0 | 0 | 374 | import sys
#getInt = lambda x, a : int((x % 10 ** a - x % 10 ** (a - 1))/10**(a-1))
getNum = lambda x, a : int(x / 10 ** a % 10)
for str in sys.stdin:
str.split()
firstnum = float(str[0])
secondnum = float(str[2])
therdnum = int(str[4])
ans = sum([getNum(firstnum/secondnum, -x) for x in range(1, therdnum+1)])
print ans |
s368885531 | p00054 | u912237403 | 1388924813 | Python | Python | py | Runtime Error | 0 | 0 | 139 | s in sys.stdin:
a,b,n=map(int,s.split())
a=a%b
s=0
for i in range(n):
a*=10
s+=a/b
a%=b
print s |
s090228297 | p00054 | u633068244 | 1393673239 | 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 |
s142636373 | p00055 | u150984829 | 1519223194 | Python | Python3 | py | Runtime Error | 0 | 0 | 179 | import sys
for e in sys.stdin:
t=[a,
a*2,
a*2/3,
a*2/3*2,
a*2/3*2/3,
a*2/3*2/3*2,
a*2/3*2/3*2/3,
a*2/3*2/3*2/3*2,
a*2/3*2/3*2/3*2/3,
a*2/3*2/3*2/3*2/3*2]
print(sum(t))
|
s774492610 | p00055 | u553148578 | 1530511916 | Python | Python3 | py | Runtime Error | 0 | 0 | 136 | while 1:
x = float(input())
s=x
for i in range(9):
if i % 2 == 0:
s = s*2
x+=s
if i % 2 == 1:
s = s/3
x+=s
print(x)
|
s885078111 | p00055 | u633068244 | 1393679241 | Python | Python | py | Runtime Error | 0 | 0 | 211 | while True:
a = float(raw_input())
sum = a
for i in range(2,11):
if i % 2 == 0:
a *= 2.0
sum += a
else:
a /= 3.0
sum += a
print sum |
s222685241 | p00056 | u358919705 | 1473272350 | Python | Python3 | py | Runtime Error | 0 | 0 | 724 | def make_ps(n):
tbl = [False, True, False, False, False, True] * (n // 6 + 1)
for i in range(1, 4):
tbl[i] = not tbl[i]
p, stp, sqrt = 5, 2, n ** 0.5
while p < sqrt:
for i in range(p ** 2, n, 2 * p):
tbl[i] = False
while True:
p += stp
stp = 6 - stp
if tbl[p]:
break
return [i for i in range(n) if tbl[i]]
ps = make_ps(n)
while True:
n = int(input())
if not n:
break
res = 0
if n % 2:
if n - 2 in ps:
res += 1
else:
res = 0
for p in ps:
if p > n / 2:
break
if n - p in ps:
res += 1
print(res) |
s677725445 | p00056 | u462831976 | 1493154579 | Python | Python | py | Runtime Error | 0 | 0 | 649 | N = 50001
lst = [True] * N
lst[0] = False
lst[1] = False
for i in range(2, int(N ** 0.5) + 1):
if lst[i]:
for j in range(i * i, N, i):
lst[j] = False
primes = [i for i in range(1, N) if lst[i]]
for s in sys.stdin:
n = int(s)
if n == 0:
break
elif n % 2 == 1:
if lst[n - 2]:
print(1)
else:
print(0)
elif n == 4:
print(1)
else:
counter = 0
for prime0 in primes:
prime1 = n - prime0
if prime0 <= prime1 and lst[prime1]:
#print(prime0, prime1)
counter += 1
print(counter) |
s835115454 | p00056 | u546285759 | 1508912235 | Python | Python3 | py | Runtime Error | 0 | 0 | 368 | import bisect
primes = [0, 0] + [1] * 49999
for i in range(2, 224):
if primes[i]:
for j in range(i*i, 50001, i):
primes[j] = 0
values = [i for i, k in enumerate(primes) if k]
while True:
n = int(input())
if n == 0:
break
I = bisect.bisect(values, n//2)
print([i for i, v in enumerate(values[:I]) if primes[n-v]][-1] + 1) |
s221123097 | p00056 | u024715419 | 1517976680 | Python | Python3 | py | Runtime Error | 0 | 0 | 372 | n = 50001
c = [1 for i in range(n)]
c[0] = 0
i = 2
while i**2 <= n:
j = i*2
while j <= n:
c[j - 1] = 0
j += i
i += 1
while True:
n = int(input())
if n == 0:
break
elif n%2 == 1:
print(0)
continue
cnt = 0
for i in range(n/2):
if c[i] == 1 and c[n-i] == 1:
cnt +=1
print(cnt)
|
s417453957 | p00056 | u024715419 | 1517982782 | Python | Python3 | py | Runtime Error | 0 | 0 | 486 | n = 30000
is_prime = [True for i in range(n)]
is_prime[0] = is_prime[1] = False
i = 2
while i**2 <= n:
j = i*2
while j < n:
is_prime[j] = False
j += i
i += 1
cnt_pair = [0 for i in range(n)]
for i in range(n):
if is_prime[i]:
for j in range(i, n):
if i + j >= n:
break
if is_prime[j]:
cnt_pair[i + j] += 1
while True:
n = int(input())
if n == 0:
break
print(cnt_pair[n])
|
s140685066 | p00056 | u150984829 | 1519352265 | Python | Python3 | py | Runtime Error | 0 | 0 | 308 | import bisect
from itertools import *
n=range(49994);a=list(n)
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in iter(input,'0'):
x=int(x)
y=bisect.bisect(p,x//2)
if x%2:print(sum(1 for c in p[1:y]if 2+c==x))
elif x-4:print(sum(1 for c in p[1:y]if a[x-c]))
else:print(1)
|
s003698309 | p00056 | u150984829 | 1519352319 | Python | Python3 | py | Runtime Error | 0 | 0 | 308 | import bisect
from itertools import *
n=range(49994);a=list(n)
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in iter(input,'0'):
x=int(x)
y=bisect.bisect(p,x//2)
if x%2:print(sum(1 for c in p[1:x]if 2+c==x))
elif x-4:print(sum(1 for c in p[1:y]if a[x-c]))
else:print(1)
|
s135459611 | p00056 | u150984829 | 1519352757 | Python | Python3 | py | Runtime Error | 0 | 0 | 321 | import bisect
from itertools import *
n=range(49994);a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in iter(input,'0'):
x=int(x)
if x%2:print(sum(2+c==x for c in p[:bisect.bisect(p,x)]))
elif x-4:print(sum(1 for c in p[:bisect.bisect(p,x//2)]if a[x-c]))
else:print(1)
|
s974490623 | p00056 | u150984829 | 1519352800 | Python | Python3 | py | Runtime Error | 0 | 0 | 323 | import bisect
from itertools import *
n=range(49994);a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in iter(input,'0'):
x=int(x)
if x%2:print(sum(2+c==x for c in p[:bisect.bisect(p,x)-1]))
elif x-4:print(sum(1 for c in p[:bisect.bisect(p,x//2)]if a[x-c]))
else:print(1)
|
s684846560 | p00056 | u150984829 | 1519354819 | Python | Python3 | py | Runtime Error | 0 | 0 | 240 | import bisect,sys
from itertools import *
n=range(50001);a=list(n);a[1]=0
for i in range(2,224):a[i*2::i]=[0]*len(a[i*2::i])
p=list(compress(n,a))
for x in map(int,sys.stdin):
if x:print(len(1 for d in p[:bisect.bisect(p,x//2)]if a[x-d]))
|
s832880195 | p00056 | u352394527 | 1527522753 | Python | Python3 | py | Runtime Error | 0 | 0 | 451 | MAX = 50001
is_prime = [True for _ in range(MAX)]
is_prime[0] = is_prime[1] = False
for i in range(2, int(MAX ** (1 / 2)) + 1):
if is_prime[i]:
for j in range(i ** 2, MAX, i):
is_prime[j] = False
primes = [i for i in range(MAX) if is_prime[i]]
def main():
while True:
n = int(input())
if not n:
break
ans = 0
for i in primes_less_than_n:
if is_prime[n - i]:
ans += 1
print(ans)
main()
|
s131703709 | p00056 | u647766105 | 1356265796 | Python | Python | py | Runtime Error | 0 | 0 | 269 | n=5*10**4
p=[True]*n
p[0],p[1]=False,False
for i in xrange(2,int(n**0.5)+1):
if p[i]==True:
for j in xrange(i**2,n,i):
p[j]=False
while True:
n=input()
if n==0:break
for i in xrange(n/2+1):
if p[i] and p[n-i]:c+=1
print c |
s137158815 | p00056 | u647766105 | 1356266818 | Python | Python | py | Runtime Error | 0 | 0 | 302 | N=5000+1
p=[True]*N
p[0],p[1]=False,False
for i in xrange(2,int(N**0.5)+1):
if p[i]==True:
for j in xrange(i**2,N,i):
p[j]=False
c=[0]*N
for i in xrange(N):
for j in xrange(i/2+1):
if p[j] and p[i-j]:c[i]+=1
while True:
n=input()
if n==0:break
print c[n] |
s041065121 | p00056 | u912237403 | 1389126879 | Python | Python | py | Runtime Error | 0 | 0 | 531 | import sys
def sieve(m):
N=range(1,m+2,2)
r=int(m**.5)
h=len(N)
N[0]=0
for i in range(h):
x=N[i]
if x>r: break
if x and i+x<h: N[i+x:h:x]=[0] * ((h-1-i-x)/x+1)
return N
def f0056(n):
x=0
if n%2==1:
if SIEVES[(n-2)/2]!=0: x=1
else:
for e in PRIMES:
if e>n/2: break
if SIEVES[(n-e)/2]!=0]:x+=1
return x
SIEVES=sieve(50000)
PRIMES=filter(None,SIEVES)
for n in sys.stdin:
n=int(n)
if n==0: break
print f0056(n) |
s425896229 | p00056 | u912237403 | 1389418120 | Python | Python | py | Runtime Error | 0 | 0 | 559 | def sieve(m):
N=range(1,m+2,2)
r=int(m**.5)
h=len(N)
N[0]=0
for i in range(h):
x=N[i]
if x>r: break
if x and i+x<h: N[i+x:h:x]=[0]*((h-1-i-x)/x+1)
return N
def f0056(n):
x=0
if n<4:x=0
elif n==4:x=1
elif n%2==1:
if S[(n-2)/2]:
x=1
else:
a=n/2
for e in PRIMES:
if e>a: break
if S[(n-e)/2]:
x+=1
return x
S=sieve(50000)
PRIMES=filter(None,S)
for n in sys.stdin:
n=int(n)
if n==0: break
print f0056(n) |
s550157257 | p00056 | u633068244 | 1394280129 | Python | Python | py | Runtime Error | 0 | 0 | 371 | r = 50001
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
while True:
n = int(raw_input())
if n == 0:
break
count = 0
for i in range(n/2):
if p[i] == 1:
m = n - (i+1)
if p[m-1] == 1:
count += 1
print count |
s323460879 | p00056 | u436634575 | 1402307973 | Python | Python3 | py | Runtime Error | 0 | 0 | 607 | def enum_prime(m):
L = [True for _ in range(m + 1)]
L[0] = L[1] = False
for i in range(2, m + 1):
if L[i]:
for j in range(i + i, m + 1, i):
L[j] = False
if m < i * i:
break
return L
FLAGS = enum_prime(50000)
PRIMES = [i for i, isprime in enumerate(FLAGS) if isprime]
while True:
n = int(input())
n2 = n // 2
cnt = 0
if n % 2 == 0:
for p in PRIMES:
if p > n2:
break
if FLAGS[n - p]:
cnt += 1
elif FLAGS[n - 2]:
cnt = 1
print(cnt) |
s581400737 | p00057 | u586434734 | 1421759237 | Python | Python | py | Runtime Error | 0 | 0 | 351 | #! /usr/bin/python
# -*- coding: utf-8 -*-
def main():
# input
while(True):
try:
data = int(raw_input())
print(countArea(data))
except EOFError:
break
def countArea(n):
if n == 1:
return 2
else:
return countArea(n-1) + n
if __name__=='__main__':
main() |
s226916301 | p00057 | u778333573 | 1440602736 | Python | Python | py | Runtime Error | 0 | 0 | 153 | import sys
z=10001
a=[0]*z
a[2] = 1
for i in xrange(3,z):a[i]=(i-1)+l[i-1]
for j in xrange(1,z):a[j]+=j+1
for s in sys.stdin:
d=int(s)
print a[d] |
s917337515 | p00057 | u811733736 | 1503466318 | Python | Python3 | py | Runtime Error | 0 | 0 | 972 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0057
"""
import sys
Area_memo = [0 for _ in range(10002)] # n??¬???????????????????????????????????° (0???????¨????)
Area_memo[0] = 1
def count_area(num):
"""
????????°??¨???????????°?????¢????????\????????????????????£????????????
0 -> 1
1 -> 2
2 -> 4
3 -> 7
4 -> 11
?????£??????i??¬???????????????????????????????????°??????(i-1)??¬????????????????????° + ????????° ??¨?????????
n?????°????????§??§10,000????????§????????¢???????????????????????????
:param num:????????°
:return: ???????????°
"""
global Area_memo
if Area_memo[num] == 0:
Area_memo[num] = num + count_area(num-1)
return Area_memo[num]
def main(args):
for line in sys.stdin:
num = int(line.strip())
result = count_area(num)
print(result)
if __name__ == '__main__':
main(sys.argv[1:]) |
s824665163 | p00057 | u136916346 | 1527835366 | Python | Python3 | py | Runtime Error | 0 | 0 | 93 | import sys
lc=lambda n:int((n**2+n+2)/2)
[print(i) for i in [lc(int(j)) for j in sts.stdin]]
|
s924347698 | p00057 | u350508326 | 1372459065 | Python | Python | py | Runtime Error | 0 | 0 | 318 | while True:
try:
n = int(raw_input())
print (a**2+a+2)/2
except EOFError: break
~ |
s026492076 | p00057 | u350508326 | 1372459095 | Python | Python | py | Runtime Error | 0 | 0 | 282 | while True:
try:
n = int(raw_input())
print (a**2+a+2)/2
except EOFError: break |
s374976304 | p00058 | u193025715 | 1408898694 | Python | Python3 | py | Runtime Error | 0 | 0 | 561 | def slant(xa, ya, xb, yb):
if ya - yb == 0:
return 'y'
elif xa - xb == 0:
return 'x'
else:
return (ya - yb) / (xa - xb)
while True:
try:
xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
except:
break
AB = slant(xa, ya, xb, yb)
CD = slant(xc, yc, xd, yd)
is_digit = ('x' and 'y') not in [AB, CD]
if [AB, CD] == (['x', 'y'] or ['y', 'x']):
print('YES')
continue
if is_digit:
print('YES' if AB * CD == -1 else 'NO')
else:
print('NO') |
s755721654 | p00058 | u633068244 | 1393680726 | Python | Python | py | Runtime Error | 0 | 0 | 261 | while True:
try:
xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
if (10000*(yB-yA))*(100000*(yD-yC)) +(100000*(xB-xA)*(100000*(xD-xC)) < 1.e-12:
print "YES"
else:
print "NO"
except:
break |
s205765955 | p00058 | u633068244 | 1393682261 | Python | Python | py | Runtime Error | 0 | 0 | 275 | while True:
try:
xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) == 0.0:
print "YES"
else:
print "NO"
else:
print "NO"
except:
break |
s527931054 | p00059 | u567380442 | 1423309131 | Python | Python3 | py | Runtime Error | 0 | 0 | 527 | import sys
f = sys.stdin
def take2(iterable):
i = iter(iterable)
while True:
yield next(i), next(i)
for line in f:
a1,a2,b1,b2 = [x + y * 1j for x, y in take2(map(float, line.split()))]
if (min(a1.real, a2.real) <= b1.real <= max(a1.real, a2.real) or (min(a1.real, a2.real) <= b2.real <= max(a1.real, a2.real))) and
(min(a1.imag, a2.imag) <= b1.imag <= max(a1.imag, a2.imag) or (min(a1.imag, a2.imag) <= b2.imag <= max(a1.imag, a2.imag))):
print('YES')
else:
print('NO') |
s914624613 | p00059 | u075836834 | 1459273632 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | def solve(xa,ya1,xa1,ya2,xb1,yb1,xb2,yb2):
if xb2<xa1 or xb1>xa2 or yb2<ya1 or yb1>yb2:
print("NO")
else:
print("YES")
while True:
try:
xa,ya1,xa1,ya2,xb1,yb1,xb2,yb2=map(float,input().split())
solve(xa,ya1,xa1,ya2,xb1,yb1,xb2,yb2)
except EOFError:
break |
s445578515 | p00059 | u542421762 | 1370755126 | Python | Python | py | Runtime Error | 0 | 0 | 251 | import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if (xa1 <= xb1 <= xa2 or xb1 <= xa1 <= xb2) and (yb1 <= ya2 <= yb2 or ya1 <= yb2 <= ya2):
print 'YES'
else:
print 'NO' |
s750437106 | p00059 | u542421762 | 1370755588 | Python | Python | py | Runtime Error | 0 | 0 | 252 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if (xa1 <= xb1 <= xa2 or xb1 <= xa1 <= xb2) and (yb1 <= ya2 <= yb2 or ya1 <= yb2 <= ya2):
print 'YES'
else:
print 'NO' |
s098133063 | p00059 | u542421762 | 1370755636 | Python | Python | py | Runtime Error | 0 | 0 | 258 | import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = tuple(map(float, line.split(' ')))
if (xa1 <= xb1 <= xa2 or xb1 <= xa1 <= xb2) and (yb1 <= ya2 <= yb2 or ya1 <= yb2 <= ya2):
print 'YES'
else:
print 'NO' |
s391497691 | p00059 | u542421762 | 1370755735 | Python | Python | py | Runtime Error | 0 | 0 | 284 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if (xa1 <= xb1 and xb1 <= xa2 or xb1 <= xa1 and xa1 <= xb2) and (yb1 <= ya2 and ya2 <= yb2 or ya1 <= yb2 and yb2 <= ya2):
print 'YES'
else:
print 'NO' |
s898626232 | p00059 | u542421762 | 1370755824 | Python | Python | py | Runtime Error | 0 | 0 | 292 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if ((xa1 <= xb1 and xb1 <= xa2) or (xb1 <= xa1 and xa1 <= xb2)) and ((yb1 <= ya2 and ya2 <= yb2) or (ya1 <= yb2 and yb2 <= ya2)):
print 'YES'
else:
print 'NO' |
s392230455 | p00059 | u542421762 | 1370756066 | Python | Python | py | Runtime Error | 0 | 0 | 276 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if ((xa1<=xb1 and xb1<=xa2) or (xb1<=xa1 and xa1<=xb2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s788061723 | p00059 | u542421762 | 1370760890 | Python | Python | py | Runtime Error | 0 | 0 | 276 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if ((xa1<=xb1 and xb1<=xa2) or (xb1<=xa1 and xa1<=xb2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s868706090 | p00059 | u542421762 | 1370769014 | Python | Python | py | Runtime Error | 0 | 0 | 276 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s972623459 | p00059 | u542421762 | 1370769283 | Python | Python | py | Runtime Error | 0 | 0 | 289 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.rstrip('\n').split(' '))
if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s745433942 | p00059 | u542421762 | 1370770363 | Python | Python | py | Runtime Error | 0 | 0 | 300 |
import sys
for line in sys.stdin.readline():
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.rstrip('\n').split(' '))
if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s016299943 | p00059 | u542421762 | 1370773821 | Python | Python | py | Runtime Error | 0 | 0 | 299 | import sys
for line in sys.stdin.readline():
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.rstrip('\n').split(' '))
if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s335405248 | p00059 | u542421762 | 1370774188 | Python | Python | py | Runtime Error | 0 | 0 | 276 |
import sys
for line in sys.stdin:
xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2 = map(float, line.split(' '))
if ((xb1<=xa1 and xa1<=xb2) or (xa1<=xb1 and xb1<=xa2)) and ((yb1<=ya2 and ya2<=yb2) or (ya1<=yb2 and yb2<=ya2)):
print 'YES'
else:
print 'NO' |
s738643943 | p00059 | u633068244 | 1394804715 | Python | Python | py | Runtime Error | 0 | 0 | 676 | def Check(xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2)
# the case A's upper left point in B
if xb1 <= xa1 <= xb2 and yb1 <= ya2 <= yb2:
return True
# the case A's upper rihgt point in B
if xb1 <= xa2 <= xb2 and yb1 <= ya2 <= yb2:
return True
# the case A's lowerr left point in B
if xb1 <= xa1 <= xb2 and yb1 <= ya1 <= yb2:
return True
# the case A's lowerr right point in B
if xb1 <= xa2 <= xb2 and yb1 <= ya1 <= yb2:
return True
while True:
try:
xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2 = map(float, raw_input().split())
print "YES" if Check(xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2) else "NO"
except:
break |
s362757456 | p00060 | u553148578 | 1531461058 | Python | Python3 | py | Runtime Error | 0 | 0 | 213 | while True:
c1, c2, c3 = list(map(int,input().split()))
deck = [i for i in range(1,11) if i != c1 and i != c2 and i != c3]
if 20 - c1 - c2 > max(deck) or 20 - c1 - c2 == c3:
print("YES")
else:
print("NO")
|
s545680184 | p00060 | u744114948 | 1426251232 | Python | Python3 | py | Runtime Error | 0 | 0 | 343 | while True:
try:
a, b, c = map(int, input().split())
except:
break
l=[True] * 11
l[a] = l[b] = l[c] = False
sum = a + b
over = 0
fpr i in range(1,11):
if l[i]:
if sum + i >= 20:
over += 1
if over / 7 < 0.5:
print("YES")
else:
print("NO") |
s940432662 | p00060 | u078042885 | 1485002439 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | while 1:
a=[i+1 for i in range(10)]
try:b=list(map(int,input().split()))
except:break
for i in b:a.remove(b)
print('YES' if sum([1 for i in a if i<=20-sum(b[:2])])/7>=0.5 else 'NO') |
s589807530 | p00060 | u032662562 | 1488288928 | Python | Python3 | py | Runtime Error | 0 | 0 | 378 | def drawone(f):
v = list(range(1,11))
for i in f:
v.remove(i)
win = 0
lose= 0
for i in v:
if i + sum(f[:2]) <= 20:
win += 1
else:
lose += 1
return(True if win>=lose else False)
while True:
f = list(map(int,input().strip().split()))
if drawone(f):
print('YES')
else:
print('NO') |
s087108636 | p00060 | u150984829 | 1519380901 | Python | Python3 | py | Runtime Error | 0 | 0 | 129 | import sys
for x in sys.stdin:
a,b,c=list(map(int,x.split()))
print(['YES','NO'][len(set(range(1,21-sum(a,b)))-{a,b,c})/7<.5])
|
s766232175 | p00060 | u865312527 | 1378312591 | Python | Python | py | Runtime Error | 0 | 0 | 234 | import sys
def solve(xa1,ya1,xa2,ya2,xb1,yb1,xb2,yb2):
if xa1<=yb1 and yb1<=ya2 and xb1<=xa2 and ya1<=yb2:
return 'YES'
return 'NO'
for line in sys.stdin.readlines():
f=map(float, line.split())
print solve(*f) |
s562766312 | p00061 | u130979865 | 1461573807 | Python | Python | py | Runtime Error | 0 | 0 | 686 | # -*- coding: utf-8 -*-
import sys
class Team_class():
def __init__(self, id, score):
self.id = id
self.score = score
self.rank = 0
team = []
for line in sys.stdin:
id, s = map(int, line.split(','))
if id + s == 0:
break
team.append(Team_class(id, s))
for i in range(len(team)):
for j in range(i, len(team)):
if team[i].score < team[j].score:
team[i], team[j] = team[j], team[i]
tmpscore = team[0].score
tmprank = 1
for i in range(len(team)):
if tmpscore != team[i].score:
tmpscore = team[i].score
tmprank += 1
team[i].rank = tmprank
for line in sys.stdin:
print team[int(line)].rank |
s534427858 | p00061 | u130979865 | 1461641884 | Python | Python | py | Runtime Error | 0 | 0 | 682 | # -*- coding: utf-8 -*-
import sys
class Team_class():
def __init__(self, id, score):
self.id = id
self.score = score
self.rank = 0
team = []
while True:
id, s = map(int, raw_input().split(','))
if id + s == 0:
break
team.append(Team_class(id, s))
for i in range(len(team)):
for j in range(i, len(team)):
if team[i].score < team[j].score:
team[i], team[j] = team[j], team[i]
tmpscore = team[0].score
tmprank = 1
for i in range(len(team)):
if tmpscore != team[i].score:
tmpscore = team[i].score
tmprank += 1
team[i].rank = tmprank
for line in sys.stdin:
print team[int(line)].rank |
s311785964 | p00061 | u150984829 | 1519383396 | Python | Python3 | py | Runtime Error | 0 | 0 | 151 | import sys
c,d=[],{}
for x in iter(input,'0,0'):p,s=map(int,x.split(','));c+=[s];d[p]=s
for y in sys.stdin:print({*c}.sort()[::-1].index(d[int(y)])+1)
|
s960123810 | p00061 | u150984829 | 1519383426 | Python | Python3 | py | Runtime Error | 0 | 0 | 151 | import sys
c,d=[],{}
for x in iter(input,'0,0'):p,s=map(int,x.split(','));c+=[s];d[p]=s
for y in sys.stdin:print({*c}.sort()[::-1].index(d[int(y)])+1)
|
s256495273 | p00061 | u471115210 | 1374547028 | Python | Python | py | Runtime Error | 0 | 0 | 375 |
team = [0 for i in range(101)]
point= [[0 for i in range(2)] for i in range(31)]
while 1:
temp= map(int, raw_input().split(','))
if temp[0] ==0==temp[1]:
break
team[temp[0]]=temp[1]
if point[temp[1]][1]==0:
point[temp[1]][1]=1
for i in range(temp[1]+1):
point[i][0]+=1
while 1:
n = input()
print point[team[n]][0] |
s549105475 | p00061 | u471115210 | 1374649882 | Python | Python | py | Runtime Error | 0 | 0 | 418 | team = [0 for i in range(101)]
point= [[0 for i in range(2)] for i in range(31)]
while 1:
temp= map(int, raw_input().split(','))
if temp[0] ==0==temp[1]:
break
team[temp[0]]=temp[1]
if point[temp[1]][1]==0:
point[temp[1]][1]=1
for i in range(temp[1]+1):
point[i][0]+=1
while 1:
try:
n = input()
print point[team[n]][0]
except EOFerror:
break |
s045301446 | p00062 | u873482706 | 1434890020 | Python | Python | py | Runtime Error | 0 | 0 | 344 | import sys
def suicide(lis):
if len(lis) == 1:
print lis[0]
pokakito = []
for i in range(len(lis)-1):
check = lis[i] + lis[i+1]
one = int(str(check)[-1])
pokakito.append(one)
else:
suicide(pokakito)
for line in sys.stdin:
lis = [int(char) for char in line.rstrip()]
suicide(lis) |
s195349149 | p00062 | u873482706 | 1434890138 | Python | Python | py | Runtime Error | 0 | 0 | 371 | def suicide(lis):
if len(lis) == 1:
print lis[0]
pokakito = []
for i in range(len(lis)-1):
check = lis[i] + lis[i+1]
one = int(str(check)[-1])
pokakito.append(one)
else:
suicide(pokakito)
while True:
try:
lis = [int(char) for char in raw_input()]
suicide(lis)
except EOFError:
break |
s543675660 | p00062 | u862440080 | 1473938232 | Python | Python3 | py | Runtime Error | 0 | 0 | 274 | while True:
try:
a = map(int, input())
except:
break
while True:
b = []
for i in range(len(a)/2):
b.append(int(str(a[i*2] + a[i*2+1])[-1]))
if len(b) == 1:
print b
break
a = b |
s180178169 | p00062 | u862440080 | 1473938281 | Python | Python3 | py | Runtime Error | 0 | 0 | 274 | while True:
try:
a = map(int, input())
except:
break
while True:
b = []
for i in range(len(a)/2):
b.append(int(str(a[i*2] + a[i*2+1])[-1]))
if len(b) == 1:
print(b)
break
a = b |
s490379294 | p00062 | u862440080 | 1473938391 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | while True:
try:
a = map(int, input())
except:
break
while True:
b = []
for i in range(int(len(a)/2)):
b.append(int(str(a[i*2] + a[i*2+1])[-1]))
if len(b) == 1:
print(b[0])
break
a = b |
s989880626 | p00062 | u862440080 | 1473939559 | Python | Python3 | py | Runtime Error | 0 | 0 | 285 | while True:
try:
a = tuple(int, input())
except EOFError:
break
while True:
b = []
for i in range(len(a)-1):
b.append(int(str(a[i] + a[i+1])[-1]))
if len(b) == 1:
print(b[-1])
break
a = b |
s851042189 | p00062 | u195001007 | 1474599061 | Python | Python3 | py | Runtime Error | 0 | 0 | 479 | while($line = fgets(STDIN)) {
$data = array();
for ($i = 0; $i < strlen($line); $i++) {
$data[$i] = substr($line, $i, 1);
}
while (count($data) > 1) {
$nextLine = '';
for ($i = 0; $i < count($data) - 1; $i++) {
$nextLine .= substr(($data[$i] + $data[$i+1]), -1);
}
$nextLine = trim($nextLine);
$data = array();
for ($i = 0; $i < strlen($nextLine); $i++) {
$data[$i] = substr($nextLine, $i, 1);
}
}
echo $data[0] . '<br>';
} |
s782400520 | p00062 | u032662562 | 1488467161 | Python | Python3 | py | Runtime Error | 0 | 0 | 361 | import Control.Applicative
import Data.Char
main = do
v <- map (map (\x->ord(x) - ord('0'))) . lines <$> getContents
mapM_ (putStrLn . show . solve) v
solve::[Int] -> Int
solve v = head $ aux v
where
aux ::[Int] -> [Int]
aux f = if length f == 1 then
f
else
aux (zipWith (\x y->(x+y) `mod` 10) f (tail f)) |
s740593369 | p00062 | u546285759 | 1505899320 | Python | Python3 | py | Runtime Error | 0 | 0 | 238 | while True:
s = input()
while len(s) != 1:
_new = []
for i in range(len(s)-1):
t = str(int(s[i]) + int(s[i+1]))
_new.append(t if len(t) == 1 else t[1])
s = "".join(_new)
print(s) |
s836237923 | p00062 | u865312527 | 1378316877 | Python | Python | py | Runtime Error | 0 | 0 | 183 | import sys
for rec in sys.stdin.readlines():
while len(d)>1:
tmp=[]
for i in range(1,len(d)):
tmp.append((d[i-1]+d[i])%10)
d=tmp
print d[0] |
s950646419 | p00062 | u912237403 | 1389888083 | Python | Python | py | Runtime Error | 0 | 0 | 183 | import sys
for s in sys.stdin:
x=map(int,list(str(s))[:-1])
while True:
a=len(x)
x=[(x[i]+x[i+1])%10 for i in range(a-1)]
if a==1: break
print x[0] |
s209578507 | p00062 | u491763171 | 1400470493 | Python | Python | py | Runtime Error | 0 | 0 | 247 | while 1:
numbers = map(int, raw_input())
dp = [[0] * 10 for _ in xrange(10)]
dp[0] = numbers
for i in xrange(9):
for j in xrange(len(dp[i]) - 1):
dp[i + 1][j] = (dp[i][j] + dp[i][j + 1]) % 10
print dp[-1][0] |
s550996122 | p00062 | u491763171 | 1400470520 | Python | Python | py | Runtime Error | 0 | 0 | 247 | while 1:
numbers = map(int, raw_input())
dp = [[0] * 10 for _ in xrange(10)]
dp[0] = numbers
for i in xrange(9):
for j in xrange(len(dp[i]) - 1):
dp[i + 1][j] = (dp[i][j] + dp[i][j + 1]) % 10
print dp[-1][0] |
s831330812 | p00063 | u145563629 | 1428849311 | Python | Python | py | Runtime Error | 0 | 0 | 78 | c = 0
try:
while 1:
s = raw_input()
if s[::-1] == s:
c += 1
print c
|
s313615162 | p00063 | u765849500 | 1468065193 | Python | Python | py | Runtime Error | 0 | 0 | 100 | count = 0
while 1:
a = raw_input()
b = a[::-1]
if a == b: count+=1
print count
|
s498627347 | p00064 | u461370825 | 1449760854 | Python | Python | py | Runtime Error | 0 | 0 | 391 | from math import *
PI = 3.1415926535898
ans = 0
while True:
try:
s = raw_input()
t = ""
for x in s:
if x.isdigit():
t += x
elif len(t) > 0 and t[len(t)-1].isdigit():
t += " "
arr = map(int, t.strip().split(' '))
for x in arr:
ans += x
except EOFError:
break
print ans |
s868684998 | p00064 | u546285759 | 1483510021 | Python | Python3 | py | Runtime Error | 0 | 0 | 258 | import sys
memo = [line.strip() for line in sys.stdin]
at = ""
for i in len(memo):
for j in len(memo[i]):
if not memo[i][j].isdigit():
at += "@"
else:
at += str(memo[i][j])
print(sum(at.replace("@", " ").split())) |
s275221911 | p00064 | u546285759 | 1483675261 | Python | Python3 | py | Runtime Error | 0 | 0 | 180 | memo = ""
while True:
try:
for s in input():
memo = memo+s if s.isdigit() else memo+"@"
except:
break
print(sum(memo.replace("@", " ").split())) |
s542333089 | p00064 | u546285759 | 1483675648 | Python | Python3 | py | Runtime Error | 0 | 0 | 203 | import sys
memo, ans = [], ""
for line in sys.stdin: memo.append(line.strip())
for me in memo:
for m in me:
ans = ans+m if m.isdigit() else ans+"@"
print(sum(ans.replace("@", " ").split())) |
s386947484 | p00064 | u546285759 | 1483675917 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | ans = ""
while True:
try:
memo = input()
except:
break
for m in memo:
ans = ans+m if m.isdigit() else ans+"@"
print(sum(ans.replace("@", " ").split())) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.