Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int, input().split())
exp=list(map(lambda x:(int(x)+1)/2,input().split())) # 入力と同時に期待値計算

l=np.cumsum(exp) # 累積和の計算

ans=l[k-1]
for i in range(n-k):
    ans=max(ans,l[i+k]-l[i])
    
print(ans)

Fixed submission:
import numpy as np
n,k=map(int, input().split())
exp=list(map(lambda x:(int(x)+1)/2,input().split())) # 入力と同時に期待値計算

l=np.cumsum(exp) # 累積和の計算

ans=l[k-1]
for i in range(n-k):
    ans=max(ans,l[i+k]-l[i])
    
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int, input().split())
exp=list(map(lambda x:(int(x)+1)/2,input().split())) # 入力と同時に期待値計算

l=np.cumsum(exp) # 累積和の計算

ans=l[k-1]
for i in range(n-k):
    ans=max(ans,l[i+k]-l[i])
    
print(ans)

Fixed submission:
import numpy as np
n,k=map(int, input().split())
exp=list(map(lambda x:(int(x)+1)/2,input().split())) # 入力と同時に期待値計算

l=np.cumsum(exp) # 累積和の計算

ans=l[k-1]
for i in range(n-k):
    ans=max(ans,l[i+k]-l[i])
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
pl=list(map(int,input().split()))
m=0
for i in range(n-k+1):
    m=max(m,sum(pl[i:i+k]))
print((m+k)/2)

Fixed submission:
import numpy as np
n,k=map(int, input().split())
exp=list(map(lambda x:(int(x)+1)/2,input().split())) # 入力と同時に期待値計算

l=np.cumsum(exp) # 累積和の計算

ans=l[k-1]
for i in range(n-k):
    ans=max(ans,l[i+k]-l[i])
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
list2=[i for i in list1 if i<=list1[0]]
ln=[list1[0]]
for i in list2:
    if min(ln)>=i:
        ln.append(i)
print(len(ln)-1)

Fixed submission:
n=int(input())
list1=list(map(int,input().split()))
mi=list1[0]
c=0
for i in list1:
    if mi>=i:
        mi=i
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
list2=[i for i in list1 if i<=list1[0]]
ln=[list1[0]]
for i in list1:
    if min(ln)>=i:
        ln.append(i)
print(len(ln)-1)

Fixed submission:
n=int(input())
list1=list(map(int,input().split()))
mi=list1[0]
c=0
for i in list1:
    if mi>=i:
        mi=i
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
ln=[list1[0]]
for i in list1:
    if min(ln)>=i:
        ln.append(i)
print(len(ln)-1)

Fixed submission:
n=int(input())
list1=list(map(int,input().split()))
mi=list1[0]
c=0
for i in list1:
    if mi>=i:
        mi=i
        c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
list1=list(map(int,input().split()))
ln=[list1[0]]
c=0
for i in list1:
    if min(ln)>=i:
        c+=1
    ln.append(i)
print(c)

Fixed submission:
n=int(input())
list1=list(map(int,input().split()))
mi=list1[0]
c=0
for i in list1:
    if mi>=i:
        mi=i
        c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
an=[int(i) for i in input().split()]
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
p = 10 ** 9 + 7
N = 10 ** 5
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

an=sorted(an)
r_an=list(reversed(an))

max1=0
min1=0
for i in range(1,n-k+2):
    c=cmb(n-i,k-1,mod)
    max1=max1 + an[-i]*c%p
    min1=min1 + r_an[-i]*c%p
print((max1-min1)%p)

Fixed submission:
from collections import deque

h,w=map(int, input().split())
S = [input() for _ in range(h)]

move=((1,0),(-1,0),(0,1),(0,-1))

