Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02847 (python)

Fixed submission:
# coding UTF-8
# 
# problem A
# 

r = input()
if r == 'SUN':
    print(7)
if r == 'MON':
    print(6)
if r == 'TUE':
    print(5)
if r == 'WED':
    print(4)
if r == 'THU':
    print(3)
if r == 'FRI':
    print(2)
if r == 'SAT':
    print(1)

Buggy submission (verdict: Runtime Error):
def main():
    A, B, X = map(int, input().split())
    if X >= A*pow(10,9) + B*10:
        print(pow(10, 9))
        return
    ans = 0
    for n in range(10):
        N = (X - B*n) // A
        #print('N:{}, n:{}'.format(N, n))
        ans = max(ans, min(N, pow(10, n)-1))
 
    print(ans)
 
 
if __name__ == "__main__":
    main()
Problem p03017 (python)

Fixed submission:
def main():
    N, A, B, C, D = map(int, input().split())
    S = list(input())
    E = max(C, D)
    cnt = 0
    for i in range(A-1, E):
        if S[i] == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt >= 2:
            print('No')
            return
    if C < D:
        print('Yes')
        return
    cnt = 0
    for i in range(B-2, D+1):
        if S[i] == '.':
            cnt += 1
        else:
            cnt = 0
        if cnt >= 3:
            print('Yes')
            return
    print('No')
        
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, A, B, C, D = map(int, input().split())
    S = list(input())
    E = max(C, D)
    cnt = 0
    for i in range(A-1, E):
        if S[i] == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt >= 2:
            print('No')
            return
    if C < D:
        print('Yes')
        return
    cnt = 0
    for i in range(B-1, D+2):
        if S[i] == '.':
            cnt += 1
        else:
            cnt = 0
        if cnt >= 3:
            print('Yes')
            return
    print('No')
        
if __name__ == "__main__":
    main()
Problem p03767 (python)

Fixed submission:
from collections import deque

def main():
    N = int(input())
    a = list(map(int, input().split()))
    a.sort()
    a = deque(a)
    ans = 0
    for i in range(N):
        a.pop()
        ans += a.pop()
        a.popleft()
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N, K = map(int, input().split())
    h = []
    for _ in range(N):
        h.append(int(input()))
    h.sort()
    ans = pow(10, 10)
    for k in range(N-K+1):
        ans = min(ans, abs(h[k]-h[K-1+k]))
    print(ans)

if __name__ == "__main__":
    main()
Problem p03804 (python)

Fixed submission:
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    n = []
    for _ in range(N):
        n.append(list(readline()[:-1]))
    m = []
    for _ in range(M):
        m.append(list(readline()[:-1]))

    s = N - M
    if s == 0:
        if n == m:
            flag = True
        else:
            flag = False

    for i in range(s):
        for j in range(s):
            flag = True
            for k in range(M):
                if n[i+k][j:j+M] != m[k]:
                    flag = False
                    break
            if flag:
                break
        if flag:
            break
    if flag:
        print('Yes')
    else:
        print('No')
            
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline

def main():
    N, M = map(int, readline().split())
    n = []
    for _ in range(N):
        n.append(list(readline()[:-1]))
    m = []
    for _ in range(M):
        m.append(list(readline()[:-1]))

    s = N - M
    for i in range(s):
        for j in range(s):
            flag = True
            for k in range(M):
                if n[i+k][j:j+M] != m[k]:
                    flag = False
                    break
            if flag:
                break
        if flag:
            break
    if flag:
        print('Yes')
    else:
        print('No')
            
if __name__ == "__main__":
    main()
Problem p02598 (python)

Fixed submission:
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

