Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(lambda x:x[1])
#print(task)
for i in range(N):
    time=time+task[i][0]
    if not(time<=task[i][1]):
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")


Fixed submission:
N=int(input())
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(lambda x:x[1])
#print(task)
for i in range(N):
    time=time+task[i][0]
    if not(time<=task[i][1]):
        flag=0
        break
if flag==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
dp=[0]*N
id=0
p=10**9+7
point=a[id]
for i in range(N):
    if i==0:
        if a[id]!=(i+1):
            dp[i]=1
        else:
            id=id+1
    elif i==1:
        if a[id]!=(i+1):
            dp[i]=dp[i-1]+1
        else:
            id=id+1
    else:
        dp[i]=dp[i-1]+dp[i-2]
        if a[id]==i+1:
            dp[i]=0
            if id<len(a)-1:
                id=id+1
print(dp[N-1]%p)





Fixed submission:
N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]
dp=[0]*N
id=0
p=10**9+7
id=0
for i in range(N):
    if (i==0):
        dp[i]=1
    elif (i==1):
        dp[i]=dp[i-1]+1
    else:
        dp[i]=dp[i-1]+dp[i-2]
    if len(a)>0:
        if a[id]==i+1:
            dp[i]=0
            if id<len(a)-1:
                id=id+1
print(dp[N-1]%p)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
N=int(input())
tree=[[] for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    tree[u-1].append([v-1,w])
    tree[v - 1].append([u - 1, w])
#print(tree)
col=[-1]*N
dist=[-1]*N
v=0
d=deque()
d.append(v)
color=0
col[0]=0
dist[0]=0
while min(dist)==-1:
    v=d.popleft()
    for i in tree[v]:
        if dist[i[0]]==-1:
            #print(dist[i[0]],dist[v],i[1])
            dist[i[0]]=dist[v]+i[1]
            d.append(i[0])
    #print(dist,d)
    #input()
for i in range(N):
    print(dist[i]%2)

Fixed submission:
from collections import deque
N=int(input())
tree=[[] for _ in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    tree[u-1].append([v-1,w])
    tree[v - 1].append([u - 1, w])
#print(tree)
dist=[-1]*N
v=0
d=deque()
d.append(v)
dist[0]=0
determined=[0]
while len(determined)<N:
    v=d.popleft()
    for i in tree[v]:
        if dist[i[0]]==-1:
            #print(dist[i[0]],dist[v],i[1])
            dist[i[0]]=dist[v]+i[1]
            d.append(i[0])
            determined.append(i[0])
    #print(dist,d,determined)
    #input()
for i in range(N):
    print(dist[i]%2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
while (dif[i]>=0)and(i<=N-1):
    count=count+dif[i]
    i=i+1

print(count)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)

Buggy python submission (verdict: Runtime Error):
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(V[i]-C[i])

dif.sort(reverse=True)

i=0
while (dif[i]>=0)and(i<=N-1):
    count=count+dif[i]
    i=i+1

print(count)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)

Buggy python submission (verdict: Runtime Error):
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(V[i]-C[i])

dif.sort(reverse=True)

i=0
while dif[i]>=0:
    count=count+dif[i]
    i=i+1

print(count)

Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N=int(input())
V=np.array(list(map(int,input().split())))
C=np.array(list(map(int,input().split())))
bit=[]
max=0
for i in range(2**N):
    bit=np.array([int(bin((i & (1 << j)) >> j), 0)  for j in range(N)])
    X=np.dot(V,bit)
    Y=np.dot(C,bit)
    if max<X-Y:
        max=X-Y
print(max)



Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N=int(input())
V=np.array(list(map(int,input().split())))
C=np.array(list(map(int,input().split())))
bit=[]
max=0
for i in range(2**N):
    bit=np.array([int(bin((i & (1 << j)) >> j), 0)  for j in range(N)])
    X=np.dot(V,bit)
    Y=np.dot(C,bit)
    if max<X-Y:
        max=X-Y
print(max)



Fixed submission:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
l=[]
stat=int(math.sqrt(10**7//X))
for i in range(X):
    for j in range(min(stat,Y)):
        for k in range(min(stat,Z)):
            l.append(A[i] + B[j] + C[k])
end1=stat
stat2=int(math.sqrt(10**7//Y))
for i in range(min(stat,X),min(stat+stat2,X)):
    for j in range(Y):
        for k in range(min(stat,Z),min(stat+stat2,Z)):
            l.append(A[i] + B[j] + C[k])
end2=stat+stat2
stat3=int(math.sqrt(10**7//Z))
for i in range(min(stat+stat2,X),min(stat+stat2+stat3,X)):
    for j in range(min(stat+stat2,Y),min(stat+stat2+stat3,Y)):
        for k in range(Z):
            l.append(A[i] + B[j] + C[k])

l.sort(reverse=True)
#print(l)
for i in range(K):
    print(l[i])



Fixed submission:
import math
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
l=[]
#まずX+Yを求め、上から順にソート
#10^6相当の計算
for i in range(X):
    for j in range(Y):
        l.append(A[i] + B[j])
l.sort(reverse=True)
ans=[]
#(X+Y)+Zより、全体の上位を求めるが、Zが何であれ、X+Yの和が上からK番目以下のものは考慮しなくて良い
#(X+YにおいてK+i番目のもの(X+Y)_K+i+Zjが全体でK番以内に食い込めるということは、1~K番目のX+Yにて(X+Y)_1~K+Zj>(X+Y)_K+i+Zjが成立することと矛盾する)
#これで高々10^7相当までのソートでよくなる
for i in range(min(K,len(l))):
    for j in range(Z):
        ans.append(l[i]+C[j])
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
i=0
s=S
count=0
while True:
    if (i==(len(s)-1))or(len(s)==0):
        break
    if not(s[i]==s[i+1]):
        #print(s[:i],s[i+2:])
        s="".join((s[:i],s[i+2:]))
        #print(s)
        #input()
        i=0
        count=count+1
    else:
        i=i+1
print(count*2)

Fixed submission:
S=input()
i=0
s=S
count0=0
count1=0
for i in range(len(S)):
    if S[i]=="0":
        count0=count0+1
    else:
        count1 = count1 + 1
print(min(count0,count1)*2)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
i=0
s=S
count=0
while True:
    if (i==(len(s)-1))or(len(s)==0):
        break
    if not(s[i]==s[i+1]):
        #print(s[:i],s[i+2:])
        s="".join((s[:i],s[i+2:]))
        #print(s)
        #input()
        i=0
        count=count+1
    else:
        i=i+1
print(count*2)

Fixed submission:
S=input()
i=0
s=S
count0=0
count1=0
for i in range(len(S)):
    if S[i]=="0":
        count0=count0+1
    else:
        count1 = count1 + 1
print(min(count0,count1)*2)

Buggy python submission (verdict: Runtime Error):
S=input()
i=0
s=S
count=0
while True:
    if (i==(len(s)-1))or(len(s)==0):
        break
    if not(s[i]==s[i+1]):
        #print(s[:i],s[i+2:])
        s="".join((s[:i],s[i+2:]))
        #print(s)
        input()
        i=0
        count=count+1
    else:
        i=i+1
print(count*2)

Fixed submission:
S=input()
i=0
s=S
count0=0
count1=0
for i in range(len(S)):
    if S[i]=="0":
        count0=count0+1
    else:
        count1 = count1 + 1
print(min(count0,count1)*2)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
H,W=map(int,input().split())
table=[list(input()) for _ in range(H)]
dp=[[-1 for _ in range(W)] for _ in range(H)]
d=deque()
col=0
wlist=[0]*(H*W)
blist=[0]*(H*W)
for i in range(H):
    for j in range(W):
        if dp[i][j]==-1:
            col = i*W+j
            d.append([i,j])
        while len(d)>0:
            v=d.popleft()
            x=v[0]
            y=v[1]
            dp[x][y]=col
            if x!=0:
                if (table[x][y]!=table[x-1][y])and(dp[x-1][y]==-1):
                    d.append([x-1,y])
            if x!=H-1:
                if (table[x][y]!=table[x+1][y])and(dp[x+1][y]==-1):
                    d.append([x + 1, y])
            if y!=0:
                if (table[x][y]!=table[x][y-1])and(dp[x][y-1]==-1):
                    d.append([x, y-1])
            if y!=W-1:
                if (table[x][y]!=table[x][y+1])and(dp[x][y+1]==-1):
                    d.append([x, y+1])
            #print(dp)
            #print(d)
            #input()
for i in range(H):
    for j in range(W):
        if table[i][j]=="#":
            blist[dp[i][j]]+=1
        else:
            wlist[dp[i][j]] += 1
#print(wlist,blist)
cnt=0
for i in range(H*W):
    cnt=cnt+blist[i]*wlist[i]
print(cnt)

Fixed submission:
from collections import deque
H,W=map(int,input().split())
table=[list(input()) for _ in range(H)]
dp=[[-1 for _ in range(W)] for _ in range(H)]
seen=[[0 for _ in range(W)] for _ in range(H)]
d=deque()
col=0
wlist=[0]*(H*W)
blist=[0]*(H*W)
for i in range(H):
    for j in range(W):
        if dp[i][j]==-1:
            col = i*W+j
            d.append([i,j])
            seen[i][j]=1
        while len(d)>0:
            v=d.popleft()
            x=v[0]
            y=v[1]
            dp[x][y]=col
            if x!=0:
                if (table[x][y]!=table[x-1][y])and(seen[x-1][y]==0):
                    seen[x-1][y]=1
                    d.append([x-1,y])
            if x!=H-1:
                if (table[x][y]!=table[x+1][y])and(seen[x+1][y]==0):
                    seen[x+1][y]=1
                    d.append([x + 1, y])
            if y!=0:
                if (table[x][y]!=table[x][y-1])and(seen[x][y-1]==0):
                    seen[x][y-1]=1
                    d.append([x, y-1])
            if y!=W-1:
                if (table[x][y]!=table[x][y+1])and(seen[x][y+1]==0):
                    seen[x][y+1]=1
                    d.append([x, y+1])
            #print(dp)
            #print(d)
            #input()
for i in range(H):
    for j in range(W):
        if table[i][j]=="#":
            blist[dp[i][j]]+=1
        else:
            wlist[dp[i][j]] += 1
#print(wlist,blist)
cnt=0
for i in range(H*W):
    cnt=cnt+blist[i]*wlist[i]
print(cnt)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
res=[0]*N
for i in range(1,N+1):
    res[i%K]=res[i%K]+1
#print(res)

if K%2==0:
    print(pow(res[K//2],3)+pow(res[0],3))
else:
    print(pow(res[0], 3))


Fixed submission:
N,K=map(int,input().split())
res=[0]*K
for i in range(1,N+1):
    res[i%K]=res[i%K]+1
#print(res)

if K%2==0:
    print(pow(res[K//2],3)+pow(res[0],3))
else:
    print(pow(res[0], 3))
Buggy python submission (verdict: Runtime Error):
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
N,A,B,K=map(int,input().split())
p=998244353
fracmod=[1]*(N+1)
fracmodinv=[1]*(N+1)
ans=0
i=0
j=0
for i in range(1,N+1):
    fracmod[i]=(fracmod[i-1]*i)%p
#print(fracmod[:6])
for i in range(N+1):
    fracmodinv[i]=modinv(fracmod[i],p)
for i in range(N+1):
    forb=K-i*A      #bに割く得点
    if (forb%B==0)and(forb//B>=0):
        j=forb//B
        #print(i,j)
        ans=(ans+((((fracmod[N]*fracmodinv[N-i]*fracmodinv[i])%p)*(fracmod[N]*fracmodinv[N-j]*fracmodinv[j]))%p))%p
print(ans)



Fixed submission:
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
N,A,B,K=map(int,input().split())
p=998244353
fracmod=[1]*(N+1)
fracmodinv=[1]*(N+1)
ans=0
i=0
j=0
for i in range(1,N+1):
    fracmod[i]=(fracmod[i-1]*i)%p
#print(fracmod[:6])
for i in range(N+1):
    fracmodinv[i]=modinv(fracmod[i],p)
for i in range(N+1):
    forb=K-i*A      #bに割く得点
    if (forb%B==0)and(0<=(forb//B)<=N):
        j=forb//B
        #print(i,j)
        ans=(ans+((((fracmod[N]*fracmodinv[N-i]*fracmodinv[i])%p)*(fracmod[N]*fracmodinv[N-j]*fracmodinv[j]))%p))%p
print(ans)

Buggy python submission (verdict: Runtime Error):
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
N,A,B,K=map(int,input().split())
p=998244353
fracmod=[1]*(N+1)
fracmodinv=[1]*(N+1)
ans=0
i=0
j=0
for i in range(1,N+1):
    fracmod[i]=(fracmod[i-1]*i)%p
#print(fracmod[:6])
for i in range(N+1):
    fracmodinv[i]=modinv(fracmod[i],p)
for i in range(N+1):
    forb=K-i*A      #bに割く得点
    if forb%B==0:
        j=forb//B
        #print(i,j)
        ans=(ans+((((fracmod[N]*fracmodinv[N-i]*fracmodinv[i])%p)*(fracmod[N]*fracmodinv[N-j]*fracmodinv[j]))%p))%p
print(ans)



Fixed submission:
def modpow(a,n,p):
    if n==0:
        return 1
    x=modpow(a,n//2,p)
    x=(x*x)%p
    if (n%2)==1:
        x=(x*a)%p
    return x%p
def modinv(a,p):
    return modpow(a,p-2,p)
N,A,B,K=map(int,input().split())
p=998244353
fracmod=[1]*(N+1)
fracmodinv=[1]*(N+1)
ans=0
i=0
j=0
for i in range(1,N+1):
    fracmod[i]=(fracmod[i-1]*i)%p
#print(fracmod[:6])
for i in range(N+1):
    fracmodinv[i]=modinv(fracmod[i],p)
for i in range(N+1):
    forb=K-i*A      #bに割く得点
    if (forb%B==0)and(0<=(forb//B)<=N):
        j=forb//B
        #print(i,j)
        ans=(ans+((((fracmod[N]*fracmodinv[N-i]*fracmodinv[i])%p)*(fracmod[N]*fracmodinv[N-j]*fracmodinv[j]))%p))%p
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

if (abs(a-b)=<d)or(abs(a-c)=<d)or(abs(b-c)=<d):
    print("Yes")
else:
    print("No")

Fixed submission:
a,b,c,d=map(int,input().split())

if ((abs(a-b)<=d)and(abs(b-c)<=d))or(abs(a-c)<=d):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input())
print(min(N*A,B))

Fixed submission:
N,A,B=map(int,input().split())
print(min(N*A,B))
Buggy python submission (verdict: Runtime Error):
import itertools
S=input()
N=len(S)
flag=0
s="AKIHABARA"
s2=""
l2=[]
count=0
for i in range(9):
    l=list((itertools.combinations(s,i+1)))
    #print(l)
    for j in range(len(l)):
        s2="".join(l[j])
        l2.append(s2)
for i in range(len(l2)):
    if l2[i]==S:
        for j in range(len(l2[i])):
            if l2[i][j]=="A":
                count=connt+1
        if (4-count)+len(l2[i])==9:
            flag=1
        break
if flag==1:
    print("YES")
else:
    print("NO")



Fixed submission:
import itertools
S=input()
N=len(S)
flag=0
s="AKIHABARA"
s2=""
l2=[]
count=0
for i in range(9):
    l=list((itertools.combinations(s,i+1)))
    #print(l)
    for j in range(len(l)):
        s2="".join(l[j])
        l2.append(s2)
for i in range(len(l2)):
    if l2[i]==S:
        for j in range(len(l2[i])):
            if l2[i][j]=="A":
                count=count+1
        if (4-count)+len(l2[i])==9:
            flag=1
        break
if flag==1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
from math import ceil
s=list(input())
n=len(s)
l=[]
m=[]
buf=[]
for i in range(n):
    if s[i]!="x":
        l.append(s[i])
m=l[::-1]
#print(l,m)
left=[]
right=[]
ans=0
if m==l:
    flag=1
    for i in range(ceil(len(l)/2)):
        buf.append(s[i])
    piv=0
    cnt=0
    for i in range(n):
        if piv==len(buf):
            break
        if s[i]==buf[piv]:
            left.append(cnt)
            cnt=0
            piv=piv+1
        else:
            cnt=cnt+1
    piv=0
    cnt=0
    for i in range(n-1,-1,-1):
        if piv==len(buf):
            break
        if s[i]==buf[piv]:
            right.append(cnt)
            cnt=0
            piv=piv+1
        else:
            cnt=cnt+1
    #print(left,right)
    for i in range(len(left)):
        ans=ans+abs(left[i]-right[i])
    print(ans)
else:
    print("-1")


Fixed submission:
from math import ceil
s=list(input())
n=len(s)
l=[]
m=[]
buf=[]
for i in range(n):
    if s[i]!="x":
        l.append(s[i])
m=l[::-1]
#print(l,m)
left=[]
right=[]
ans=0
if m==l:
    flag=1
    for i in range(ceil(len(l)/2)):
        buf.append(l[i])
    piv=0
    cnt=0
    #print(buf)
    for i in range(n):
        if piv==len(buf):
            break
        if s[i]==buf[piv]:
            left.append(cnt)
            cnt=0
            piv=piv+1
        else:
            cnt=cnt+1
    piv=0
    cnt=0
    for i in range(n-1,-1,-1):
        if piv==len(buf):
            break
        if s[i]==buf[piv]:
            right.append(cnt)
            cnt=0
            piv=piv+1
        else:
            cnt=cnt+1
    #print(left,right)
    for i in range(len(left)):
        ans=ans+abs(left[i]-right[i])
    print(ans)
else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
N,A=map(int,input().split())

print(N*N-A)

Fixed submission:
N=int(input())
A=int(input())

print(N*N-A)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
s1=""

for i in range(len(s)):
    if (i%2==0):
        s1="".join((s1,s[i]))
print(s1)

Fixed submission:
s=input()
s1=""

for i in range(len(s)):
    if (i%2==0):
        s1="".join((s1,s[i]))
print(s1)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
s1=""

for i in range(len(s)):
    if (i%2==0):
        s1="".join((s1,s[i]))
print(s1)

Fixed submission:
s=input()
s1=""

for i in range(len(s)):
    if (i%2==0):
        s1="".join((s1,s[i]))
print(s1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
H,W=map(int,input().split())
a=[list(map(str,list(input()))) for i in range(H)]
f=np.empty((H+2,W+2))
f=f.tolist()
#print(f)
#print(a)

for i in range(H+2):
    for j in range(W+2):
        if (i==0)or(i==H+1)or(j==0)or(j==W+1):
            f[i][j]='#'
            #print("#")
        elif (i>0)and(j>0):
            f[i][j]=a[i-1][j-1]
            #print(a[i-1][j-1])
for i in f:print(*i, sep='')

Fixed submission:
import numpy as np
H,W=map(int,input().split())
a=[list(map(str,list(input()))) for i in range(H)]
f=np.empty((H+2,W+2))
f=f.tolist()
#print(f)
#print(a)

for i in range(H+2):
    for j in range(W+2):
        if (i==0)or(i==H+1)or(j==0)or(j==W+1):
            f[i][j]='#'
            #print("#")
        elif (i>0)and(j>0):
            f[i][j]=a[i-1][j-1]
            #print(a[i-1][j-1])
for i in f:print(*i, sep='')
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
f=0
fnew=0
A=list(map(int,input().split()))
def flag(n1,n2,f):
 if n1>n2:
  return -1
 elif n1<n2:
  return 1
 else:
  return f
cnt=0
l=[]
i=0
while i<N:
 l.append(A[i])
 if (l[0]+l[len(l)-1])!=(max(l)+min(l)):
  cnt=cnt+1
  l=[]
  i=i-1
 i=i+1
print(cnt+1)

Fixed submission:
N=int(input())
f=0
fnew=0
A=list(map(int,input().split()))
cnt=0
i=0
l=0
r=0
downflag=0
upflag=0
ma=A[i]
mi=A[i]
while i<N:
 if ma>A[i]:
  downflag=1
 elif ma<A[i]:
  upflag=1
 if (upflag==1)and(A[i]>ma):
  ma=A[i]
 if (downflag==1)and(mi>A[i]):
  mi=A[i]
 if (ma+mi)!=(A[l]+A[i]):
  ma=A[i]
  mi=ma
  cnt=cnt+1
  l=i
  i=i-1
  upflag=0
  downflag=0
 i=i+1
print(cnt+1)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(str,input().split())

if (2*b-a-c)==0:
    print("YES")
else:
    print("NO")

Fixed submission:
a,b,c=map(int,input().split())

if (2*b-a-c)==0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(str,input().split())

if (b-a)=(c-b):
    print("YES")
else:
    print("NO")

Fixed submission:
a,b,c=map(int,input().split())

if (2*b-a-c)==0:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(str,input().split())

if (b-a)==(c-b):
    print("YES")
else:
    print("NO")

Fixed submission:
a,b,c=map(int,input().split())

if (2*b-a-c)==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
s=list(input())
N=len(s)
K=int(input())
num=123

for i in range(N):
    diff=(num-ord(s[i]))%26
    if K==0:
        break
    if diff<=K:
        s[i]="a"
        K=K-diff
#print(s)
if K>0:
    s[N-1]=chr(ord(s[N-1])+K)
#print(s)
print("".join(s))


Fixed submission:
s=list(input())
N=len(s)
K=int(input())
num=123

for i in range(N):
    diff=(num-ord(s[i]))%26
    if K==0:
        break
    if diff<=K:
        s[i]="a"
        K=K-diff
#print(s)
#print(K)
if K>0:
    K=K%26
    s[N-1]=chr(ord(s[N-1])+K)
#print(s)
print("".join(s))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(((a+b)*c)/2)


Fixed submission:
a=int(input())
b=int(input())
c=int(input())
print(int(((a+b)*c)/2))
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

ans = 0
if A >= 13:
	ans = B
elif A >= 6:
    ans = Int(B / 2)
else:
	ans = 0

print(ans)





Fixed submission:
A,B = map(int, input().split())

ans = 0
if A >= 13:
	ans = B
elif A >= 6:
    ans = int(B / 2)
else:
	ans = 0

print(ans)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
ans=len(T)
for i in range(len(S)-len(T)+1):
  _ans=0
  for j in range(len(T)):
    if S[i+j]!=T[i+j]:
      _ans+=1
  ans=min(ans,_ans)
print(ans)

Fixed submission:
S=input()
T=input()
ans=len(T)
for i in range(len(S)-len(T)+1):
  _ans=0
  for j in range(len(T)):
    if S[i+j]!=T[j]:
      _ans+=1
  ans=min(ans,_ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N.K=map(int,input().split())
P=sorted(list(map(int,input().split())))
print(sum(P[:K]))

Fixed submission:
N,K=map(int,input().split())
P=sorted(list(map(int,input().split())))
print(sum(P[:K]))