Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k = int(input())
 
def gcd2(a,b):
    if b == 0:
        return a
    return gcd2(b,a%b)

def gcd3(a,b,c):
    return gcd2(gcd2(a,b), c)

ans = 0
for a in range(1,k+1):
    for b in range(i,k+1):
        for c in range(j, k+1):
            if a == b == c:
                ans += gcd3(a,b,c)
            elif a == b or b == c:
                ans += gcd3(a,b,c)*3
            else:
                ans += gcd3(a,b,c)*6

print(ans)

Fixed submission:
n=int(input())+1
import math
ans=0
for i in range(1,n):
    ans+=n-i
    for j in range(i+1,n):
        p=math.gcd(n-i,n-j)
        ans+=p*6
        for k in range(j+1,n):
            ans+=math.gcd(p,n-k)*6
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
  while b:a,b=b,a%b
  return a
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
      ans+=gcd(i,gcd(j,k))
print(ans)


Fixed submission:
n=int(input())+1
import math
ans=0
for i in range(1,n):
    ans+=n-i
    for j in range(i+1,n):
        p=math.gcd(n-i,n-j)
        ans+=p*6
        for k in range(j+1,n):
            ans+=math.gcd(p,n-k)*6
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
  while b:a,b=b,a%b
  return a
k=int(input())
ans=0
for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
      p=gcd(i,j)
      ans+=gcd(p,k)
print(ans)

Fixed submission:
n=int(input())+1
import math
ans=0
for i in range(1,n):
    ans+=n-i
    for j in range(i+1,n):
        p=math.gcd(n-i,n-j)
        ans+=p*6
        for k in range(j+1,n):
            ans+=math.gcd(p,n-k)*6
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
ans=0
import math
for i in range(1,k+1):
  for j in range(1,k+1):
    for k in range(1,k+1):
      p=math.gcd(i,j)
      ans+=math.gcd(p,k)
print(ans)

Fixed submission:
n=int(input())+1
import math
ans=0
for i in range(1,n):
    ans+=n-i
    for j in range(i+1,n):
        p=math.gcd(n-i,n-j)
        ans+=p*6
        for k in range(j+1,n):
            ans+=math.gcd(p,n-k)*6
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg,ans=0,0,0
for i in range(a+b+c):
    if cntr<x and (s[i] in set(p) or s[i] in set(r)):
        ans+=s[i]
        cntr+=1
    elif cntg<y and (s[i] in set(q) or s[i] in set(r)):
        ans+=s[i]
        cntg+=1
print(ans)

Fixed submission:
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg,ans=0,0,0
for i in range(a+b+c):
    if cntr!=x and (s[i] in set(p) or s[i] in set(r)):
        ans+=s[i]
        cntr+=1
    elif cntg!=y and ( s[i] in set(q) or s[i] in set(r)):
        ans+=s[i]
        cntg+=1
print(ans)

Fixed submission:
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg,ans=0,0,0
for i in range(a+b+c):
    if cntr!=x and (s[i] in p or s[i] in r):
        ans+=s[i]
        cntr+=1
    elif cntg!=y and ( s[i] in q or s[i] in r):
        ans+=s[i]
        cntg+=1
print(ans)

Fixed submission:
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg=0,0
ans=0
for i in range(a+b+c):
    if cntr!="f" and (s[i] in p or s[i] in r):
        ans+=s[i]
        cntr+=1
    elif cntg!="f" and ( s[i] in q or s[i] in r):
        ans+=s[i]
        cntg+=1
    if cntr==x:
        cntr="f"
    if cntg==y:
        cntg="f"
print(ans)

Fixed submission:
x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
n,m=map(int,input().split())
if n==0 or n==1:
    print(cmb(m,2))
    quit()
elif m==0 or m==1:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(m,2))

Fixed submission:
n,m=map(int,input().split())
print((n*(n-1))//2+(m*(m-1))//2)

Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
n,m=map(int,input().split())
if n<2 and m<2:
    print(0)
    quit()
if n==0:
    print(cmb(m,2))
    quit()
elif m==0:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(m,2))

Fixed submission:
n,m=map(int,input().split())
print((n*(n-1))//2+(m*(m-1))//2)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s=["b"]*a+["r"]*b 
rupu= n//len(s)
amari=n%len(s)
if amari>a :
    print(rupu*a+a)
else:
    print(rupu*a+amari)

Fixed submission:
n,a,b=map(int,input().split())
rupu= n//(a+b)
amari=n%(a+b)
if amari>a :
    print(rupu*a+a)
else:
    print(rupu*a+amari)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int,input().split()))