x0, x1 = 0, 10**9
while x0 + 1  < x1:
  x = (x0+x1)//2
  suma=0
  for i in a:
    if i%x==0:
      suma+=(i//x)-1
    else:
      suma += (i//x)
    
  if suma > k:
    x0 = x
  else:
    x1 = x
print(x1)

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

x0, x1 = 0, 10**9
while x0 + 1  < x1:
  x = (x0+x1)//2
  suma=0
  for i in a:
    suma += (a//x)
    
  if suma > k:
    x0 = x
  else:
    x1 = x
print(x1)
Problem p02777 (python)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
  a-=1
elif u==t:
  b-=1
print(a,b)

Buggy submission (verdict: Runtime Error):
s,t=map(str,input().split())
a,b=map(int,input().split())
ss=input()
if ss="s":
  a-=1
else:
  b-=1
print(a,b)
Problem p02785 (python)

Fixed submission:
n,k=map(int,input().split())
if n<k:
  k=n
h=list(map(int,input().split()))
h.append(0)
h.sort()
for i in range(k):
  h.pop(-1)
print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.append(0)
h.sort()
for i in range(k):
  h.pop(-1)
print(sum(h))
Problem p02833 (python)

Fixed submission:
n=int(input())
if n%2!=0:
  print(0)
else:
  a=0
  for i in range(1,26):
    a+=(n//(2*5**i))
  print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%2!=0:
  print(0)
else:
  a=0
  for i in range(1,26):
    a+=(n//(2*5**i))
print(a)
Problem p02862 (python)

Fixed submission:
x,y=map(int,input().split())
mod = 10**9+7
flflag=True

if (2*x-y)%3==0:
  a=(2*x-y)//3
else:
  flflag=False
if (2*y-x)%3==0:
  b=(2*y-x)//3
else:
  flflag=False

def kaijou(n):
  ans = 1
  for i in range(1,n+1):
    ans*=i%mod
    ans%=mod  
  return ans
if flflag:
  N=a+b
  R=min(a,b)
ans=0
if flflag==True and a>=0 and b>=0:
  ans=kaijou(N)
  ans1= (kaijou(N-R)*kaijou(R))%mod
  print((ans*pow(ans1,mod-2,mod))%mod)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
mod = 10**9+7
flflag=True

if (2*x-y)%3==0:
  a=(2*x-y)//3
else:
  flflag=False
if (2*y-x)%3==0:
  b=(2*y-x)//3
else:
  flflag=False

def kaijou(n):
  ans = 1
  for i in range(1,n+1):
    ans*=i%mod
    ans%=mod  
  return ans

N=a+b
R=min(a,b)
ans=0
if a>=0 and b>=0 and flflag==True:
  ans=kaijou(N)
  ans1= (kaijou(N-R)*kaijou(R))%mod
  print((ans*pow(ans1,mod-2,mod))%mod)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
f=[[0]*(10**3) for i in range(10**3)]
for i in range(x):
  for j in range(y):
    f[i][j]=f[i-1][j-2]+f[i-2][j-1]
print(f[x][y])

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
d=[[0]*x for i in range(y)]

def d(a,b):
  if a==1 and b==2:
    return 1
  elif a==2 and b==1:
    return 1
  elif a<1 and b<1:
    return 0
  return d(a-1,b-2)+d(a-2,b-1)

print(d(x,y)%(10**9+7))
Problem p02912 (python)

Fixed submission:
import heapq
N, M = list(map(int,input().split()))
h = []
for i in input().split():
  heapq.heappush(h,-int(i))
for i in range(M):
  x = -heapq.heappop(h)
  x //=2
  heapq.heappush(h,-x)
print(-sum(h))

Buggy submission (verdict: Runtime Error):
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NM = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, M) = (NM[0], NM[1]);
        var A = ReadLine().Split(' ').Select(s => int.Parse(s)).OrderByDescending(x => x).ToArray();

        var priorityQueue = new PriorityQueue<int>();

        foreach (var a in A)
            priorityQueue.Push(a);

        for (int i = 0; i < M; i++)
        {
          int nip = priorityQueue.Pop()/2;
          priorityQueue.Push(nip);
          
        }

        var ans = priorityQueue.Sum(x => (long)x);

        WriteLine(ans);

    }
}
public class PriorityQueue<T> : IEnumerable<T>
    where T : IComparable<T>
{
    private List<T> buffer;
    public int Count { get => buffer.Count; }
    public bool IsDescending { get; }
    private int Compare(T a, T b) => IsDescending ? a.CompareTo(b) : b.CompareTo(a);

    public PriorityQueue(bool isDescending = true)
    {
        buffer = new List<T>();
        IsDescending = isDescending;
    }

    public void Push(T item)
    {
        buffer.Add(item);

        var root = 0;
        var child = buffer.Count - 1;

        while (root < child)
        {
            var parent = (child - 1) / 2;

            if (Compare(buffer[parent], buffer[child]) < 0)
                (buffer[parent], buffer[child]) = (buffer[child], buffer[parent]);

            child = parent;
        }
    }

    public T Pop()
    {
        var item = buffer[0];
        buffer[0] = buffer[^1];
        buffer.RemoveAt(buffer.Count - 1);

        var root = 0;
        var parent = root;
        var child = 1;

        while(child < buffer.Count)
        {
            if (child < buffer.Count - 1)
            {
                var leftChild = child;
                var rightChild = child + 1;

                if (Compare(buffer[leftChild], buffer[rightChild]) < 0)
                    child = rightChild;
            }

            if (Compare(buffer[parent], buffer[child]) < 0)
                (buffer[parent], buffer[child]) = (buffer[child], buffer[parent]);

            parent = child;
            child = 2 * parent + 1;
        }

        return item;
    }

    public IEnumerator<T> GetEnumerator()
    {
        return buffer.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return this.GetEnumerator();
    }
}

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
d=[max(a)//2]
a.pop(0)
for i in range(m-1):
  if a[0]>=d[0]:
    d.append(a[0]//2)
    a.pop(0)
  else:
    d.append(d[0]//2)
    d.pop(0)
print(sum(d)+sum(a))
Problem p03013 (python)

Fixed submission:
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
a=set(a)
MOD=1000000007

dp=[0]*(n+1)
for i in range(1,n+1):
  if i in a:
    dp[i]=0
  else:
    if i==1:
      dp[i]=1
    elif i==2:
      dp[i]=dp[1]+1
    else:
      dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%MOD)

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

Fixed submission:
s=input()
t=input()
d=dict()
flag=True
ds=set()
for i in range(len(s)):

  if not(t[i] in d):
    if s[i] in ds:
      flag=False
      break
    d[t[i]]=s[i]
    ds.add(s[i])
  else:
    if d[t[i]]!=s[i]:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
n=len(s)
sabc={}
tabc={}
al=list("abcdefghijklmnopqrstuvwxyz")
for i in range(26):
  sabc[al[i]]=0
  tabc[al[i]]=0 
s=list(s)
t=list(t)
s.sort()
t.sort()
count=1
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    sabc[s[i]]=count
    count=1
    syu+=1
sabc[s[-1]]=count
count=1
syu=0
for i in range(n-1):
  if t[i]==t[i+1]:
    count+=1
  else:
    tabc[t[i]]=count
    count=1
    syu+=1
tabc[t[-1]]=count

for i in al:
  if tabc[i]!=0 and sabc!=0:
    if tabc[i]!=sabc[i]:
      print("No")
      count=-1
      break
if count!=-1:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
n=len(s)
sabc=[0]*26
tabc=[0]*26
s=list(s)
t=list(t)
s.sort()
t.sort()
count=1
syu=0
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    sabc[syu]=count
    count=1
    syu+=1
sabc[syu]=count
count=1
syu=0
for i in range(n-1):
  if t[i]==t[i+1]:
    count+=1
  else:
    tabc[syu]=count
    count=1
    syu+=1
tabc[syu]=count

for i in range(n):
  if tabc[i]!=0 and sabc!=0:
    if tabc[i]!=sabc[i]:
      print("No")
      count=-1
      break
if count!=-1:
  print("Yes")
Problem p03745 (python)

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

increase_flag=False
decrease_flag=False
answer=0
if n!=1:
  for i in range(len(a)-1):
    if increase_flag==False and decrease_flag==False:

      if a[i+1]>a[i]:
        increase_flag=True
        answer+=1
      elif a[i+1]<a[i]:
        decrease_flag=True
        answer+=1
      
    else:
      if decrease_flag==True and a[i+1]>a[i]:
        decrease_flag=False
      elif increase_flag==True and a[i+1]<a[i]:
        increase_flag=False

  if increase_flag==False and decrease_flag==False:
    if a[-1]>a[-2]:
      increase_flag=True
      answer+=1
    elif a[-1]<a[-2]:
      decrease_flag=True
      answer+=1
  print(answer)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

increase_flag=False
decrease_flag=False
answer=0

for i in range(len(a)-1):
  if increase_flag==False and decrease_flag==False:

    if a[i+1]>a[i]:
      increase_flag=True
      answer+=1
    elif a[i+1]<a[i]:
      decrease_flag=True
      answer+=1
      
  else:
    if decrease_flag==True and a[i+1]>a[i]:
      decrease_flag=False
    elif increase_flag==True and a[i+1]<a[i]:
      increase_flag=False

if increase_flag==False and decrease_flag==False:
  if a[i+1]>a[i]:
    increase_flag=True
    answer+=1
  elif a[i+1]<a[i]:
    decrease_flag=True
    answer+=1
print(answer)
Problem p02712 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
    if (i + 1) % 3 != 0:
        if (i + 1) % 5 != 0:
            ans += i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
n1 = n // 15
n2 = n % 15
n3 = [0, 1, 3, 3, 7, 7, 7, 14, 22, 22, 22, 33, 46, 60]
ans = 60 * (n1 ** 2) + n3[n2] + 15 * n1 * (n2 - n2 // 3 - n2 // 5)
print(ans)
Problem p02735 (python)

Fixed submission:
h, w = map(int, input().split())
s = []
s.append(["."] * (w + 1))
for i in range(h):
    s.append(["."] + list(input()))
s2 = []
for i in range(h + 1):
    s2.append([0] * (w + 1))

for i in range(w - 1):
    if s[1][i + 1] == "#":
        if s[1][i] != "#":
            s2[0][i + 2] = s2[0][i + 1] + 1
        else:
            s2[0][i + 2] = s2[0][i + 1]
    else:
        s2[0][i + 2] = s2[0][i + 1]
for i in range(h - 1):
    if s[i + 1][1] == "#":
        if s[i][1] != "#":
            s2[i + 2][0] = s2[i + 1][0] + 1
        else:
            s2[i + 2][0] = s2[i + 1][0]
    else:
        s2[i + 2][0] = s2[i + 1][0]

for i in range(h):
    for j in range(w):
        if s[i + 1][j + 1] == ".":
            s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j])
        else:
            if s[i][j + 1] == "#":
                if s[i + 1][j] == "#":
                    s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j])
                else:
                    s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j] + 1)
            else:
                if s[i + 1][j] == "#":
                    s2[i + 1][j + 1] = min(s2[i][j + 1] + 1, s2[i + 1][j])
                else:
                    s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j]) + 1
