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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s531989690 | p00079 | u150984829 | 1520126638 | Python | Python3 | py | Runtime Error | 0 | 0 | 174 | import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
x,y=p[0]
print(abs(sum((p[i][0]-x)*(p[i+1][1]-y)-(p[i][1]-y)*(p[i+1][0]-x))for i in range(1,len(p)-1)))/2)
|
s312392038 | p00079 | u150984829 | 1520127592 | Python | Python3 | py | Runtime Error | 0 | 0 | 153 | import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
n=len(p)
for i in range(n):a,b=p[i];c,d=p[-~i%n];s+=a*d-b*c
print(s/2)
/////////////
|
s200913849 | p00079 | u150984829 | 1520127602 | Python | Python3 | py | Runtime Error | 0 | 0 | 155 | import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
n=len(p)
for i in range(n):a,b=p[i];c,d=p[-~i%n];s+=a*d-b*c
print(s/2)
// abs abs
|
s697308921 | p00079 | u193025715 | 1395734137 | Python | Python | py | Runtime Error | 0 | 0 | 596 | import math
def triangleArea(x1,y1,x2,y2,x3,y3):
a = math.sqrt(((x1 - x2)**2 + (y1 - y2)**2))
b = math.sqrt(((x2 - x3)**2 + (y2 - y3)**2))
c = math.sqrt(((x3 - x1)**2 + (y3 - y1)**2))
z = (a + b + c) / 2
S = math.sqrt(z * (z - a) * (z - b) * (z - c))
return S
apex = []
while True:
try:
apex.append(map(float, raw_input().split(',')))
except:
S = 0.0
while len(apex) >= 3:
for i in range(1,len(apex),2):
S += triangleArea(apex[i-1][0],apex[i-1][1],apex[i][0],apex[i][1],apex[i+1][0],apex[i+1][1])
for j in range(1,len(apex),2):
apex.pop(j)
print '%.6f' % S
break |
s941995527 | p00079 | u193025715 | 1395734205 | Python | Python | py | Runtime Error | 0 | 0 | 596 | import math
def triangleArea(x1,y1,x2,y2,x3,y3):
a = math.sqrt(((x1 - x2)**2 + (y1 - y2)**2))
b = math.sqrt(((x2 - x3)**2 + (y2 - y3)**2))
c = math.sqrt(((x3 - x1)**2 + (y3 - y1)**2))
z = (a + b + c) / 2
S = math.sqrt(z * (z - a) * (z - b) * (z - c))
return S
apex = []
while True:
try:
apex.append(map(float, raw_input().split(',')))
except:
S = 0.0
while len(apex) >= 3:
for i in range(1,len(apex),2):
S += triangleArea(apex[i-1][0],apex[i-1][1],apex[i][0],apex[i][1],apex[i+1][0],apex[i+1][1])
for j in range(1,len(apex),2):
apex.pop(j)
print '%.6f' % S
break |
s391837035 | p00080 | u894114233 | 1476621477 | Python | Python3 | py | Runtime Error | 0 | 0 | 187 | def third_root(q):
x=q/2.0
while abs(x**3-q)>=q*10**(-5):
x=x-(x**3-q)/(3*x**2)
return x
while 1:
q=input()
if q==-1:break
ans=third_root(q)
print(ans) |
s168629982 | p00080 | u894114233 | 1476621599 | Python | Python3 | py | Runtime Error | 0 | 0 | 185 | def third_root(q):
x=q/2
while abs(x**3-q)>=q*10**(-5):
x=x-(x**3-q)/(3*x**2)
return x
while 1:
q=input()
if q==-1:break
ans=third_root(q)
print(ans) |
s144055927 | p00080 | u150984829 | 1520128419 | Python | Python3 | py | Runtime Error | 0 | 0 | 1379 | import sys
for e in sys.stdin:print(float(e)**(1/3))
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
########################################################################################################
####################################################
####################################################
########################################################################################################v
############################################################################################################################################################
####################################################
####################################################
####################################################
########################################################################################################v
vv####################################################
|
s413789477 | p00080 | u150984829 | 1520128468 | Python | Python3 | py | Runtime Error | 0 | 0 | 1385 | while 1:
print(float(input())**(1/3))
if q<0:break
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
########################################################################################################
####################################################
####################################################
########################################################################################################v
############################################################################################################################################################
####################################################
####################################################
####################################################
########################################################################################################v
vv####################################################
|
s173776244 | p00080 | u150984829 | 1520128491 | Python | Python3 | py | Runtime Error | 0 | 0 | 1393 | while 1:
q=float(input())
if q<0:break
print(q**(1/3))
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
########################################################################################################
####################################################
####################################################
########################################################################################################v
############################################################################################################################################################
####################################################
####################################################
####################################################
########################################################################################################v
vv####################################################
|
s450641253 | p00080 | u150984829 | 1520128512 | Python | Python3 | py | Runtime Error | 0 | 0 | 1392 | while 1:
q=float(input())
if q<0:break
print(q**(1/3))
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
########################################################################################################
####################################################
####################################################
########################################################################################################
############################################################################################################################################################
####################################################
####################################################
####################################################
########################################################################################################v
vv####################################################
|
s003392651 | p00081 | u150984829 | 1525258648 | Python | Python3 | py | Runtime Error | 0 | 0 | 190 | import sys
from math import complex as C
for e in sys.stdin:
a,b,c,d,e,f=map(float,e.split(','))
z,w,q=C(a,b),C(c,d),C(e,f)
w-=z
z+=(w/abs(w))**2*(q-z).conjugate()
print(z.real,z.imag)
|
s320726807 | p00081 | u647766105 | 1357204265 | Python | Python | py | Runtime Error | 0 | 0 | 515 | import sys,math
for line in sys.stdin.readlines():
line=raw_input()
x1,y1,x2,y2,xq,yq=map(float,line.strip().split(","))
L=((x1-x2)**2+(y1-y2)**2)**0.5
t=math.atan2(y2-y1,x2-x1)
R1=((x1-xq)**2+(y1-yq)**2)**0.5
R2=((x2-xq)**2+(y2-yq)**2)**0.5
a=math.acos((L*L+R1*R1-R2*R2)/(2*L*R1))
x,y=x1+R1*math.cos(t+a),y1+R1*math.sin(t+a)
if not (xq-0.00001<=x<=xq+0.00001 and yq-0.00001<=y<=yq+0.00001):
print x,y
else:
print x1+R1*math.cos(t-a),y1+R1*math.sin(t-a)
#temp |
s274250418 | p00081 | u647766105 | 1357369769 | Python | Python | py | Runtime Error | 0 | 0 | 338 | import sys
for line in sys.stdin.readlines():
x1,y1,x2,y2,xq,yq=map(float,line.strip().split(","))
if x1==x2:
x,y=-xq+2*x1,yq
elif y1==y2:
x,y=xq,-yq+2*y1
else:
m=(y1-y2)/(x1-x2)
n=-m*x1+y1
x,y= (2*yq*m-2*m*n+xq-m*m*xq)/(m*m+1),(xq-x)/m+yq;
print "{:.6f} {:.6f}".format(x+0,y+0) |
s514781156 | p00082 | u540744789 | 1427869647 | Python | Python | py | Runtime Error | 0 | 0 | 880 | v=[4,1,4,1,2,1,2,1]
while True:
x=raw_input()
x=x[0:len(x)-1]
p=map(int,x.split(" "))
min=[]
min_value=0
for i in range(8):
count=0
for j in range(8):
if p[(j)%8]-v[(j+i)%8]>=0:
count+=p[(j)%8]-v[(j+i)%8]
if len(min)==0:
min_value=count
min.append(i)
else:
if count<min_value:
min_value=count
min=[]
min.append(i)
elif count==min_value:
min.append(i)
min1_value=41412122
for i in range(len(min)):
value=""
for j in range(8):
value+=str(v[(j+min[i])%8])
if min1_value>int(value):
min1_value=int(value)
min1=min[i]
solve=[]
for i in range(8):
solve.append(str(v[(i+min1)%8]))
print " ".join(solve) |
s463575454 | p00082 | u540744789 | 1427869709 | Python | Python | py | Runtime Error | 0 | 0 | 852 | v=[4,1,4,1,2,1,2,1]
while True:
p=map(int,raw_input().split(" "))
min=[]
min_value=0
for i in range(8):
count=0
for j in range(8):
if p[(j)%8]-v[(j+i)%8]>=0:
count+=p[(j)%8]-v[(j+i)%8]
if len(min)==0:
min_value=count
min.append(i)
else:
if count<min_value:
min_value=count
min=[]
min.append(i)
elif count==min_value:
min.append(i)
min1_value=41412122
for i in range(len(min)):
value=""
for j in range(8):
value+=str(v[(j+min[i])%8])
if min1_value>int(value):
min1_value=int(value)
min1=min[i]
solve=[]
for i in range(8):
solve.append(str(v[(i+min1)%8]))
print " ".join(solve) |
s944811785 | p00082 | u957021183 | 1505196018 | Python | Python3 | py | Runtime Error | 0 | 0 | 665 | # Aizu Problem 0082: Flying Jenny
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def flying_jenny(p):
a = [1, 2, 1, 2, 1, 4, 1, 4]
min_dist = 100000
ans = []
for j in range(8):
dist = sum([max(0, p[k] - a[(k+j)%8]) for k in range(8)])
if dist < min_dist:
ans = [a[j:] + a[:j]]
min_dist = dist
elif dist == min_dist:
ans.append([a[j:] + a[:j]])
ans = sorted(ans)[0]
print(' '.join([str(a) for a in ans]))
for line in sys.stdin:
p = [int(_) for _ in line.split()]
flying_jenny(p) |
s200470188 | p00082 | u104911888 | 1367111833 | Python | Python | py | Runtime Error | 0 | 0 | 571 | merry=[4,1,4,1,2,1,2,1]
while True:
try:
guest=map(int,raw_input().split())
except EOFError:
break
m=10000
for i in range(len(merry)):
temp=merry[i:]+merry[:i]
s=sum([guest[i]-temp[i] for i in range(len(merry)) if guest[i]-temp[i]>\
=0])
m=min(m,s)
P=set([])
for i in range(len(merry)):
temp=merry[i:]+merry[:i]
s=sum([guest[i]-temp[i] for i in range(len(merry)) if guest[i]-temp[i]>\
=0])
if s==m:
P.add(int("".join(map(str,temp))))
print " ".join(list(str(min(P)))) |
s206197802 | p00082 | u104911888 | 1367114617 | Python | Python | py | Runtime Error | 0 | 0 | 478 | merry=[4,1,4,1,2,1,2,1]
while True:
try:
gst=map(int,raw_input().split())
except EOFError:
break
m=10000
ans=set()
for i in range(len(merry)):
temp=merry[i:]+merry[:i]
s=sum([gst[i]-temp[i] for i in range(len(merry)) if gst[i]>temp[i]])
if s<m:
m=s
ans.clear()
ans.add("".join(map(str,temp)))
if s==m:
ans.add("".join(map(str,temp)))
print " ".join(min(ans)) |
s410098769 | p00082 | u104911888 | 1367115037 | Python | Python | py | Runtime Error | 0 | 0 | 469 | merry=[4,1,4,1,2,1,2,1]
while True:
try:
gst=map(int,raw_input().split())
except EOFError:
break
m=10000
ans=set()
for i in range(len(merry)):
temp=merry[i:]+merry[:i]
s=sum([max(gst[i]-temp[i],0) for i in range(len(merry))])
if s==m:
ans.add("".join(map(str,temp)))
elif s<m:
m=s
ans.clear()
ans.add("".join(map(str,temp)))
print " ".join(min(ans)) |
s812981888 | p00082 | u633068244 | 1396076712 | Python | Python | py | Runtime Error | 0 | 0 | 511 | cart = [4,1,4,1,2,1,2,1]
while True:
try:
que = map(int, raw_input().split())
mx,mxcart = 0, "99999999"
for sp in range(8):
sm = 0
for num in range(8):
if cart[(sp+num)%8] <= que[num]:
sm += cart[(sp+num)%8]
else:
sm += que[num]
if sm = mx:
mx = sm
mxcart = "".join(map(str, cart[sp:]+cart[:sp]))
elif sm = mx:
acart = "".join(map(str, cart[sp:]+cart[:sp]))
if int(mxcart) > int(acart):
mxcart = acart
print " ".join(map(str, mxcart))
except:
break |
s109071385 | p00082 | u633068244 | 1396076745 | Python | Python | py | Runtime Error | 0 | 0 | 512 | cart = [4,1,4,1,2,1,2,1]
while True:
try:
que = map(int, raw_input().split())
mx,mxcart = 0, "99999999"
for sp in range(8):
sm = 0
for num in range(8):
if cart[(sp+num)%8] <= que[num]:
sm += cart[(sp+num)%8]
else:
sm += que[num]
if sm = mx:
mx = sm
mxcart = "".join(map(str, cart[sp:]+cart[:sp]))
elif sm == mx:
acart = "".join(map(str, cart[sp:]+cart[:sp]))
if int(mxcart) > int(acart):
mxcart = acart
print " ".join(map(str, mxcart))
except:
break |
s762670977 | p00082 | u759949288 | 1403583805 | Python | Python | py | Runtime Error | 0 | 0 | 443 | import sys
patterns = [[1, 2, 1, 2, 1, 4, 1, 4],
[1, 2, 1, 4, 1, 4, 1, 2],
[1, 4, 1, 4, 1, 2, 1, 2],
[2, 1, 2, 1, 4, 1, 4, 1],
[2, 1, 4, 1, 4, 1, 2, 1],
[4, 1, 2, 1, 2, 1, 4, 1],
[4, 1, 4, 1, 2, 1, 2, 1],
]
for line in sys.stdin:
p = [int(x) for x in line.split()]
m = sum(p)
pt = None
for ptn in patterns:
rem = sum(max(0, v - x) for v, x in zip(ptn, p))
if rem < m:
m = rem
pt = ptn
print " ".join([str(x) for x in pt]) |
s715427564 | p00082 | u759949288 | 1403583910 | Python | Python | py | Runtime Error | 0 | 0 | 466 | import sys
patterns = [[1, 2, 1, 2, 1, 4, 1, 4],
[1, 2, 1, 4, 1, 4, 1, 2],
[1, 4, 1, 4, 1, 2, 1, 2],
[2, 1, 2, 1, 4, 1, 4, 1],
[2, 1, 4, 1, 4, 1, 2, 1],
[4, 1, 2, 1, 2, 1, 4, 1],
[4, 1, 4, 1, 2, 1, 2, 1],
]
for line in sys.stdin:
if not line: continue
p = [int(x) for x in line.split()]
m = sum(p)
pt = None
for ptn in patterns:
rem = sum(max(0, v - x) for v, x in zip(ptn, p))
if rem < m:
m = rem
pt = ptn
print " ".join([str(x) for x in pt]) |
s251324339 | p00083 | u032662562 | 1489821123 | Python | Python3 | py | Runtime Error | 0 | 0 | 766 | from datetime import datetime
def era(f):
meiji_st = datetime(1868, 9, 8)
taisho_st = datetime(1912, 7,30)
showa_st = datetime(1926,12,25)
heisei_st = datetime(1989, 1, 8)
y,m,d = f
dt = datetime(y,m,d)
if dt > heisei_st:
ret = "heisei %d %d %d" % (dt.year - heisei_st.year+1,dt.month,dt.day)
elif dt > showa_st:
ret = "showa %d %d %d" % (dt.year - showa_st.year+1,dt.month,dt.day)
elif dt > taisho_st:
ret = "taisho %d %d %d" % (dt.year - taisho_st.year+1,dt.month,dt.day)
elif dt > meiji_st:
ret = "meiji %d %d %d" % (dt.year - meiji_st.year+1,dt.month,dt.day)
else:
ret = "pre-meiji"
return(ret)
while True:
f = map(int, input().strip().split())
print(era(f)) |
s400206773 | p00083 | u350508326 | 1371306482 | Python | Python | py | Runtime Error | 0 | 0 | 4648 | while True:
try:
a,b,c = map(int,raw_input().split(" "))
if a >= 1990:
a = a - 1989 +1
print "heisei",a,b,c
elif a == 1989:
if b == 1:
if c >= 8:
a = a - 1989 + 1
print "heisei",a,b,c,
else:
a = a - 1926 + 1
print "showa",a,b,c
else:
a = a - 1989 +1
print "heisei",a,b,c
elif a >= 1927 :
a = a - 1926 + 1
print "showa",a,b,c
elif a == 1926:
if b == 12:
if c >= 25:
a = a - 1926 + 1
print "showa",a,b,c
else:
a = a - 1912 +1
print "taisho",a,b,c
else:
a = a - 1912 +1
print "taisho",a,b,c
|
s312746346 | p00084 | u489809100 | 1446630210 | Python | Python | py | Runtime Error | 0 | 0 | 252 | while True:
code = raw_input()
code = code.replace(",","")
code = code.replace(".","")
code = code.split()
list = []
for var in code:
if len(var) >= 3 and len(var) <= 6:
list.append(var)
for var in list:
print var,
print "" |
s215713364 | p00084 | u150984829 | 1525266362 | Python | Python3 | py | Runtime Error | 0 | 0 | 75 | import re
print(*[x for x in re.split(r'\s|"|,|\.',input())if 2<len(s)<7])
|
s363244311 | p00084 | u633068244 | 1396078203 | Python | Python | py | Runtime Error | 0 | 0 | 116 | msg = map(str, raw_input().replace(",","").replace(".","").split())
for w in msg:
print w, if 2 < len(w) <7 else "" |
s680815560 | p00084 | u912237403 | 1398011863 | Python | Python | py | Runtime Error | 0 | 0 | 100 | s=raw_input().replace(","," ").replace("."," ").split()
s=" ".join(map(lambda 2<len(w)<7 s))
print s |
s665464244 | p00085 | u133119785 | 1498916783 | Python | Python3 | py | Runtime Error | 0 | 0 | 349 | def act(t,m,l):
t = (t+m) % len(l);
del l[t-1]
return (t-1) % (len(l)+1)
while True:
i = raw_input().split()
n = int(i[0])
m = int(i[1])
if n == 0 and m == 0:
break
else:
l = range(1,n+1)
t = 0
for i in range(n-1):
tt = act(t,m,l);
t = tt;
print l[0] |
s992484459 | p00085 | u136916346 | 1528728044 | Python | Python3 | py | Runtime Error | 0 | 0 | 285 | while 1:
n,m=list(map(int,input().split()))
if n==0 and m==0:break
l=range(1,1+n)
st=m-1
while len(l)!=1:
del l[st]
st+=(m-1)
while 1:
if st>=len(l):
st=st-len(l)
if st<len(l):break
print(l[0])
|
s617405635 | p00085 | u647766105 | 1357095124 | Python | Python | py | Runtime Error | 0 | 0 | 163 | def f(n,k):
return 0 if n==0 else (f(n-1,k)+k)%n
while True:
n,k=map(int,raw_input().strip().split())
if (n,k)==(0,0):
break
print f(n,k)+1 |
s713227756 | p00085 | u865312527 | 1372955395 | Python | Python | py | Runtime Error | 0 | 0 | 190 | while 1:
n,m=map(int,raw_input())
if n==0==m: break
data=range(n)
pos=m
while len(data)!=1:
del data[pos]
pos+=m
if pos>=len(data): pos-=len(data) |
s352191655 | p00085 | u633068244 | 1393847266 | Python | Python | py | Runtime Error | 0 | 0 | 455 | while True:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
p = [1 for i in range(n)]
pn = n; count = 0
while pn > 1:
for i in range(n):
if p[i] == 1:
count += 1
if count == m:
p[i] = 0
pn -= 1
count = 0
print p.index(1)+1 |
s450558123 | p00085 | u633068244 | 1393847375 | Python | Python | py | Runtime Error | 0 | 0 | 457 | while True:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
p = [ 1 for i in range(n) ]
pn = n; count = 0
while pn > 1:
for i in range(n):
if p[i] == 1:
count += 1
if count == m:
p[i] = 0
pn -= 1
count = 0
print p.index(1)+1 |
s888727844 | p00085 | u633068244 | 1393847806 | Python | Python | py | Runtime Error | 0 | 0 | 599 | while True:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
p = [ 1 for i in range(n) ]
pn = n; count = 0; flag = 1
while flag = 1:
for i in range(n):
if p[i] == 1:
count += 1
if count == m:
p[i] = 0
count = 0
pn -= 1
if pn == 1:
flag = 0
break
print p.index(1)+1 |
s194552868 | p00086 | u798803522 | 1473685878 | Python | Python3 | py | Runtime Error | 0 | 0 | 322 | import sys
data = sys.stdin.readlines()
targ= {}
for d in data:
temp = d.split(' ')
if temp[0] == temp[1] == 0:
for k in targ.keys():
if targ[k] % 2 != 0:
print("NG")
break
else:
print("OK")
else:
targ[temp] = targ.get(temp,0) + 1 |
s379987841 | p00086 | u811733736 | 1505386216 | Python | Python3 | py | Runtime Error | 0 | 0 | 777 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0086
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
while True:
routes = []
while True:
a, b = map(int, input().split())
if a == 0 and b == 0:
break
routes.append([a, b])
if len(routes) < 1:
quit()
degree = [0] * 101
for a, b in routes:
degree[a] += 1
degree[b] += 1
odds = [x for x in degree if x%2==1]
evens = [x for x in degree if x%2==0]
if len(odds) == 0 or len(odds) == 2:
print('OK')
else:
print('NG')
if __name__ == '__main__':
main(sys.argv[1:])
|
s656794667 | p00086 | u659034691 | 1505685161 | Python | Python3 | py | Runtime Error | 0 | 0 | 388 | while True:
try:
v=[]
a,b=(int(i) for i in input().split())
while a!=0 or b!=0:
while b>len(v):
v.append(0)
v[a]+=1
v[b]+=1
a=0
while a<len(v) and v[a]%2==0:
a+=1
if a<len(v):
print("NG")
else:
print("OK")
except EOFError:
break |
s640134573 | p00086 | u150984829 | 1525269654 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | import sys
v=[0]*101
for e in sys.stdin:
a,b=map(int,e.split())
v[a]+=1;v[b]+=1
if a==0:
print(['OK','NG'][(v[1]&1)*(v[2]&1)*sum(x&1 for x in v)-2])
v=[0]*101
|
s124203302 | p00086 | u878596989 | 1528104177 | Python | Python3 | py | Runtime Error | 0 | 0 | 534 | # -*- coding: utf-8 -*-
# 宇都宮涼
# J5-170029
# Tax Rate Changed
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp? id=1192&lang=jp
# 右中央
while True:
a,b,c = map(int, input().strip().split(' '))
temp = 0
if a == 0 and b == 0 and c == 0:
break
for i in range(1, c):
for j in range(i, c):
if i*(100+a)//100 + j*(100+a)//100 == c:
if temp < i*(100+b)//100 + j*(100+b)//100:
temp = i*(100+b)//100 + j*(100+b)//100
print(temp)
|
s973147116 | p00086 | u878596989 | 1528104224 | Python | Python3 | py | Runtime Error | 0 | 0 | 541 | # -*- coding: utf-8 -*-
# 宇都宮涼
# J5-170029
# Tax Rate Changed
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp? id=1192&lang=jp
# 右中央
from sys import stdin
temp = [0] * 50
while True:
a,b = map(int, input().strip().split(' '))
boolean = True
if a == 0 and b == 0:
for i in range(len(temp)-3):
if temp[i+3]%2 == 1:
boolean = False
if boolean == True:
print("OK")
else:
print("NG")
temp[int(a)] += 1
temp[int(b)] += 1
|
s965200829 | p00086 | u782850731 | 1379211696 | Python | Python | py | Runtime Error | 0 | 0 | 554 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
from collections import Counter
cnt = Counter()
for line in stdin:
start, end = (int(s) for s in line.split())
if start or end:
cnt[start] += 1
cnt[end] += 1
else:
assert cnt[1] == 1
assert cnt[2] == 1
eulerian_graph = sum(i % 2 for i in cnt.values()) == 2
print('OK' if eulerian_graph else 'NG')
cnt.clear() |
s861547748 | p00086 | u822971508 | 1401196350 | Python | Python3 | py | Runtime Error | 0 | 0 | 653 | #coding:utf-8
while 1:
try:
#初期化
key=[]
for i in range(101):
key.append(0)
flag = 0
#オイラー路:すべての頂点のうち、次数が奇数であるものがちょうど2つ(入口と出口)
while 1:
input = map(int, raw_input().split())
if(input[0] == 0 and input[1] == 0):
break
key[input[0]]+=1
key[input[1]]+=1
for v in key:
if v%2 == 1:
flag+=1
if(flag == 2 or flag == 0):
print "OK"
else:
print "NG"
except:
break |
s984418109 | p00086 | u822971508 | 1401196931 | Python | Python3 | py | Runtime Error | 0 | 0 | 312 | while True:
try:
path = [0]*100
while True:
a,b = map(int, raw_input().split())
if a == 0: break
path[a-1] += 1; path[b-1] += 1
if (path[0]%2 == path[1]%2 == 1 ):
print "OK"
else:
print "NG"
except:
break |
s302528915 | p00086 | u822971508 | 1401196979 | Python | Python3 | py | Runtime Error | 0 | 0 | 318 | while True:
try:
path = [0]*100
while True:
a,b = map(int, raw_input().split())
if a == 0: break
path[a-1] += 1; path[b-1] += 1
if (path[0]%2 == 1 and path[1]%2 == 1 ):
print "OK"
else:
print "NG"
except:
break |
s538059107 | p00086 | u822971508 | 1401197916 | Python | Python | py | Runtime Error | 0 | 0 | 547 | #coding:utf-8
#初期化
key=[0]*101
flag = 0;
#オイラー路:すべての頂点のうち、次数が奇数であるものがちょうど2つ(入口と出口)
while 1:
input = map(int, raw_input().split())
if(input[0] == 0 and input[1] == 0):
break
key[input[0]]+=1
key[input[1]]+=1
for v in key:
if v%2 == 1:
flag+=1
if(flag == 2):
print "OK"
else:
print "NG" |
s049248997 | p00086 | u822971508 | 1401200986 | Python | Python | py | Runtime Error | 0 | 0 | 565 | #coding:utf-8
while 1:
try:
#初期化
key=[0]*101
#オイラー路:すべての頂点のうち、次数が奇数であるものがちょうど2つ(入口と出口)
while 1:
input = map(int, raw_input().split())
if(input[0] == 0 and input[1] == 0):
break
key[input[0]]+=1
key[input[1]]+=1
if(key[1]%2 == 1 and key[2]%2==1 and len(filter(lambda x:x%2=1,key[3:]))==0):
print "OK"
else:
print "NG"
except:
break |
s873222919 | p00087 | u567380442 | 1423312724 | Python | Python3 | py | Runtime Error | 0 | 0 | 443 | import sys
f = sys.stdin
from collections import deque
import operator
func = {'+':operator.add,'-':operator.sub,'*':operator.mul,'/':operator.truediv }
for line in f:
stack = deque()
for element in line.strip().split():
if element.isdigit():
stack.append(int(element))
else:
b = stack.pop()
a = stack.pop()
stack.append(func[element](a, b))
print(*stack)
|
s805462342 | p00087 | u567380442 | 1423312846 | Python | Python3 | py | Runtime Error | 0 | 0 | 464 | import sys
f = sys.stdin
from collections import deque
import operator
func = {'+':operator.add,'-':operator.sub,'*':operator.mul,'/':operator.truediv }
for line in f:
stack = deque()
for element in line.strip().split():
if element.isdigit():
stack.append(float(element))
else:
b = stack.pop()
a = stack.pop()
stack.append(func[element](a, b))
print('{:.6f}'.format(stack[0]))
|
s298829696 | p00087 | u567380442 | 1423314784 | Python | Python3 | py | Runtime Error | 0 | 0 | 460 | import sys
f = sys.stdin
from collections import deque
import operator
func = {'+':operator.add,'-':operator.sub,'*':operator.mul,'/':operator.div }
for line in f:
stack = deque()
for element in line.strip().split():
if element.isdigit():
stack.append(float(element))
else:
b = stack.pop()
a = stack.pop()
stack.append(func[element](a, b))
print('{:.6f}'.format(stack[0]))
|
s519358433 | p00087 | u879226672 | 1428079065 | Python | Python | py | Runtime Error | 0 | 0 | 692 | def reverse_polish(order):
stack = []
for i in range(len(order)):
if order[i].isdigit():
stack.append(float(order[i]))
elif order[i]=='+':
tmp=stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='-':
tmp=-stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='*':
tmp=stack.pop()*stack.pop()
stack.append(tmp)
elif order[i]=='/':
tmp=(1/stack.pop())*stack.pop()
stack.append(tmp)
return stack[0]
while True:
try:
order = raw_input().split()
except EOFError: break
print reverse_polish(order) |
s561965677 | p00087 | u879226672 | 1428079103 | Python | Python | py | Runtime Error | 0 | 0 | 707 | def reverse_polish(order):
stack = []
for i in range(len(order)):
if order[i].isdigit():
stack.append(float(order[i]))
elif order[i]=='+':
tmp=stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='-':
tmp=-stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='*':
tmp=stack.pop()*stack.pop()
stack.append(tmp)
elif order[i]=='/':
tmp=(1./stack.pop())*stack.pop()
stack.append(tmp)
return stack[0]
while True:
try:
order = raw_input().split()
except EOFError:
break
print reverse_polish(order)
|
s604453778 | p00087 | u879226672 | 1428079294 | Python | Python | py | Runtime Error | 0 | 0 | 699 | def reverse_polish(order):
stack = []
for i in range(len(order)):
if order[i].isdigit():
stack.append(float(order[i]))
elif order[i]=='+':
tmp=stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='-':
tmp=-stack.pop()+stack.pop()
stack.append(tmp)
elif order[i]=='*':
tmp=stack.pop()*stack.pop()
stack.append(tmp)
elif order[i]=='/':
tmp=(1./stack.pop())*stack.pop()
stack.append(tmp)
print stack[0]
while True:
try:
order = raw_input().split()
reverse_polish(order)
except EOFError:
break |
s762706742 | p00087 | u145563629 | 1428933214 | Python | Python | py | Runtime Error | 0 | 0 | 438 | while 1:
su = 0
stack = []
raw = raw_input().split()
for s in raw:
if s == "-":
stack.append(stack.pop(-2) - stack.pop())
elif s == "+":
stack.append(stack.pop(-2) + stack.pop())
elif s == "/":
stack.append(stack.pop(-2) / stack.pop())
elif s == "*":
stack.append(stack.pop(-2) * stack.pop())
elif s == "%":
stack.append(stack.pop(-2) % stack.pop())
else:
stack.append(int(s))
print "%.6" % stack[0] |
s256556195 | p00087 | u145563629 | 1428933276 | Python | Python | py | Runtime Error | 0 | 0 | 480 | while 1:
su = 0
stack = []
try:
raw = raw_input().split()
except:
pass
else:
for s in raw:
if s == "-":
stack.append(stack.pop(-2) - stack.pop())
elif s == "+":
stack.append(stack.pop(-2) + stack.pop())
elif s == "/":
stack.append(stack.pop(-2) / stack.pop())
elif s == "*":
stack.append(stack.pop(-2) * stack.pop())
elif s == "%":
stack.append(stack.pop(-2) % stack.pop())
else:
stack.append(int(s))
print "%.6" % stack[0] |
s248286607 | p00087 | u145563629 | 1428933491 | Python | Python | py | Runtime Error | 0 | 0 | 438 | while 1:
su = 0
stack = []
raw = raw_input().split()
for s in raw:
if s == "-":
stack.append(stack.pop(-2) - stack.pop())
elif s == "+":
stack.append(stack.pop(-2) + stack.pop())
elif s == "/":
stack.append(stack.pop(-2) / stack.pop())
elif s == "*":
stack.append(stack.pop(-2) * stack.pop())
elif s == "%":
stack.append(stack.pop(-2) % stack.pop())
else:
stack.append(int(s))
print "%.6f" % (stack[0]) |
s568828260 | p00087 | u145563629 | 1428933594 | Python | Python | py | Runtime Error | 0 | 0 | 442 | while 1:
stack = []
try:
for s in raw_input().split():
if s == "-":
stack.append(stack.pop(-2) - stack.pop())
elif s == "+":
stack.append(stack.pop(-2) + stack.pop())
elif s == "/":
stack.append(stack.pop(-2) / stack.pop())
elif s == "*":
stack.append(stack.pop(-2) * stack.pop())
elif s == "%":
stack.append(stack.pop(-2) % stack.pop())
else:
stack.append(int(s))
print "%.6f" % (stack[0]) |
s398106943 | p00087 | u882992966 | 1441261156 | Python | Python3 | py | Runtime Error | 0 | 0 | 610 | def calc_inverse_polish_notation_string(s):
tokens = [token for token in s.split(' ') if token != '']
stack = []
for token in tokens:
if token in ['+', '-', '*', '/']:
val2 = stack.pop()
val1 = stack.pop()
result = eval("%s %s %s" % (val1, token, val2))
stack.append(result)
else:
stack.append(token)
return stack[0] # if len(stack) != 1, it should throw an exception
def main():
for line in sys.stdin.readlines():
print(calc_inverse_polish_notation_string(line))
if __name__ == "__main__":
main() |
s859864768 | p00087 | u882992966 | 1441311356 | Python | Python3 | py | Runtime Error | 0 | 0 | 810 | #!/usr/bin/env python3
import sys
def main():
lines = sys.stdin.readlines()
(_, quantum) = lines[0].split(' ')
quantum = int(quantum)
processes = []
for line in lines[1:]:
if line.strip() == '':
break
(k, v) = line.strip().split(' ')
processes.append((k, int(v)))
time = 0
result = []
while True:
(process, process_time) = processes.pop(0) # Dequeue
if process_time <= quantum:
time += process_time
result.append((process, time))
else:
time += quantum
processes.append((process, process_time - quantum))
if len(processes) == 0:
break
for item in result:
print("%s %s" % (item[0], item[1]))
if __name__ == "__main__":
main() |
s132845455 | p00087 | u160041984 | 1473727778 | Python | Python3 | py | Runtime Error | 0 | 0 | 370 | import sys
def line():return sys.stdin.readline().strip()
ops = {"+":lambda a,b:b + a,
"-":lambda a,b:b - a,
"*":lambda a,b:b * a,
"/":lambda a,b:b / a}
while True:
stack = []
for s in line().split():
if s in ops:
stack.append(ops[s](stack.pop(),stack.pop()))
else:
stack.append(int(s))
print(stack[0]) |
s838162442 | p00087 | u925992597 | 1488242870 | Python | Python3 | py | Runtime Error | 0 | 0 | 131 | s=list();[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in __import__('sys').argv[1:]];print(s[0]) |
s132838835 | p00087 | u925992597 | 1488299190 | Python | Python3 | py | Runtime Error | 0 | 0 | 173 | s=list();[[[s.append(eval('{2}{1}{0}'.format(s.pop(),i,s.pop()))if(i in'+-*/')else i)for i in input().split(' ')]and print(s.pop())]for x in __import__('itertools').count()] |
s924402791 | p00087 | u546285759 | 1495184013 | Python | Python3 | py | Runtime Error | 0 | 0 | 338 | import re
while True:
try:
f = input().split()
except:
break
stack = []
for c in f:
if re.match("-*[0-9]", c) is None:
b, a = stack.pop(), stack.pop()
stack.append(eval("{}{}{}".format(a, c, b)))
else:
stack.append(c)
print("{0:.6f}".format(stack[0])) |
s583165274 | p00087 | u452926933 | 1520305248 | Python | Python | py | Runtime Error | 0 | 0 | 980 | def is_float_str(num_str, default=0):
try:
return {"is_float": True, "val": float(num_str)}
except ValueError:
return {"is_float": False, "val": default}
def compute(operand, val1, val2):
if operand == "+":
return val1 + val2
elif operand == "-":
return val1 - val2
elif operand == "*":
return val1 * val2
elif operand == "/":
return val1 / val2
def get_input():
while True:
try:
yield input()
except EOFError:
break
# split with ' '
formulas = list(get_input())
for (i, formula) in enumerate(formulas, 0):
formulas[i] = formula.split(' ')
stack = []
for formula in formulas:
for elm in formula:
if is_float_str(elm)["is_float"]:
stack.append(is_float_str(elm)["val"])
elif elm in ['+', '-', '*', '/']:
stack.append(compute(elm, stack.pop(), stack.pop()))
if len(stack) == 1:
print(str(stack[0]) + '\n')
|
s900203943 | p00087 | u290605490 | 1356583205 | Python | Python | py | Runtime Error | 0 | 0 | 508 | from __future__ import division
while True:
try:
s=raw_input().rstrip().split()
except EOFError:
break
L=[]
for d in s:
if d.isdigit():
L.append(int(d))
else:
op1=L.pop()
op2=L.pop()
if d=="-":
L.append(op2-op1)
elif d=="+":
L.append(op2+op1)
elif d=="*":
L.append(op2*op1)
else:
L.append(op2/op1)
print L[0] |
s829158029 | p00087 | u290605490 | 1356583289 | Python | Python | py | Runtime Error | 0 | 0 | 478 | while True:
try:
s=raw_input().rstrip().split()
except EOFError:
break
L=[]
for d in s:
if d.isdigit():
L.append(float(d))
else:
op1=L.pop()
op2=L.pop()
if d=="-":
L.append(op2-op1)
elif d=="+":
L.append(op2+op1)
elif d=="*":
L.append(op2*op1)
else:
L.append(op2/op1)
print L[0] |
s542108412 | p00087 | u290605490 | 1356583803 | Python | Python | py | Runtime Error | 0 | 0 | 481 | while True:
try:
s=raw_input().strip().split()
except EOFError:
break
L=[]
for d in s:
if not d.isdigit():
op1=L.pop()
op2=L.pop()
if d=="-":
L.append(op2-op1)
elif d=="+":
L.append(op2+op1)
elif d=="*":
L.append(op2*op1)
else:
L.append(op2/op1)
else:
L.append(float(d))
print L[0] |
s658710328 | p00087 | u290605490 | 1356584057 | Python | Python | py | Runtime Error | 0 | 0 | 484 | while True:
try:
s=raw_input().strip().split()
except EOFError:
break
L=[]
for d in s:
if d.isdigit():
L.append(float(d))
else:
op1=L.pop()
op2=L.pop()
if d=="-":
L.append(op2-op1)
elif d=="+":
L.append(op2+op1)
elif d=="*":
L.append(op2*op1)
elif d=="/":
L.append(op2/op1)
print L[0] |
s311559212 | p00087 | u290605490 | 1356584122 | Python | Python | py | Runtime Error | 0 | 0 | 433 | import sys
for s in sys.stdin.readlines():
L=[]
for d in s:
if d.isdigit():
L.append(float(d))
else:
op1=L.pop()
op2=L.pop()
if d=="-":
L.append(op2-op1)
elif d=="+":
L.append(op2+op1)
elif d=="*":
L.append(op2*op1)
elif d=="/":
L.append(op2/op1)
print L[0] |
s622223729 | p00087 | u290605490 | 1356584229 | Python | Python | py | Runtime Error | 0 | 0 | 348 | import sys
for s in sys.stdin.readlines():
L=[]
for d in s:
if d=="-":
L.append(-(L.pop()-L.pop()))
elif d=="+":
L.append(L.pop()+L.pop())
elif d=="*":
L.append(L.pop()*L.pop())
elif d=="/":
L.append(1/L.pop()*L.pop())
L.append(float(d))
print L[0] |
s783282144 | p00087 | u782850731 | 1379215845 | Python | Python | py | Runtime Error | 0 | 0 | 647 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from sys import stdin
for line in stdin:
stack = []
for s in line.split():
if s.isdigit():
stack.append(float(s))
elif s == '+':
n = stack.pop()
stack[-1] += n
elif s == '-':
n = stack.pop()
stack[-1] -= n
elif s == '*':
n = stack.pop()
stack[-1] *= n
elif s == '/':
n = stack.pop()
stack[-1] /= n
print('{:.6f}'.format(stack[-1])) |
s825684418 | p00087 | u260980560 | 1384351969 | Python | Python | py | Runtime Error | 0 | 0 | 493 | while 1:
try:
ipt = raw_input().split()
except EOFError:
break;
s = []
for i in range(len(ipt)):
if ipt[i].isdigit():
s.append(float(ipt[i]))
else:
b = s.pop(); a = s.pop();
if ipt[i]=='+':
s.append(a+b)
elif ipt[i]=='-':
s.append(a-b)
elif ipt[i]=='*':
s.append(a*b)
else:
s.append(a/b)
print "%.6f"%s[0] |
s408674944 | p00087 | u260980560 | 1384352076 | Python | Python | py | Runtime Error | 0 | 0 | 509 | while 1:
try:
ript = raw_input()
except EOFError:
break;
ipt = ript.split()
s = []
for i in range(len(ipt)):
if ipt[i].isdigit():
s.append(float(ipt[i]))
else:
b = s.pop(); a = s.pop();
if ipt[i]=='+':
s.append(a+b)
elif ipt[i]=='-':
s.append(a-b)
elif ipt[i]=='*':
s.append(a*b)
else:
s.append(a/b)
print "%.6f"%s[0] |
s129908282 | p00087 | u260980560 | 1384352162 | Python | Python | py | Runtime Error | 0 | 0 | 554 | while 1:
try:
ipt = raw_input().split()
s = []
for i in range(len(ipt)):
if ipt[i].isdigit():
s.append(float(ipt[i]))
else:
b = s.pop(); a = s.pop();
if ipt[i]=='+':
s.append(a+b)
elif ipt[i]=='-':
s.append(a-b)
elif ipt[i]=='*':
s.append(a*b)
else:
s.append(a/b)
print "%.6f"%s[0]
except EOFError:
break; |
s808443833 | p00087 | u260980560 | 1384352284 | Python | Python | py | Runtime Error | 0 | 0 | 568 | while 1:
try:
ipt = raw_input().split()
s = []
for i in range(len(ipt)):
if ipt[i].isdigit():
s.append(float(ipt[i]))
else:
b = s.pop(); a = s.pop();
if ipt[i]=='+':
s.append(a+b)
elif ipt[i]=='-':
s.append(a-b)
elif ipt[i]=='*':
s.append(a*b)
else:
s.append(a/b)
if len(s)==1: print "%.6f"%s[0]
except EOFError:
break; |
s611819591 | p00087 | u260980560 | 1385213363 | Python | Python | py | Runtime Error | 0 | 0 | 422 | import sys
for s in sys.stdin.readlines():
st = []
for c in s.split():
if c.isdigit():
st.append(float(c))
else:
b = st.pop(); a = st.pop();
if c=='+':
st.append(a+b)
elif c=='-':
st.append(a-b)
elif c=='*':
st.append(a*b)
else:
st.append(a/b)
print st.pop() |
s426596198 | p00087 | u336443042 | 1393508333 | Python | Python | py | Runtime Error | 0 | 0 | 530 | import sys
for line in iter(sys.stdin.readline, ""):
foo=map(str, line.strip().split())
stack=[]
while (foo!=[]):
if foo[0]=='+':
del foo[0]
stack.append(int(stack.pop())+int(stack.pop()))
elif foo[0]=='*':
del foo[0]
stack.append(int(stack.pop())*int(stack.pop()))
elif foo[0]=='-':
del foo[0]
stack.append(-int(stack.pop())+int(stack.pop()))
elif foo[0]=='/':
del foo[0]
stack.append(1.0/int(stack.pop())*int(stack.pop()))
else:
stack.append(foo.pop(0))
print "{:.6f}".format(stack[0]+0) |
s387753256 | p00087 | u336443042 | 1393508532 | Python | Python | py | Runtime Error | 0 | 0 | 523 | import sys
for line in sys.stdin.readlines():
foo=map(str, line.strip().split())
stack=[]
while (foo!=[]):
if foo[0]=='+':
del foo[0]
stack.append(int(stack.pop())+int(stack.pop()))
elif foo[0]=='*':
del foo[0]
stack.append(int(stack.pop())*int(stack.pop()))
elif foo[0]=='-':
del foo[0]
stack.append(-int(stack.pop())+int(stack.pop()))
elif foo[0]=='/':
del foo[0]
stack.append(1.0/int(stack.pop())*int(stack.pop()))
else:
stack.append(foo.pop(0))
print "{:.6f}".format(stack[0]+0) |
s153155186 | p00087 | u633068244 | 1393853385 | Python | Python | py | Runtime Error | 0 | 0 | 582 | while True:
inp = map(str, raw_input().split())
stuck = []
for i in inp:
if i == "+":
stuck.append(int(stuck.pop(len(stuck)-2)) + int(stuck.pop(len(stuck)-1)) )
elif i == "-":
stuck.append(int(stuck.pop(len(stuck)-2)) - int(stuck.pop(len(stuck)-1)) )
elif i == "*":
stuck.append(int(stuck.pop(len(stuck)-2)) * int(stuck.pop(len(stuck)-1)) )
elif i == "/":
stuck.append(int(stuck.pop(len(stuck)-2)) / float(stuck.pop(len(stuck)-1)) )
else:
stuck.append(i)
print stuck |
s088851286 | p00087 | u193025715 | 1395420459 | Python | Python | py | Runtime Error | 0 | 0 | 491 | while True:
calc = raw_input().split()
ans = []
while len(calc) != 0:
if calc[0].isdigit():
ans.append(calc.pop(0))
else:
mark = calc[0]
if mark == "+":
tmp = float(ans.pop()) + float(ans.pop())
elif mark == "-":
tmp = -float(ans.pop()) + float(ans.pop())
elif mark == "*":
tmp = float(ans.pop()) * float(ans.pop())
elif mark == "/":
tmp = float(ans.pop()) / float(ans.pop())
tmp = 1 / tmp
ans.append(tmp)
calc.pop(0)
print '%.6f' % ans[0] |
s271688288 | p00087 | u193025715 | 1395421107 | Python | Python | py | Runtime Error | 0 | 0 | 219 | while True:
stack = []
for s in raw_input().split():
if s in ('+', '-', '*', '/'):
stack.append(eval('{2}{1}{0}'.format(stack.pop(), s, stack.pop())))
else:
stack.append(float(s))
print '%.6f' % stack.pop() |
s990474453 | p00087 | u193025715 | 1395421145 | Python | Python | py | Runtime Error | 0 | 0 | 234 | while True:
stack = []
for s in raw_input().split():
if s in ('+', '-', '*', '/'):
stack.append(eval('{2}{1}{0}'.format(stack.pop(), s, stack.pop())))
else:
stack.append(float(s))
print '%.6f' % stack.pop() |
s986524994 | p00087 | u260980560 | 1397482140 | Python | Python | py | Runtime Error | 0 | 0 | 430 | import sys
for s in sys.stdin.readlines():
st = []
for c in s.strip().split():
if c.isdigit():
st.append(float(c))
else:
b = st.pop(); a = st.pop();
if c=='+':
st.append(a+b)
elif c=='-':
st.append(a-b)
elif c=='*':
st.append(a*b)
else:
st.append(a/b)
print st.pop() |
s247698970 | p00088 | u032662562 | 1487919271 | Python | Python3 | py | Runtime Error | 0 | 0 | 1637 | class Code:
def __init__(self):
True
self.cd1 = {" ":"101","'":"000000",",":"000011","-":"10010001",".":"010001","?":"000001","A":"100101","B":"10011010","C":"0101","D":"0001","E":"110","F":"01001","G":"10011011","H":"010000","I":"0111","J":"10011000","K":"0110","L":"00100","M":"10011001","N":"10011110","O":"00101","P":"111","Q":"10011111","R":"1000","S":"00110","T":"00111","U":"10011100","V":"10011101","W":"000010","X":"10010010","Y":"10010011","Z":"10010000"}
self.cd2 = {"00000":"A","00001":"B","00010":"C","00011":"D","00100":"E","00101":"F","00110":"G","00111":"H","01000":"I","01001":"J","01010":"K","01011":"L","01100":"M","01101":"N","01110":"O","01111":"P","10000":"Q","10001":"R","10010":"S","10011":"T","10100":"U","10101":"V","10110":"W","10111":"X","11000":"Y","11001":"Z","11010":" ","11011":".","11100":",","11101":"-","11110":"'","11111":"?"}
def code1(self,s):
t0 = list(map(lambda x:self.cd1[x], s))
t1 = ''.join(t0)
t = list(t1)
t0 = t
u = []
while len(t) > 0:
u.append(t[0:5])
t[0:5]=[]
if len(u[-1]) != 5:
u[-1] = (u[-1] + ['0']*4)[0:5]
v = list(map(lambda x:''.join(x), u))
return(v)
def code2(self,s):
t = []
for i in s:
t.append(self.cd2[i])
u = ''.join(t)
return(u)
if __name__ == "__main__":
cd = Code()
while True:
try:
s = input().strip()
t = cd.code1(s)
u = cd.code2(t)
print(u)
except EOFError:
break |
s728876983 | p00088 | u032662562 | 1487919372 | Python | Python3 | py | Runtime Error | 0 | 0 | 1623 | class Code:
def __init__(self):
self.cd1 = {" ":"101","'":"000000",",":"000011","-":"10010001",".":"010001","?":"000001","A":"100101","B":"10011010","C":"0101","D":"0001","E":"110","F":"01001","G":"10011011","H":"010000","I":"0111","J":"10011000","K":"0110","L":"00100","M":"10011001","N":"10011110","O":"00101","P":"111","Q":"10011111","R":"1000","S":"00110","T":"00111","U":"10011100","V":"10011101","W":"000010","X":"10010010","Y":"10010011","Z":"10010000"}
self.cd2 = {"00000":"A","00001":"B","00010":"C","00011":"D","00100":"E","00101":"F","00110":"G","00111":"H","01000":"I","01001":"J","01010":"K","01011":"L","01100":"M","01101":"N","01110":"O","01111":"P","10000":"Q","10001":"R","10010":"S","10011":"T","10100":"U","10101":"V","10110":"W","10111":"X","11000":"Y","11001":"Z","11010":" ","11011":".","11100":",","11101":"-","11110":"'","11111":"?"}
def code1(self,s):
t0 = list(map(lambda x:self.cd1[x], s))
t1 = ''.join(t0)
t = list(t1)
t0 = t
u = []
while len(t) > 0:
u.append(t[0:5])
t[0:5]=[]
if len(u[-1]) != 5:
u[-1] = (u[-1] + ['0']*4)[0:5]
v = list(map(lambda x:''.join(x), u))
return(v)
def code2(self,s):
t = []
for i in s:
t.append(self.cd2[i])
u = ''.join(t)
return(u)
if __name__ == "__main__":
cd = Code()
while True:
try:
s = input().strip()
t = cd.code1(s)
u = cd.code2(t)
print(u)
except EOFError:
break |
s235830356 | p00088 | u150984829 | 1518087855 | Python | Python3 | py | Runtime Error | 0 | 0 | 186 | a='101'.join(''.join(d[c]for c in e.strip())for e in sys.stdin)
l=len(a)+4
b=a.ljust(l//5*5,'0')
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,l,5)))
|
s053232336 | p00088 | u150984829 | 1518087870 | Python | Python3 | py | Runtime Error | 0 | 0 | 620 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
a='101'.join(''.join(d[c]for c in e.strip())for e in sys.stdin)
l=len(a)+4
b=a.ljust(l//5*5,'0')
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,l,5)))
|
s111729791 | p00088 | u150984829 | 1518087880 | Python | Python3 | py | Runtime Error | 0 | 0 | 618 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110','F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111','Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
a='101'.join(''.join(d[c]for c in e.strip())for e in sys.stdin)
l=len(a)+4
b=a.ljust(l//5*5,'0')
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,l,5)))
|
s525246960 | p00088 | u150984829 | 1518088216 | Python | Python3 | py | Runtime Error | 0 | 0 | 613 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
for e in sys.stdin:
a=''.join(d[c]for c in e.strip())
l=len(a)+4
b=a.ljust(l//5*5,'0')
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,l,5)))
|
s860029576 | p00088 | u150984829 | 1518088478 | Python | Python3 | py | Runtime Error | 0 | 0 | 635 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
for e in sys.stdin:
a=''.join(d[c]for c in e.strip())
l=len(a)+4
#b=a.ljust(l//5*5,'0')
b=a+'0'*(-len(a)%5)
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,l,5)))
|
s519529312 | p00088 | u150984829 | 1518088739 | Python | Python3 | py | Runtime Error | 0 | 0 | 606 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
for e in sys.stdin:
a=''.join(d[c]for c in e.strip())
b=a+'0'*(-len(a)%5)
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,len(a)+4,5)))
|
s620850549 | p00088 | u150984829 | 1520205530 | Python | Python3 | py | Runtime Error | 0 | 0 | 606 | import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
for e in sys.stdin:
a=''.join(d[c]for c in e.strip())
b=a+'0'*(-len(a)%5)
print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(b[i:i+5],2)]for i in range(0,len(a)+4,5)))
|
s104646328 | p00088 | u352394527 | 1527592715 | Python | Python3 | py | Runtime Error | 0 | 0 | 1353 | dic1 = {" ":"101", "'":"000000", ",":"000011", "-":"10010001", "?":"000001",
"A":"100101", "B":"10011010", "C":"0101", "D":"0101", "E":"110",
"F":"01001", "G":"10011011", "H":"010000", "I":"0111", "J":"10011000",
"K":"0110", "L":"00100", "M":"10011001", "N":"10011110", "O":"00101",
"P":"111", "Q":"10011111", "R":"1000", "S":"00110", "T":"00111",
"U":"10011100", "V":"10011101", "W":"000010", "X":"10010010", "Y":"10010011", "Z":"10010000"}
dic2 = {"00000":"A", "00001":"B", "00010":"C", "00011":"D", "00100":"E",
"00101":"F", "00110":"G", "00111":"H", "01000":"I", "01001":"J",
"01010":"K", "01011":"L", "01100":"M", "01101":"N", "01110":"O",
"01111":"P", "10000":"Q", "10001":"R", "10010":"S", "10011":"T",
"10100":"U", "10101":"V", "10110":"W", "10111":"X", "11000":"Y",
"11001":"Z", "11010":" ", "11011":".", "11100":",", "11101":"-",
"11110":"'", "11111":"?"}
def to_digit(ss):
ret = ""
for s in ss:
ret += dic1[s]
return ret
def to_alpha(digit):
ret = ""
ind = 0
end = len(digit)
while ind + 5 < end:
ret += dic2[digit[ind:ind + 5]]
ind += 5
if digit[ind:]:
ret += dic2[digit[ind:] + "0" * (5 - end + ind)]
return ret
while True:
try:
ss = input()
print(to_alpha(to_digit(ss)))
except EOFError:
break
|
s637385468 | p00088 | u352394527 | 1527592750 | Python | Python3 | py | Runtime Error | 0 | 0 | 1289 | dic1 = {" ":"101", "'":"000000", ",":"000011", "-":"10010001", "?":"000001",
"A":"100101", "B":"10011010", "C":"0101", "D":"0101", "E":"110",
"F":"01001", "G":"10011011", "H":"010000", "I":"0111", "J":"10011000",
"K":"0110", "L":"00100", "M":"10011001", "N":"10011110", "O":"00101",
"P":"111", "Q":"10011111", "R":"1000", "S":"00110", "T":"00111",
"U":"10011100", "V":"10011101", "W":"000010", "X":"10010010", "Y":"10010011", "Z":"10010000"}
dic2 = {"00000":"A", "00001":"B", "00010":"C", "00011":"D", "00100":"E",
"00101":"F", "00110":"G", "00111":"H", "01000":"I", "01001":"J",
"01010":"K", "01011":"L", "01100":"M", "01101":"N", "01110":"O",
"01111":"P", "10000":"Q", "10001":"R", "10010":"S", "10011":"T",
"10100":"U", "10101":"V", "10110":"W", "10111":"X", "11000":"Y",
"11001":"Z", "11010":" ", "11011":".", "11100":",", "11101":"-",
"11110":"'", "11111":"?"}
def to_digit(ss):
ret = ""
for s in ss:
ret += dic1[s]
return ret
def to_alpha(digit):
ret = ""
ind = 0
end = len(digit)
while ind + 5 < end:
ret += dic2[digit[ind:ind + 5]]
ind += 5
if digit[ind:]:
ret += dic2[digit[ind:] + "0" * (5 - end + ind)]
return ret
print(to_alpha(to_digit(input())))
|
s522452212 | p00088 | u290605490 | 1355291663 | Python | Python | py | Runtime Error | 0 | 5440 | 1064 | d1={
" ":"101",
"'":"000000",
",":"000011",
"-":"10010001",
".":"010001",
"?":"000001",
"A":"100101",
"B":"10011010",
"C":"0101",
"D":"0001",
"E":"110",
"F":"01001",
"G":"10011011",
"H":"010000",
"I":"0111",
"J":"10011000",
"K":"0110",
"L":"00100",
"M":"10011001",
"N":"10011110",
"O":"00101",
"P":"111",
"Q":"10011111",
"R":"1000",
"S":"00110",
"T":"00111",
"U":"10011100",
"V":"10011101",
"W":"000010",
"X":"10010010",
"Y":"10010011",
"Z":"10010000"}
d2={
"00000":"A",
"00001":"B",
"00010":"C",
"00011":"D",
"00100":"E",
"00101":"F",
"00110":"G",
"00111":"H",
"01000":"I",
"01001":"J",
"01010":"K",
"01011":"L",
"01100":"M",
"01101":"N",
"01110":"O",
"01111":"P",
"10000":"Q",
"10001":"R",
"10010":"S",
"10011":"T",
"10100":"U",
"10101":"V",
"10110":"W",
"10111":"X",
"11000":"Y",
"11001":"Z",
"11010":" ",
"11011":".",
"11100":",",
"11101":"-",
"11110":"'",
"11111":"?"}
while 1:
s=raw_input()
s1,ans="",""
for w in s:
s1+=d1[w]
s1+="0"*(5-len(s1)%5)
for i in range(len(s1)/5):
ans+=d2[s1[:5]]
s1=s1[5:]
print ans |
s288780371 | p00088 | u193025715 | 1395563209 | Python | Python | py | Runtime Error | 0 | 0 | 1235 | encode = {' ':'101', '\'':'000000', ',':'000011', '-':'1001000', '.':'010001', '?':'000001', 'A':'100101', 'B':'10011010', 'C':'0101', 'D':'0001', 'E':'110', 'F':'01001', 'G':'10011011', 'H':'010000', 'I':'0111', 'J':'10011000', 'K':'0110', 'L':'00100', 'M':'10011001', 'N':'10011110', 'O':'00101', 'P':'111', 'Q':'10011111', 'R':'1000', 'S':'00110', 'T':'00111', 'U':'10011100', 'V':'10011101', 'W':'000010', 'X':'10010010', 'Y':'10010011', 'X':'10010000'}
decode = {'00000':'A', '00001':'B', '00010':'C', '00011':'D', '00100':'E','00101':'F','00110':'G','00111':'H','01000':'I','01001':'J','01010':'K','01011':'L','01100':'M','01101':'N','01110':'O','01111':'P','10000':'Q','10001':'R','10010':'S','10011':'T','10100':'U','10101':'V','10110':'W','10111':'X','11000':'Y','11001':'Z','11010':' ','11011':'.','11100':',','11101':'-','11110':'\'','11111':'?'}
while True:
try:
string = list(raw_input())
# encode
code = ""
for s in string:
code += encode[s]
i = 0
tmp = []
while i+5 <= len(code):
tmp.append(code[i:i+5])
code = code[i+5:]
if len(code) != 0:
code += '0' * (5 - len(code))
tmp.append(code)
# decode
ans = ""
for s in tmp:
ans += decode[s]
print ans
except EOFError:
break |
s115960538 | p00088 | u193025715 | 1395563379 | Python | Python | py | Runtime Error | 0 | 0 | 1253 | encode = {' ':'101', '\'':'000000', ',':'000011', '-':'1001000', '.':'010001', '?':'000001', 'A':'100101', 'B':'10011010', 'C':'0101', 'D':'0001', 'E':'110', 'F':'01001', 'G':'10011011', 'H':'010000', 'I':'0111', 'J':'10011000', 'K':'0110', 'L':'00100', 'M':'10011001', 'N':'10011110', 'O':'00101', 'P':'111', 'Q':'10011111', 'R':'1000', 'S':'00110', 'T':'00111', 'U':'10011100', 'V':'10011101', 'W':'000010', 'X':'10010010', 'Y':'10010011', 'X':'10010000'}
decode = {'00000':'A', '00001':'B', '00010':'C', '00011':'D', '00100':'E','00101':'F','00110':'G','00111':'H','01000':'I','01001':'J','01010':'K','01011':'L','01100':'M','01101':'N','01110':'O','01111':'P','10000':'Q','10001':'R','10010':'S','10011':'T','10100':'U','10101':'V','10110':'W','10111':'X','11000':'Y','11001':'Z','11010':' ','11011':'.','11100':',','11101':'-','11110':'\'','11111':'?'}
while True:
try:
string = list(raw_input().replace("\n", ""))
# encode
code = ""
for s in string:
code += encode[s]
i = 0
tmp = []
while i+5 <= len(code):
tmp.append(code[i:i+5])
code = code[i+5:]
if len(code) != 0:
code += '0' * (5 - len(code))
tmp.append(code)
# decode
ans = ""
for s in tmp:
ans += decode[s]
print ans
except EOFError:
break |
s905729364 | p00088 | u193025715 | 1396170676 | Python | Python | py | Runtime Error | 0 | 0 | 1253 | encode = {' ':'101', '\'':'000000', ',':'000011', '-':'1001000', '.':'010001', '?':'000001', 'A':'100101', 'B':'10011010', 'C':'0101', 'D':'0001', 'E':'110', 'F':'01001', 'G':'10011011', 'H':'010000', 'I':'0111', 'J':'10011000', 'K':'0110', 'L':'00100', 'M':'10011001', 'N':'10011110', 'O':'00101', 'P':'111', 'Q':'10011111', 'R':'1000', 'S':'00110', 'T':'00111', 'U':'10011100', 'V':'10011101', 'W':'000010', 'X':'10010010', 'Y':'10010011', 'X':'10010000'}
decode = {'00000':'A', '00001':'B', '00010':'C', '00011':'D', '00100':'E','00101':'F','00110':'G','00111':'H','01000':'I','01001':'J','01010':'K','01011':'L','01100':'M','01101':'N','01110':'O','01111':'P','10000':'Q','10001':'R','10010':'S','10011':'T','10100':'U','10101':'V','10110':'W','10111':'X','11000':'Y','11001':'Z','11010':' ','11011':'.','11100':',','11101':'-','11110':'\'','11111':'?'}
while True:
try:
string = list(raw_input().replace("\n", ""))
# encode
code = ""
for s in string:
code += encode[s]
i = 0
tmp = []
while i+5 <= len(code):
tmp.append(code[i:i+5])
code = code[i+5:]
if len(code) != 0:
code += '0' * (5 - len(code))
tmp.append(code)
# decode
ans = ""
for s in tmp:
ans += decode[s]
print ans
except EOFError:
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.