def bfs(i,j): # 幅優先探索、マス i,j から始まる時の最長経路
    if S[i][j] == '#': # そのマスが壁ならスタート地点にならないのでパス
        return 0
    
    visited=[[0]*w for _ in range(h)] # 探索済のリスト
    visited[i][j]=1 # 最初のマスは探索済へ
    
    que=deque([(i,j,0)]) # キューの作成（queueは待ち行列）
    
    while len(que)>0:
        ci,cj,d = que.popleft() #キューの左側から取り出してキューから削除

        for mi,mj in move: #moveで定義したそれぞれの動きについて
            ni,nj = ci+mi,cj+mj # 移動先の座標をni,njとしている。
            if 0 <= ni < h and 0 <= nj < w and visited[ni][nj]==0:
                if S[ni][nj] == '.':
                    visited[ni][nj] = 1
                    que.append((ni, nj, d+1))
    return d
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, bfs(i, j))
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
an=[int(i)//2 for i in input().split()]
ma=max(an)
count=0
q=1
mk=0
while m>=ma*q:
    for ak in an:
        if (ma*q)%ak==0 and ((ma*q)//ak)%2==1:
            mk=ma*q
        else:
            break
    q+=2
    if mk!=0
        break
print(m//mk)

Fixed submission:
n,m=map(int, input().split())
an=[int(i) for i in input().split()]
import fractions
ans=an[0]
for i in range(1, n):
    ans = ans * an[i] // fractions.gcd(ans, an[i])

def count2(i):
    if i%2==0:
        c=0
        while i%2==0:
            i//=2
            c+=1
        return c
    else:
        return 0
    
c2=count2(ans)

for ak in an:
    if ak%(2**c2)==0:
        d=1
        pass
    else:
        d=0
        break

if d==0:
    print(0)
else:
    lca=ans//2
    if (m//lca)%2==0:
        print((m//lca)//2)
    else:
        print(((m//lca)+1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
an=[int(i)//2 for i in input().split()]
ma=max(an)
count=0
q=1
while m>=ma*q:
    for ak in an:
        if (ma*q)%ak==0 and ((ma*q)//ak)%2==1:
            plus=1
        else:
            plus=0
            break
    q+=2
    if plus==1:
        count+=1
print(count)

Fixed submission:
n,m=map(int, input().split())
an=[int(i) for i in input().split()]
import fractions
ans=an[0]
for i in range(1, n):
    ans = ans * an[i] // fractions.gcd(ans, an[i])

def count2(i):
    if i%2==0:
        c=0
        while i%2==0:
            i//=2
            c+=1
        return c
    else:
        return 0
    
c2=count2(ans)

for ak in an:
    if ak%(2**c2)==0:
        d=1
        pass
    else:
        d=0
        break

if d==0:
    print(0)
else:
    lca=ans//2
    if (m//lca)%2==0:
        print((m//lca)//2)
    else:
        print(((m//lca)+1)//2)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()

dp=[0]*n
a = {"r":p, "s":r, "p":s}

for i in range(n):
    if i>=k and t[i]==t[i-k]: # どうせ得点できないので、次に影響しないように'x'
        dp[i]=0
        t[i]='x'
    else:
        dp[i]=d[t[i]]   
print(sum(dp))

Fixed submission:
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())

dp=[0]*n
a = {"r":p, "s":r, "p":s}

for i in range(n):
    if i>=k and t[i]==t[i-k]: # どうせ得点できないので、次に影響しないように'x'
        dp[i]=0
        t[i]='x'
    else:
        dp[i]=a[t[i]]   
print(sum(dp))
Buggy python submission (verdict: Runtime Error):
import fractions
a,b=map(int, input().split())
f2=a*b//f # 最小公倍数はf2
print(f2)

Fixed submission:
a, b = map(int, input().split())
m,n=max(a,b),min(a,b)
if m%n==0:
    print(m)
else:
    while m%n!=0 and n!=1:
        m%=n
        m,n=max(m,n),min(m,n)
    print(int(a*b/n))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
m,n=max(a,b),min(m,n)
while m%n!=0:
    m%=n
    m,n=max(m,n),min(m,n)
print(int(a*b/n))

Fixed submission:
a, b = map(int, input().split())
m,n=max(a,b),min(a,b)
if m%n==0:
    print(m)
else:
    while m%n!=0 and n!=1:
        m%=n
        m,n=max(m,n),min(m,n)
    print(int(a*b/n))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())

print(int(a*b/math.gcd(a,b)))

Fixed submission:
a, b = map(int, input().split())
m,n=max(a,b),min(a,b)
if m%n==0:
    print(m)
else:
    while m%n!=0 and n!=1:
        m%=n
        m,n=max(m,n),min(m,n)
    print(int(a*b/n))
Buggy python submission (verdict: Runtime Error):
from collections import deque

H,W=map(int,input().split())
S=[input() for _ in range(H)]

paint=((1,0),(-1,0),(0,1),(0,-1))
que=deque([])

dark=[[0]*W for _ in range(H)] # 1が黒、0はまだ白

for i in range(H): # 初期化(最初に黒いマスをdarkリストに入れて、キューに入れる。)
    for j in range(W):
        if S[i][j]=='#':
            que.append((i,j,0))
            dark[i][j]=1

while len(que)>0:
    di,dj,c=que.popleft()
    
    for pi,pj in paint:
        ni,nj=pi+di,pj+dj # 移動先がni,nj
        if 0<=ni<H and 0<=nj<W and dark[ni][nj]==0:
            dark[ni][nj]=1
            que.append((ni,nj,c+1))
            ans=c+1
print(ans)

Fixed submission:
from collections import deque

H,W=map(int,input().split())
S=[input() for _ in range(H)]

paint=((1,0),(-1,0),(0,1),(0,-1))
que=deque([])

dark=[[0]*W for _ in range(H)] # 1が黒、0はまだ白

for i in range(H): # 初期化(最初に黒いマスをdarkリストに入れて、キューに入れる。)
    for j in range(W):
        if S[i][j]=='#':
            que.append((i,j,0))
            dark[i][j]=1
ans=0
while len(que)>0:
    di,dj,c=que.popleft()
    
    for pi,pj in paint:
        ni,nj=pi+di,pj+dj # 移動先がni,nj
        if 0<=ni<H and 0<=nj<W and dark[ni][nj]==0:
            dark[ni][nj]=1
            que.append((ni,nj,c+1))
            ans=c+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[0]
for i in range(1,n): # dp[i]の最小を決めていく。
    dpi=float('inf')
    for j in range(1,k+1):
        if i<j:
            break
        else:
            dpi=min(dp[i-j]+abs(h[i]-h[i-j]),dpi)
    dp.append(dpi)
print(dp[-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[0]
for i in range(1,n): # dp[i]の最小を決めていく。
    dpi=float('inf')
    for j in range(1,k+1):
        if i<j:
            break
        else:
            dpi=min(dp[i-j]+abs(h[i]-h[i-j]),dpi)
    dp.append(dpi)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[float('inf')]*n # とりあえず配列の要素はinf にしておく
dp[0]=0 # はじめは 0 に変えておく
for i in range(1,n): # dp[i]の最小を決めていく。
    for j in range(1,k+1):
        if i<j:
            break
        else:
            dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i])
print(dp[-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[0]
for i in range(1,n): # dp[i]の最小を決めていく。
    dpi=float('inf')
    for j in range(1,k+1):
        if i<j:
            break
        else:
            dpi=min(dp[i-j]+abs(h[i]-h[i-j]),dpi)
    dp.append(dpi)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
abc = [list(map(int, input().split())) for i in range(N)]
a,b,c=abc[0][0],abc[0][1],abc[0][2]
for i in range(1,n):
    a,b,c = abc[i][0]+max(b,c),abc[i][1]+max(a,c),abc[i][2]+max(a,b)
print(max(a,b,c))

Fixed submission:
n = int(input())
abc = [list(map(int, input().split())) for i in range(n)]
a,b,c=abc[0][0],abc[0][1],abc[0][2]
for i in range(1,n):
    a,b,c = abc[i][0]+max(b,c),abc[i][1]+max(a,c),abc[i][2]+max(a,b)
print(max(a,b,c))
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
list1=[list(map(int,input().split())) for i in range(N)]

dp=[[0 for i in range(W+1)] for j in range(N+1)] # dpリストを作る。dpの要素の数字は価値を表す。

for i in range(N): # １つ１つの商品について
    for w in range(W+1):
        if w>=list1[i][0]:# 重さ的に選ぶことができる
            dp[i+1][w]=max(dp[i][w],dp[i][w-list1[i][0]]+list1[i][1])
        else: # 重さ的に選べないので一個前のiのときのがそのまま
            dp[i+1][w]=dp[i][w]
print(dp[-1][-1])

Fixed submission:
N,W=map(int,input().split())
list1=[list(map(int,input().split())) for i in range(N)]

dp=[float('inf')]*100001 # dpリストを作る。
# dp[i]は、価値の総和がiになる時の質量の総和の最小。
dp[0]=0

for i in range(N): # １つ１つの商品について
    for j in range(100000,list1[i][1]-1,-1):
        dp[j]=min(dp[j],dp[j-list1[i][1]]+list1[i][0])

for i in range(100000,-1,-1):
    if dp[i]<=W:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
zS=input()
T=input()
ls=len(S)
lt=len(T)

ans='UNRESTORABLE'

if ls<lt:
    print(ans)
    exit()
for i in range(ls-lt,-1,-1):
    c=0
    for j in range(lt):
        if T[j]==S[i+j] or S[i+j]=='?':
            continue
        else:
            c=1
            break
    if c==0:
        ans=S.replace('?','a')
        ans=ans[:i] + T + ans[i+lt+1:]
        break
print(ans)


Fixed submission:
s_prime=list(input())
t=list(input())
ls=len(s_prime)
lt=len(t)
s_prime.reverse()
t.reverse()


if lt>ls:
    print('UNRESTORABLE')
else:
    def check(t,s):
        l=len(t)
        c=0
        for i in range(l):
            if s[i]!='?' and s[i]!=t[i]:
                c=1
        return True if c==0 else False
    c=0            
    for i in range(ls-lt+1):
        print()
        if check(t,s_prime[i:i+lt])==1:
            t_in=s_prime[:i]+t+s_prime[i+lt:] 
            for k in range(ls):
                if t_in[k]=='?':
                    t_in[k]='a'
            t_in.reverse()   
            print(''.join(t_in))
            c=1
            break
    print('UNRESTORABLE') if c==0 else exit()

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
ls=len(S)
lt=len(T)

ans='UNRESTORABLE'

if ls<lt:
    print(ans)
    exit()
for i in range(ls-lt,0,-1):
    c=0
    for j in range(lt):
        if T[j]==S[i+j] or S[i+j]=='?':
            continue
        else:
            c=1
            break
    if c==0:
        ans=S.replace('?','a')
        ans=ans[:i] +z T + ans[i+lt:]
print(ans)


Fixed submission:
s_prime=list(input())
t=list(input())
ls=len(s_prime)
lt=len(t)
s_prime.reverse()
t.reverse()


if lt>ls:
    print('UNRESTORABLE')
else:
    def check(t,s):
        l=len(t)
        c=0
        for i in range(l):
            if s[i]!='?' and s[i]!=t[i]:
                c=1
        return True if c==0 else False
    c=0            
    for i in range(ls-lt+1):
        print()
        if check(t,s_prime[i:i+lt])==1:
            t_in=s_prime[:i]+t+s_prime[i+lt:] 
            for k in range(ls):
                if t_in[k]=='?':
                    t_in[k]='a'
            t_in.reverse()   
            print(''.join(t_in))
            c=1
            break
    print('UNRESTORABLE') if c==0 else exit()
Buggy python submission (verdict: Runtime Error):
from math import gcd 
N = int(input())
i = 0
 
for a in range(1, N+1):
    for b in range(1, N+1):
        for c in range(1, N+1):
            i += gcd(a, b, c)
            
print(i)


Fixed submission:
from math import gcd 
N = int(input())
i = 0
 
for a in range(1, N+1):
    for b in range(1, N+1):
        for c in range(1, N+1):
            i += gcd(gcd(a, b), c)
            
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import time
n,m=map(int,input().split())
if m>0:
  time.sleep(2.1)
else:
  if n==1:
    print(0)
  elif n==2:
    print(10)
  elif(n==3):
    print(100)

Fixed submission:
n,m=map(int,input().split())
s=[]
t=[]
for i in range(m):
  u,v=input().split()
  s.append(int(u)-1)
  t.append(v)
ans=-1
for i in range(1000):
  x=str(i)
  if len(x)!=n:
    continue
  flag=True
  for j in range(m):
    if x[s[j]] != t[j]:
      flag = False
  if flag:
    ans=i
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
from fraction import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=gcd(b,i)
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
t=1
for i in a:
  t=t/gcd(t,i)*i
ans=0
MOD=1000000007
for i in a:
  ans+=t//i
  ans%=MOD
print(int(ans+0.0000001))


Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
t=1
for i in a:
  t=t/gcd(t,i)*i
ans=0
MOD=1000000007
for i in a:
  ans+=t//i
  ans%=MOD
print(int(ans+0.0000001))


Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
from fraction import gcd
n=int(input())
a=list(map(int,input().split()))
t=1
for i in a:
  t=t/gcd(t,i)*i
ans=0
MOD=1000000007
for i in a:
  ans+=t/i
  ans%=MOD
print(ans)


Fixed submission:
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=1
for i in a:
  b=b//gcd(b,i)*i
ans=0
for i in a:
  ans+=(b//i)
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
seq = [-int(input()) for i in range(N)] 
LIS = [seq[0]]
for i in range(1,len(seq)):
    if seq[i] > LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_right(LIS, seq[i])] = seq[i]
print(len(LIS))

Fixed submission:
import bisect
N = int(input())
seq = [-int(input()) for i in range(N)] 
LIS = [seq[0]]
for i in range(1,len(seq)):
    if seq[i] >= LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_right(LIS, seq[i])] = seq[i]
print(len(LIS))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input()split())
dp=[1]*(n+1)
for i in range(m):
  dp[int(input())]=0
for i in range(2,n+1):
  if dp[i]>0:
    dp[i]=dp[i-1]+dp[i-2]
print(dp[n])

Fixed submission:
n,m=map(int,input().split())
dp=[1]*(n+1)
for i in range(m):
  dp[int(input())]=0
for i in range(2,n+1):
  if dp[i]>0:
    dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%1000000007)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
ans=[0]*(n+1)
for i in range(n):
  for j in range(m):
    if a[i][j]==".":
      ans[j+1]+=ans[j]
    else :
      ans[j+1]=0
print(ans[m])

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
ans=[0]*(m+1)
ans[1]=1
for i in range(n):
  for j in range(m):
    if a[i][j]==".":
      ans[j+1]+=ans[j]
      ans[j+1]%=1000000007
    else :
      ans[j+1]=0
print(ans[m])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=1000000007
dp=[[0]*(k+1) for i in range(n+1)] 
dp[0][0]=1
for i in range(n):
  sm=0
  for j in range(k+1):
    sm+=dp[i][j]
    sm%=mod
    dp[i+1][j]=sm
    if j>=a[i]:
      sm-=dp[i][j-a[i]]
      sm=(sm+mod)%mod
print(dp[n][k])

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=1000000007
dp=[[0]*(k+1) for i in range(n+1)] 
dp[0][0]=1
for i in range(n):
  sm=0
  for j in range(k+1):
    sm+=dp[i][j]
    sm%=mod
    dp[i+1][j]=sm
    if j>=a[i]:
      sm-=dp[i][j-a[i]]
      sm=(sm+mod)%mod
print(dp[n][k])
Buggy python submission (verdict: Runtime Error):
a,b,c=int(input().split())
print(b+min(a+b+1,c))

Fixed submission:
a,b,c=map(int,input().split())
print(b+min(a+b+1,c))
Buggy python submission (verdict: Runtime Error):
s=input()
c=0
a=0
for i in s:
  if i=='B':
    c+=1
  else:
    a+=c
print(ans)

Fixed submission:
s=input()
c=0
a=0
for i in s:
  if i=='B':
    c+=1
  else:
    a+=c
print(a)
Buggy python submission (verdict: Runtime Error):
import math
n,x=int(input())
a=list(map(int(input())))
ans=a[0]-x
for i in a:
    ans=math.gcd(ans,a[i]-x)
print(math)

Fixed submission:
from fractions import gcd
n,x=list(map(int, input().split()))
a=list(map(int, input().split()))
ans=a[0]-x
for i in a:
    ans=gcd(ans,abs(i-x))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b.map(int,input().split())
if a+b==15:
  print("+")
elif a*b==15:
  print("*")
else:
  print("x")

Fixed submission:
a,b=map(int,input().split())
if a+b==15:
  print("+")
elif a*b==15:
  print("*")
else:
  print("x")
Buggy python submission (verdict: Runtime Error):
o=input()
a=list(map(int,input().split()))
print(max(a)-min(a))


Fixed submission:
_=int(input())
print(_<<(_&1))

Buggy python submission (verdict: Runtime Error):
input()
a=list(map(int,input().split()))
print(max(a)-min(a))


Fixed submission:
_=int(input())
print(_<<(_&1))
Buggy python submission (verdict: Runtime Error):
s=input()
s[3]="8"
print(s)

Fixed submission:
s=input()
print(s[:3]+"8"+s[4:])
Buggy python submission (verdict: Runtime Error):
print((sum(int(input()))+1)//2)

Fixed submission:
print((sum(map(int,input().split()))+1)//2)
Buggy python submission (verdict: Runtime Error):
n,C=map(int,input().split())
dp=[[0 for i in range(100001)] for j in range(31)]
for i in range(n):
  s,t,c=map(int,input().split())
  t+=1
  dp[c][s]+=1
  dp[c][t]-=1
nm=[0 for i in range(100001)]
for i in range(31):
  s=1
  for j in range(1,100001):
    dp[i][j]+=dp[i][j-1]
    if dp[i][j]==0 and dp[i][j-1]==1:
      nm[s]+=1
      nm[j]-=1
    elif dp[i][j]==1 and dp[i][j-1]==0:
      s=j
for i in range(1,100001):
  nm[i]+=nm[i-1]
print(max(nm))

Fixed submission:
n,C=map(int,input().split())
dp=[[0 for i in range(100002)] for j in range(31)]
for i in range(n):
  s,t,c=map(int,input().split())
  t+=1
  dp[c][s]+=1
  dp[c][t]-=1
nm=[0 for i in range(100002)]
for i in range(31):
  s=1
  for j in range(1,100002):
    dp[i][j]+=dp[i][j-1]
    if dp[i][j]==0 and dp[i][j-1]==1:
      nm[s]+=1
      nm[j]-=1
    elif dp[i][j]==1 and dp[i][j-1]==0:
      s=j
for i in range(1,100002):
  nm[i]+=nm[i-1]
print(max(nm))
Buggy python submission (verdict: Runtime Error):
t=[0,1]
for i in range(2,90):
  t.append(t[i-1]+t[i-2])
print(t(int(input())

Fixed submission:
t=[2,1]
for i in range(2,90):
  t.append(t[i-1]+t[i-2])
print(t[int(input())])
Buggy python submission (verdict: Runtime Error):
h,w,k=map(int,input().split())
ans="No"
for i in xrange(h):
  for j in xrange(w):
    if i*j+(h-i)*(w-j) == k:
      ans="Yes"
print(ans)

Fixed submission:
h,w,k=map(int,input().split())
ans="No"
for i in range(h+1):
  for j in range(w+1):
    if i*j+(h-i)*(w-j) == k:
      ans="Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
x=[0]*(1e9+10)
edge=[0]*2
for i in a:
  x[i]+=1
  if x[i]==2:
    edge.append(i)
    x[i]=0
edge.sort(reverse=True)
print(edge[0]*edge[1])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
x={}
edge=[0]*2
for i in a:
  if i in x:
    x[i]+=1
    if x[i]==2:
      edge.append(i)
      x[i]=0
  else:
    x[i]=1
edge.sort(reverse=True)
print(edge[0]*edge[1])
Buggy python submission (verdict: Runtime Error):
import fractions
n=int(input())
a=1
for i in range(n):
  b=int(input())
  a=a//fractions.gcd(a,b)*b
print(int(a))


Fixed submission:
s=input()
if(s[0]==s[2]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(max(0,min(b,d)-max(a,c))

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(0,min(b,d)-max(a,c)))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
if M>m+1:
  print("No")
elif M==m+1:
  cntm=a.count(m)
  cntM=n-cntm
  if cntm>m:
    print("No")
  elif cntm+cntM//2<M:
    print("No")
  else:
    print("Yes")
elif M==m:
  if m<=n//2:
    print("Yes")
  else if m==n-1:
    print("Yes")
  else:
    print("No")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
if M>m+1:
  print("No")
elif M==m+1:
  cntm=a.count(m)
  cntM=n-cntm
  if cntm>m:
    print("No")
  elif cntm+cntM//2<M:
    print("No")
  else:
    print("Yes")
elif M==m:
  if m<=n//2:
    print("Yes")
  elif m==n-1:
    print("Yes")
  else:
    print("No")