print(s2[h][w])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = []
s.append(["."] * (w + 1))
for i in range(h):
    s.append(["."] + list(input()))
s2 = []
for i in range(h + 1):
    s2.append([0] * (w + 1))
for i in range(h - 1):
    if s[1][i + 1] == "#":
        s2[0][i + 2] = s2[0][i + 1] + 1
    else:
        s2[0][i + 2] = s2[0][i + 1]
for i in range(w - 1):
    if s[i + 1][1] == "#":
        s2[i + 2][0] = s2[i + 1][0] + 1
    else:
        s2[i + 2][0] = s2[i + 1][0]
for i in range(h):
    for j in range(w):
        if s[i + 1][j + 1] == ".":
            s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j])
        else:
            s2[i + 1][j + 1] = min(s2[i][j + 1], s2[i + 1][j]) + 1
print(s2[h][w])
Problem p03137 (python)

Fixed submission:
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
y = []
for i in range(m - 1):
    y.append(x[i + 1] - x[i])
y.sort()
count = 0
for i in range(m - n):
    count += y[i]
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort(
y = []
for i in range(m - 1):
    y.append(x[i + 1] - x[i])
y.sort()
count = 0
for i in range(m - n):
    count += y[i]
print(count)
Problem p03834 (python)

Fixed submission:
s = input().split(",")
print(" ".join(s))

Buggy submission (verdict: Runtime Error):
s = input().split()
print(" ",join(s))
Problem p02725 (python)

Fixed submission:
K,N=map(int, input().split())
A=list(map(int, input().split()))
C=[]
for i in range(N):
  if i==N-1:
    C.append((K-A[i])+A[0])
  else:
    C.append(A[i+1]-A[i])

print(K-max(C))

Buggy submission (verdict: Runtime Error):
K,N=map(int, input().split())
A=list(map(int, input().split()))
K=[]
for i in range(N):
  if i==N-1:
    K.append((K-A[i])+A[1])
  else:
    K.append(A[i+1]-A[i])

print(N-max(K))
Problem p02753 (python)

Fixed submission:
S=str(input())
if S!='AAA' and S!='BBB':
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S=str(input())
if S=='AAA' or S='BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=str(input())
if S='AAA' or S='BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
S=str(input())
if S='AAA' or S='BBB':
  print('No')
else:
  print('Yes')
Problem p02766 (python)

Fixed submission:
N,K=map(int, input().split())
n=0
while K**(n+1)<=N:
  n+=1
  
print(n+1)

Buggy submission (verdict: Runtime Error):
N,K=map(int, input().split())
i=0
while(K**i<N):
  i+=1

count=''
for j in range(i):
  M=N//(K**(i-j))
  count=str(M)+count
  N-=K**(i-j)*M
  
print(int(count))
Problem p02860 (python)

Fixed submission:
N=int(input())
S=str(input())
 
if N%2==1:
  print('No');exit()
  
print('Yes' if S[0:N//2]==S[N//2:N] else 'No')

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(input())

if S%2==1:
  print('No');exit()
  
print('Yes' if S[0:S//2-1]==S[S//2-1:N-1] else 'No')
Problem p02897 (python)

Fixed submission:
n=int(input())
if n==1:
  print(1)
elif n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)

Buggy submission (verdict: Runtime Error):
n=input()
if n==1:
  print(1)
elif n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)
Problem p02916 (python)

Fixed submission:
#N=input()
#N,M=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

total=sum(B)

for j in range(N):
  if j+1!=N:
    if A[j]+1==A[j+1]:
      total+=C[A[j]-1]
      
print(total)

Buggy submission (verdict: Runtime Error):
#N=input()
#N,M=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

total=sum(B)

for j in range(N):
  if j+1!=N:
    if A[j]+1==A[j+1]:
      total+=C[A[j-1]]
      
print(total)
Problem p02987 (python)

Fixed submission:
S=str(input())
a=0
for i in S:
  if S.count(i)==2:
    a+=1
    
print('Yes' if a==4 else 'No')

Buggy submission (verdict: Runtime Error):
S=str(input())
L=[]
for S in range(4):
  L.append(S)
L.sort()

print('Yes' if L[0]==S[1] and S[2]==S[3] else 'No')
Problem p03042 (python)

Fixed submission:
S=str(input())
A=int(S[0]+S[1])
B=int(S[2]+S[3])

if 0<A<=12 and 0<B<=12:
  print('AMBIGUOUS');exit()
elif (A>12 or A==0) and 0<B<=12:
  print('YYMM');exit()
elif 0<A<=12 and (B>12 or B==0):
  print('MMYY');exit()
else:
  print('NA');exit()

Buggy submission (verdict: Runtime Error):
S=str(input())

if 0<int(S[0]+S[1])<=12 and 0<int(S[2]+S[3])<=12:
  print('AMBIGUOUS');exit()
elif S[0]+S[1]=='00':
  print('NA');exit()
elif (S[0]+S[1]<=12 or S[2]+S[3]=='00') and int(S[0]+S[1])>12:
  print('YYMM');exit()
else:
  print('MMYY');exit()

Buggy submission (verdict: Runtime Error):
S=str(input())

if 0<int(S[0]+S[1])<=12 and 0<int(S[2]+S[3])<=12:
  print('AMBIGUOUS');exit()
elif S[0]+S[1]=='00':
  print('NA');exit()
elif  (S[0]+S[1]<=12 and S[2]+S[3]=='00') or int(S[0]+S[1])>12:
  print('YYMM');exit()
else:
  print('MMYY');exit()
Problem p03072 (python)

Fixed submission:
N=int(input())
H=list(map(int, input().split()))
Hi=0;a=0
for i in range(N):
  if int(H[i])>Hi:
    Hi=int(H[i])
    a+=1
  elif int(H[i])==Hi:
    a+=1
print(a)

Buggy submission (verdict: Runtime Error):
N=input()
H=list(map(int, input().split()))
Hi=0;a=0
for i in range(N):
  if int(H[i])>Hi:
    Hi=int(H[i])
    a+=1
  elif int(H[i])==Hi:
    a+=1
print(a)

Buggy submission (verdict: Runtime Error):
n=input()
H=list(map(int, input().split()))
Hi=0;a=0
for i in range(N):
  if int(H[i])>Hi:
    Hi=int(H[i])
    a+=1
  elif int(H[i])==Hi:
    a+=1
print(a)

Buggy submission (verdict: Runtime Error):
n=input()
H=list(map(int, input().split()))
Hi=0;a=0
for i in range(N):
  if H[i]>Hi:
    Hi=H[i]
    a+=1
  elif H[i]=Hi:
    a+=1
print(a)
Problem p03073 (python)

Fixed submission:
S=[]
for char in input():
  S.append(char)
#route 1
C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      C1+=1
  else:
    if S[i]=='0':
      C1+=1

#route 2
C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]=='0':
      C2+=1
  else:
    if S[n]=='1':
      C2+=1

if C2>=C1:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
for char in input():
  S.append(char)
#route 1
C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      C1+=1
  else:
    if S[i]=='0':
      C1+=1
      
#route 2
C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]=='0':
      C2+=1
  else:
    if S[n]=='1':
      C2+=1
      
if C1>=C2:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
for char in input():
  S.append(char)
#route 1
C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]=='1':
      C1+=1
  else:
    if S[i]=='0':
      C1+=1