s=[]
ans=0
for i in range(n):
    s.append(p[i])
    if min(s)==p[i]:
        ans+=1
print(ans)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans=0
mins=p[0]
for i in range(1,n):
    if mins>p[i]:
        ans+=1
        mins=p[i]
print(ans+1)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
WA,wa,ac=0,0,0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if i>0 and p!=before:
        wa=0
    if s=="WA":
        wa+=1
    elif s=="AC" and p==before:
        WA+=wa
        ac+=1
    before=p
print(ac,WA)

Fixed submission:
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
WA=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
            WA+=was[p-1]
        else:
            was[p-1]+=1
print(sum(acs),WA)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
wa,ac=0,0
ac_number,last_wa=0,0
for i in range(m):
    p,s=input().split()
    if s=="WA":
        wa+=1
        wa_number=int(p)
    elif s=="AC" and ac_number!=int(p): #ac_numberは最後にacした問題の番号
        ac+=1
        ac_number=int(p)
    if wa_number==ac_number:
        last_wa+=wa
print(ac,last_wa)

Fixed submission:
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
WA=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
            WA+=was[p-1]
        else:
            was[p-1]+=1
print(sum(acs),WA)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
lip,lis=[],[]
old=0
ansa=0
wa=0
for i in range(1,m):
    p,s=input().split()
    lip.append(p)
    lis.append(s)
    if len(lip)==1:
        if s=="AC": #1問目がACの時
            ansa+=1
            old=lip[0]
        else:
            wa+=1
    elif old!=p:
        if s=="AC":#その問題で初めてのAC
            ansa+=1
            old=p #最後のACの問題番号 = old
            ansb=wa #その問題のペナが反映
        else:
            wa+=1
    else:
        wa=0
print(ansa,ansb)

Fixed submission:
n,m=map(int,input().split())
acs=[0]*n
was=[0]*n
WA=0
for i in range(m):
    p,s=input().split()
    p=int(p)
    if acs[p-1]==0:
        if s=="AC":
            acs[p-1]=1
            WA+=was[p-1]
        else:
            was[p-1]+=1
print(sum(acs),WA)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    else:
        b-=1
l=[]
l.append(a)
l.append(b)
print(' '.join(map(str, l)))

Fixed submission:
a,b,k=map(int,input().split())
if a-k<1:
    if b-(k-a)>=1: 
        print(0,b-(k-a))
    else:
        print(0,0)
else:
    print(a-k,b)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif b>=1:
        b-=1
l=[]
l.append(a)
l.append(b)
print(' '.join(map(str, l)))

Fixed submission:
a,b,k=map(int,input().split())
if a-k<1:
    if b-(k-a)>=1: 
        print(0,b-(k-a))
    else:
        print(0,0)