#route 2
S=X
C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]=='0':
      C2+=1
  else:
    if S[n]=='1':
      C2+=1

if C1>=C2:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
S=[]
for char in input():
  S.append(char)
  
#route 1
C1=0
for i in range(len(S)):
  if i%2==0:
    if S[i]==1:
      S[i]=0
      C1+=1
  else:
    if S[i]==0:
      S[i]=1
      C1+=1

S=[]
for char in input():
  S.append(char)
#route 2
C2=0
for n in range(len(S)):
  if n%2==0:
    if S[n]==0:
      S[n]=1
      C2+=1
  else:
    if S[n]==1:
      S[n]=0
      C2+=1

if C1>=C2:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
S=[]
for char in input():
  S.append(char)

#route 2
C2=0
for n in range(int(len(S))+1):
  if n%2==0:
    if S[n]==0:
      S[n]=1
      C2+=1
  else:
    if S[n]==1:
      S[n]=0
      C2+=1
      
#route 1
C1=0
for i in range(int(len(S))+1):
  if i%2==0:
    if S[i]==1:
      S[i]=0
      C1+=1
  else:
    if S[i]==0:
      S[i]=1
      C1+=1

if C1>=C2:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
S=[]
for char in '000':
  S.append(char)

#route 2
C2=0
for n in range(int(len(S))+1):
  if n%2==0:
    if S[n]==0:
      S[n]=1
      C2+=1
  else:
    if S[n]==1:
      S[n]=0
      C2+=1
      
#route 1
C1=0
for i in range(int(len(S))+1):
  if i%2==0:
    if S[i]==1:
      S[i]=0
      C1+=1
  else:
    if S[i]==0:
      S[i]=1
      C1+=1

if C1>=C2:
  print(C1)
else:
  print(C2)

Buggy submission (verdict: Runtime Error):
S=[]
for char in '000':
  S.append(char)

#route 2
C2=0
for n in range(len(S)+1):
  if n%2==0:
    if S[n]==0:
      S[n]=1
      C2+=1
  else:
    if S[n]==1:
      S[n]=0
      C2+=1
      
#route 1
C1=0
for i in range(len(S)+1):
  if i%2==0:
    if S[i]==1:
      S[i]=0
      C1+=1
  else:
    if S[i]==0:
      S[i]=1
      C1+=1

if C1>=C2:
  print(C1)
else:
  print(C2)