else:
    print(a-k,b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
w = list(map(int,input().split()))
sum_w=sum(w)
sum_a=0
sa=[]
for i in range(n):
    sum_a += w[i]
    sa.append(abs(sum_w - sum_a * 2))
print(min(sa))

Fixed submission:
s=input()
i=0
a=0
for i in range(len(s)//2):
    if s[0+i]!=s[len(s)-1-i]:
        a+=1
    i+=0
print(a)
Buggy python submission (verdict: Runtime Error):
m,d=map(int,input().split())
a,b=map(int,input().split())
if a=m+1:
    print("1")
else:
    print("0")

Fixed submission:
m,d=map(int,input().split())
a,b=map(int,input().split())
if a==m+1:
    print("1")
else:
    print("0")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(1,n+1):
    if n%i==0:
        a.append(n//i+i-2)
print(a[len(a)//2-1])

Fixed submission:
n=int(input())
i=0
s=[]
p=0
for i in range(int(n**0.5)):
    i+=1
    if n%i==0:
        p=1
        s.append(n//i+i-2)
print(min(s))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(1,n+1):
    if n%i==0:
        a.append(n//i+i-2)
print(min(a))

Fixed submission:
n=int(input())
i=0
s=[]
p=0
for i in range(int(n**0.5)):
    i+=1
    if n%i==0:
        p=1
        s.append(n//i+i-2)
print(min(s))

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
for i in range(a):
	p=a//(i+1)
	if (i+1)>=p and a%(i+1)==0:
		break
print(i+p-1)

Fixed submission:
n=int(input())
i=0
s=[]
p=0
for i in range(int(n**0.5)):
    i+=1
    if n%i==0:
        p=1
        s.append(n//i+i-2)
print(min(s))

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
for i in range(a):
    if a%(i+1)==0:
        p=a//(i+1)
        if (i+1)>=p:
            break
print(i+p-1)

Fixed submission:
n=int(input())
i=0
s=[]
p=0
for i in range(int(n**0.5)):
    i+=1
    if n%i==0:
        p=1
        s.append(n//i+i-2)
print(min(s))
Buggy python submission (verdict: Runtime Error):
n= int(input())
a=list(map(int, input().split()))
for i in range(n):
    print(li2[i]+1,end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=["0"]*n
for i in range(n):
    ans[a[i]-1]=str(i+1)
print(" ".join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
a=list(map(int, input().split()))
b=[]
for i in range(n):
    print(a.index(i+1)+1,end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=["0"]*n
for i in range(n):
    ans[a[i]-1]=str(i+1)
print(" ".join(ans))
Buggy python submission (verdict: Runtime Error):
k=int(input())
x=int(input())
for i in range (x-k+1,x+k):
    print(i, end="")

Fixed submission:
k,x=map(int,input().split())
for i in range (x-k+1,x+k):
    print(i, end=" ")

Buggy python submission (verdict: Runtime Error):
k=int(input())
x=int(input())
for i in range (x-k+1,x+k-1):
    print(i, end="")

Fixed submission:
k,x=map(int,input().split())
for i in range (x-k+1,x+k):
    print(i, end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    s=input()
    s=sorted(s)
    a.append("".join(s))
ans=0
for i in range(len(a)):
    for j in range(i+1,len(a)):
        if a[i]==a[j]:
            ans+=1
print(ans)


Fixed submission:
n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    s=input()
    s=sorted(s)
    a.append("".join(s))
ans=0
for i in range(len(a)):
    for j in range(i+1,len(a)):
        if a[i]==a[j]:
            ans+=1
print(ans)

Fixed submission:
n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n=int(input())
S=[]
ans=0
for i in range(n):
    s=input()
    S.append(s)
    for j in range(i):
        if Counter(S[j])==Counter(s):
            ans+=1
print(ans)


Fixed submission:
n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n=int(input())
S=[]
ans=0
for i in range(n):
    s=input()
    S.append(s)
    for j in range(i):
        if Counter(S[j])==Counter(s):
            ans+=1
print(ans)

Fixed submission:
n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

n=int(input())
S=[]
ans=0
for i in range(n):
    s=input()
    S.append(s)
for i in range(n):
    for j in range(n-i-1):
        if Counter(S[j+i+1]) == Counter(S[i]):
            ans+=1
print(ans)

Fixed submission:
n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
m=str(n)
minus1=10**(len(m)-2)*9
minus=minus1
if len(m)==1:
    print(n)
if len(m)%2==0:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
        print(minus1)
else:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i)
        print(minus1//10+n-10**(len(m)-1))

Fixed submission:
n=int(input())
m=str(n)
minus1=10**(len(m)-2)*9
minus=minus1
if len(m)==1:
    print(n)
elif len(m)%2==0:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1)
else:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1//10+n-10**(len(m)-1)+1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        h[i]-=1
    print(h)
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(1,n-1):
    if h[i]>h[i+1] or h[i]>h[i-1]:
        h[i]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
n,p=map(int,input().split())
if n%(2p+1)==0:
    print(n//(2p+1))
else:
    print(n//(2p+1)+1)

Fixed submission:
n,p=map(int,input().split())
if n%(2*p+1)==0:
    print(n//(2*p+1))
else:
    print(n//(2*p+1)+1)
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<x:
    print(len(l))
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l)+1)
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<x:
    print(len(l))
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
        print(i)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l)+1)
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)

Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
while suml<=x:
    suml=suml+l[i]
    i=i+1
print(i)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
i=0
suml=0
if sum(l)<=x:
    print(len(l)+1)
else:
    while suml<=x:
        suml=suml+l[i]
        i=i+1
    print(i)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print(s)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print("".join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count("AC"))

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0]*n
ac=0
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        ac+=1
    a[i]=ac
for i in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    print(s[l-1:r].count("AC"))                                                              

Fixed submission:
n,q=map(int,input().split())
s=input()
a=[0]*n
ac=0
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        ac+=1
    a[i]=ac
for i in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=0
R=n
for i in range(m):
    l,r=map(int,input().split())
    if l>L:
        L=l
    if r<R:
        R=r
if R-L<0:
    print(0)
else:
    print(R-L)

Fixed submission:
n,m=map(int,input().split())
s=[]
for i in range(n):
    a,b=map(int,input().split())
    #n店舗、a値段、b本数
    s.append([a,b])
s.sort()
ans=0
i=0
while m-s[i][1]>0:
    m-=s[i][1]
    ans+=s[i][0]*s[i][1] #値段
    i+=1
print(ans+s[i][0]*m)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for i in range(n):
    x,u=map(int,input().split())
    if x[i]=="BTC":
        ans += u[i]*380000.0
    else:
        ans += u[i]
print(ans)


Fixed submission:
n=int(input())
ans=0.0
for i in range(n):
    x,u=input().split()
    if u=="BTC":
        ans += float(x)*380000.0
    else:
        ans += float(x)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
while len(a)>1:
    s=min(a)
    a = list(map(lambda x:x-min(a), a))
    a = [i for i in a if i != 0]+[s]
print(int(a))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
amin=min(a)
while len(a)>1:
    s=min(a)
    a = list(map(lambda x:x%s, a))
    a = [i for i in a if i > 0]+[s]
print(a[0])
Buggy python submission (verdict: Runtime Error):
n=int(input())
count=0
for i in range(4):
    if n[i]==2:
        count+=1
print(count)


Fixed submission:
n=input()
count=0
for i in range(4):
    if n[i]=="2":
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n=int(inout())
count=0
for i in range(4):
    if n[i]==2:
        count+=1
print(count)

Fixed submission:
n=input()
count=0
for i in range(4):
    if n[i]=="2":
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
sa=[]
ans=[]
for i in range(n):
    h=int(input())
    l.append(h)
l.sort()
for i in range(1,n):
    sa.append(abs(l[i]-l[i-1]))
for i in range(k-1):
    ans.append(sa[i+k-2]+sa[i])
print(min(ans))

Fixed submission:
n,k=map(int,input().split())
l=[]
sa=[]
for i in range(n):
    h=int(input())
    l.append(h)
l.sort()
for i in range(n-k+1):
    sa.append(l[i+k-1]-l[i])
print(min(sa))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
sa=[]
ans=[]
for i in range(n):
    h=int(input())
    l.append(h)
for i in range(1,n):
    sa.append(l[i]-[i-1])
sa.sort()
sa.reverse()
for i in range(k-1):
    ans.append(sa[i])
print(min(ans))

Fixed submission:
n,k=map(int,input().split())
l=[]
sa=[]
for i in range(n):
    h=int(input())
    l.append(h)
l.sort()
for i in range(n-k+1):
    sa.append(l[i+k-1]-l[i])
print(min(sa))
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x==7 or x==5 or x==3:
    print(YES)
else:
    print(NO)

Fixed submission:
x=int(input())
if x==7 or x==5 or x==3:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())
print((A-1)*(B-1))

Fixed submission:
A,B=map(int,input().split())
print((A-1)*(B-1))
Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())
ans=0
for i in range(len(s)):
    if s[i]!=1:
        ans=s[i]
        break
    else:
        bns+=1
if k<=bns:
    print(1)
else:
    print(ans)

Fixed submission:
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int(input().split()))
if n%k==0:
    print(0)
else:
    print(1)

Fixed submission:
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
N,K(int,input().split())
print(N%K)

Fixed submission:
n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
R=int(input())
if R<1200:
    print(ABC)
elif R<2800:
    print(ARC)
else:
    print(AGC)


Fixed submission:
R=int(input())
if R<1200:
    print("ABC")
elif R<2800:
    print("ARC")
else:
    print("AGC")
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
for i in range(len(s)):
    if [:i]+[i:]==t:
        ans=0
    else:
        ans=1
        break
if ans==0:
    print("Yes")
else:
    print("No")

Fixed submission:
s=input()
t=input()
for i in range(len(s)):
    if s[i:]+s[:i]!=t:
        ans=0
    else:
        ans=1
        break
if ans==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=0
for i in range(len(a)):
    a+=str(n)[i]
if n%a==0:
    print("Yes")
else:
    print("No")

Fixed submission:
n=int(input())
a=0
for i in range(len(str(n))):
    a+=int(str(n)[i])
if n % a== 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
d,n = map(int,input().split())
if n==100:
    ans=100 ** d * (i+2)
else:
    for i in range (n):
    ans=100 ** d * (i+1)
print(ans)

Fixed submission:
d,n = map(int,input().split())
for i in range (n):
    ans=100 ** d * (i+1)
if n==100:
    ans+=100 ** d
print(ans)