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

Fixed submission:
s = input()
if s.find("7") != -1:
    print ("Yes")
else:
    print ("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
out = 0

def rgb (tmpstr, j, i, s):
    if s[j] != s[i]:
        tmpstr = s[j + 1 :  n]
        remain = "RGB".replace(s[j],"").replace(s[i],"")
        num = tmpstr.count(remain) 
        if (j + (j - i)) < len(s):
            if  s[j + (j - i)]  == remain:
                num = num - 1
        return num
    else:
        return 0
    
    
out = sum([sum([rgb(s[j + 1 :  n], j, i, s) for j in range(i+1, n-1)]) for i in range(n-2)])
#for i in range(n-2):
#    out += sum([rgb(s[j + 1 :  n], j, i, s) for j in range(i+1, n-1)])
print(out)
Problem p02729 (python)

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

print(int(n * (n-1) / 2 + m * (m - 1) / 2))

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

values = {}
for i in nums:
  if i in values: values[i] += 1
  else: values[i] = 1

sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数（ボールがないとき版
allsum = 0
for k,v in values.items():
  sums[k] = v * (v - 1) / 2
  undersum = (v - 2) * (v - 1) / 2 if v > 1 else 0
  subsums[k] = sums[k] - undersum
  allsum += sums[k]

# res={} # 各値のない時版 + 他の合計
# for k,v in sums.items():

for i in nums:
  print(int(allsum - subsums[i]))
Problem p02836 (python)

Fixed submission:
a = input()
b = 0
c = -1
d = 0
 
for i in range(len(a)):
    if a[b] != a[c]:
      d = d + 1
    b = b + 1
    c = c - 1

print(d//2)

Buggy submission (verdict: Runtime Error):
a = input()
b = 0
C = -1
d = 0

for i in range(len(a)):
	if a[b] != a[c]:
      d = d + 1
    b = b + 1
    C = c - 1

print(d/2)
Problem p02847 (python)

Fixed submission:
S = input()
a = 0
 
if S == 'SUN':
  a = 7
elif S == 'MON':
  a = 6
elif S == 'TUE':
  a = 5
elif S == 'WED':
  a = 4
elif S == 'THU':
  a = 3
elif S == 'FRI':
  a = 2
elif S == 'SAT':
  a = 1

print(a)

Buggy submission (verdict: Runtime Error):
S = input()
a = 0

if S = 'SUN':
  a = 7
elif S = 'MON':
  a = 6
elif S = 'TUE':
  a = 5
elif S = 'WED':
  a = 4
elif S = 'THU':
  a = 3
elif S = 'FRI':
  a = 2
elif S = 'SAT':
  a = 1

print(a)
Problem p02873 (python)

Fixed submission:
s=input()
rl=[]
ll=[]
c=0
for i in range(len(s)-1):
  c+=1
  if s[i]!=s[i+1]:
    if s[i]=='<':
      rl.append(c)
    else:
      ll.append(c)
    c=0
if s[len(s)-1]=='<':
  rl.append(c+1)
else:
  ll.append(c+1)

rn=len(rl)
ln=len(ll)
ans=0
if s[0]=='<':
  for i in range(ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn>ln:
    ans+=rl[-1]*(rl[-1]+1)//2
else:
  rl=[0]+rl
  ans+=ll[0]*(ll[0]+1)//2
  for i in range(1, ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn==ln:
    ans+=rl[-1]*(rl[-1]+1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
rl=[]
ll=[]
c=0
for i in range(len(s)-1):
  c+=1
  if s[i]!=s[i+1]:
    if s[i]=='<':
      rl.append(c)
    else:
      ll.append(c)
    c=0
if s[len(s)-1]=='<':
  rl.append(c+1)
else:
  ll.append(c+1)

rn=len(rl)
ln=len(ll)
ans=0
if s[0]=='<':
  for i in range(ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn>ln:
    ans+=rl[-1]*(rl[-1]+1)//2
else:
  ans+=ll[0]*(ll[0]+1)//2
  for i in range(rn-1):
    M=max(rl[i], ll[i+1])
    m=min(rl[i], ll[i+1])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn==ln:
    ans+=rl[-1]*(rl[-1]+1)//2
  else:
    M=max(rl[-1], ll[-1])
    m=min(rl[-1], ll[-1])
    ans+=M*(M+1)//2+m*(m-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
rl=[]
ll=[]
c=0
for i in range(len(s)-1):
  c+=1
  if s[i]!=s[i+1]:
    if s[i]=='<':
      rl.append(c)
    else:
      ll.append(c)
    c=0
if s[len(s)-1]=='<':
  rl.append(c+1)
else:
  ll.append(c+1)

rn=len(rl)
ln=len(ll)
ans=0
if s[0]=='<':
  for i in range(ln):
    M=max(rl[i], ll[i])
    m=min(rl[i], ll[i])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn>ln:
    ans+=rl[-1]*(rl[-1]+1)//2
else:
  ans+=ll[0]*(ll[0]+1)//2
  for i in range(rn):
    M=max(rl[i], ll[i+1])
    m=min(rl[i], ll[i+1])
    ans+=M*(M+1)//2+m*(m-1)//2
  if rn==ln:
    ans+=rl[-1]*(rl[-1]+1)//2
print(ans)
Problem p02880 (python)

Fixed submission:
n = int(input())

for i in range(1, 10):
  if n % i ==0:
    if n/i < 10:
      print('Yes')
      break
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())

for i in range(1, 10):
  if n % i ==0:
    if n/i < 10:
      print('Yes')
      brake
else:
  print('No')
Problem p02951 (python)

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

if a > b + c:
  print(0)
else:
  print(c+b-a)

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

if a > b + c:
  print(0)
else:
  print(c+b-a)

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

if a > b + c:
  print(0)
else:
  print(c-b)
Problem p02987 (python)

Fixed submission:
S = input()

if S[0] == S[1] == S[2] == S[3]:
  print('No')
elif S[0] == S[1] and S[2] == S[3]:
  print('Yes')
elif S[0] == S[2] and S[1] == S[3]:
  print('Yes')
elif S[0] == S[3] and S[1] == S[2]:
  print('Yes')
else:
  print('No')

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

if S[0] = S[1] and S[2] = S[3]
or S[0] = S[2] and S[1] = S[3]
or S[0] = S[3] and S[1] = S[2]:
  print(Yes)
else:
  print(No)
Problem p03011 (python)

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

t = sorted(time)

print(t[0]+t[1])

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

t = soated(time)

print(t[0]+t[1])

Buggy submission (verdict: Runtime Error):
p, q, r = map(int, input().split())

total = soated(p, q, r)

print(total[0]+total[1])
Problem p03013 (python)

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

up = [0]*(m+1)
if m == 0:
  up[0] = n
else:
  up[0] = a[0]-1
  up[m] = n - a[m-1]-1
  for i in range(m-1):
    up[i+1] = a[i+1]-a[i]-2

ans = 1
if -1 in up:
  ans = 0
else:
  f = [0]*(max(up)+1)
  f[0] = 1
  if max(up) > 0:
    f[1] = 1
    for i in range(2, max(up)+1):
      f[i] = f[i-1] + f[i-2]
  for i in range(m+1):
    ans *= f[up[i]]

print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0]*m
for i in range(m):
  a[i] = int(input())

up = [0]*(m+1)
if m == 0:
  up[0] = n
else:
  up[0] = a[0]-1
  up[m] = n - a[m-1]-1
  for i in range(m-1):
    up[i+1] = a[i+1]-a[i]-2

ans = 1
if -1 in up:
  ans = 0
else:
  f = [0]*(max(up)+1)
  f[0] = 1
  f[1] = 1
  for i in range(2, max(up)+1):
    f[i] = f[i-1] + f[i-2]
  for i in range(m+1):
    ans *= f[up[i]]

print(ans % 1000000007)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0]*m
for i in range(m):
  a[i] = int(input())

up = [0]*(m+1)
up[0] = a[0]-1
up[m] = n - a[m-1]-1
ans = 1
for i in range(m-1):
  up[i+1] = a[i+1]-a[i]-2

if -1 in up:
  ans = 0
else:
  f = [0]*(max(up)+1)
  f[0] = 1
  f[1] = 1
  for i in range(2, max(up)+1):
    f[i] = f[i-1] + f[i-2]
  for i in range(m+1):
    ans *= f[up[i]]

print(ans % 1000000007)
Problem p03041 (python)

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 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)if s[k-1] == 'A':
  s[k-1] = 'a'
Problem p02933 (python)

Fixed submission:
a = int(input())
b = input()

if a>= 3200:
  print(b)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = input()

if a>+= 3200:
  print('red')
else:
  print(b)
Problem p03075 (python)

Fixed submission:
a = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in range(len(a)):
    if a[j] - i >k:
      ans = ':('
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in len(a):
    if a[j] - i >k:
      ans = ':('
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in len(a):
    if a[j] - i >18:
      ans = ':('
print(ans)
Problem p02970 (python)

Fixed submission:
n,d=map(int,input().split())
x=2*d+1
if(n%x!=0):
    print(int(n/x)+1)
else:
    print(int(n/x))

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
if(d>=10){
print(1)
}else{
x=2*d+1
print(int(n/x)+1)
}
Problem p02987 (python)

Fixed submission:
a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d and a!=c):
        count+=1
elif(a==c):
    count+=1
    if(b==d and a!=b):
        count+=1
elif(a==d):
    count+=1
    if(b==c and a!=b):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split())) 
print(len(d))

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)]-d[int(len(d)/2)-1])

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d and a!=c):
        count+=1
elif(a==c):
    count+=1
    if(b==d and a!=b):
        count+=1
elif(a==d):
    count+=1
    if(b==c ana a!=b):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d):
        count+=1
else if(a==c):
    count+=1
    if(b==d):
        count+=1
else if(a==d):
    count+=1
    if(b==c):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
count=0

if(a==b):
    count+=1
    if(c==d):
        count+=1
else if(a==c):
    count+=1
    if(b==d):
        count+=1
else if(a==d):
    count+=1
    if(b==c):
        count+=1

if(count==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
count=0

if(a==b or a==c or a==d):
    count+=1

if(b==c or b==d or c==d):
    if(b!=a and c!=a and d!=a):
    count+=1

if(count==2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=input()
count=0

if(a==b or a==c or a==d):
    count+=1

if(b==c or b==d or c==d):
    if(b!=a and c!=a and d!=a)
    count+=1

if(count==2):
    print("Yes")
else:
    print("No")
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split())) 
d.sort()

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)]-d[int(len(d)/2)-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split())) 
d.sort()

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)+1]-d[int(len(d)/2)])

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

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)+1]-d[int(len(d)/2)])

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split())) 
print(len(d))

if(len(d)%2!=0):
    print(0)
else: 
    print(d[int(len(d)/2)+1]-d[int(len(d)/2)])
Problem p02831 (python)

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

if a < b:
    tmp = a
    a = b
    b =tmp
r = a%b
while(r != 0):
    a = b
    b = r
    r = a % b

print(int(x/b))

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

print((a * b) // math.gcd(a, b))
Problem p02712 (python)

Fixed submission:

N = input()
N = int(N)

s_all = sum(range(N+1))
fizz = sum(list(range(3,N+1,3)))
buzz = sum(list(range(5,N+1,5)))

fb = sum(list(range(15,N+1,15)))

print(s_all-fizz-buzz+fb)

Buggy submission (verdict: Runtime Error):

N = input()
N = int(N)

s_all = sum(N)
fizz = sum(list(range(3,N,3)))
buzz = sum(list(range(5,N,5)))

fb = sum(list(range(15,N,15)))

print(s_all-fizz-buzz+fb)
Problem p02785 (python)

Fixed submission:
N, K = [int(_) for _ in input().split()]
H = [int(_) for _ in input().split()]
H.sort(reverse=True)
print(sum(H[K:]))

Buggy submission (verdict: Runtime Error):
N, K = [int(_) for _ in input().split()]
H = [int(_) for _ in input().split()]
list_H = sorted(H, reverse=True)
for k in range(K):
    list_H.pop(k)
attack = 0
for i in H:
    attack += i
print(attack)
Problem p02790 (python)

Fixed submission:
L, R = map(int,input().split())
l = str(L)
r = str(R)
last_l = ""
last_r = ""
for i in range(L):
    last_r += r 
for i in range(R):
    last_l += l     
if L > R:
    print(last_r)
else:
    print(last_l)

Buggy submission (verdict: Runtime Error):
L, R = map(int,input().split())
l = str(L)
r = str(R)
last_l = ""
last_r = ""
for i in range(L):
    last_r += r 
for i in range(R):
    last_l += l     
if L > R:
    print(last_r)
else:
    print(last_l
Problem p02711 (python)

Fixed submission:
n = str(input())
if n.find('7') != -1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
s = input()

r_count = s.count('R')
g_count = s.count('G')
b_count = s.count('B')

answer = r_count*g_count*b_count


n_temp = min(n, math.ceil(n/3)+6)
for k in range(1, n_temp):
    for i in range(k):
        extracted = s[i::k]
        if len(extracted) >= 3:
            for l in range(len(extracted)-2):
                temp = extracted[l:l+3]
                if temp.count('R') == 1 and temp.count('G')==1 and temp.count('B'):
                    answer -= 1

print(answer)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
s = input()

r_count = s.count('R')
g_count = s.count('G')
b_count = s.count('B')

answer = r_count*g_count*b_count


for k in range(1, min(n, math.ceil(n/3)+6)):
    for i in range(k):
        extracted = s[i::k]
        if len(extracted) >= 3:
            for l in range(len(extracted)-2):
                temp = extracted[l:l+3]
                if temp.count('R') == 1 and temp.count('G')==1 and temp.count('B'):
                    answer -= 1

print(answer)
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())

if n % 2 != 0:
  print(n//2 + 1)
 
else:
  prnit(n//2)
Problem p02987 (python)

Fixed submission:
S = input()
SL = list(S)

if SL[0] == SL[1] and SL[1] == SL[2]:
    print('No')
elif SL[0] == SL[1] and SL[2] == SL[3]:
    print('Yes')
elif SL[0] == SL[2] and SL[1] == SL[3]:
    print('Yes')
elif SL[0] == SL[3] and SL[1] == SL[2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))
count = 0


for i in range(0,N-2):
    if p[i] < p[i+1] and p[i+1] < p[i+2]:
        count += 1
print(count)
Problem p02897 (python)

Fixed submission:
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

N = int(input())

if N%2==0:
    odd_count = N//2
else:
    odd_count = N//2+1
print('{:.10f}'.format(odd_count/N))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
friends = map(int, input().split())


n = len([1 for x in friends if x>=K])

print(n)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
friends = list(map(int, input().split()))

n = len([1 for x in friends if x>K])

print(n)
Problem p03107 (python)

Fixed submission:
s = input()
count1 = s.count('1')
count0 = s.count('0')

if count0 >= count1:
    print(count1*2)
else:
    print(count0*2)

Buggy submission (verdict: Runtime Error):
"""
    S：長さNの文字列
    if S[i] = '0':
        color = 'red'
    elif S[i] = '1':
        color = 'blue'
    
    I can remove set of boxes which put together red and blue box.

    output : How many can I remove box?
"""
s = input()
count = 0

while len(s) > 0:
    i = 0

    while i < len(s):
        if i == len(s)-1:
            break
        if (s[i+1] == '0' and s[i+2] =='1') or (s[i+1] == '1' and s[i+2] =='1'):
            s = s[:i+1]+s[i+3:]
            count += 1
            break
        i += 1
    if i == len(s)-1:
            break

print(count*2)
Problem p03186 (python)

Fixed submission:

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

if a+b+1 > c:
    count = b+c
else:
    count = b+(a+b+1)

print(count)

Buggy submission (verdict: Runtime Error):

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

if a+b+1 > c:
    count = b+c
else
    count = b+(a+b+1)

print(count)
Problem p02723 (python)

Fixed submission:
S = input()
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
m = n%500
print(int((n - m)*1000/ 500 + m*5//5))

Buggy submission (verdict: Runtime Error):
S = input()
if S[3] == S[4] and S[5] == S[6]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
if S[3] == S[4] and S[5] == S[6]:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
s = input()
if  s[3] == s[4] and s[5] == s[6]:
  print('yes')
else:
  print('no')

Buggy submission (verdict: Runtime Error):
s = input()
if  s[3] == s[4] and s[5] == s[6]:
  print(yes)
else:
  print(no)

Buggy submission (verdict: Runtime Error):
input()
s = [input()]
if s[3] == [4] and s[5] == s[6]:
  print('yes')
else:
  print('no')
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == n[1] and s[1] == s[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
if S[0] == s[1] and s[1] == s[2]:
  print('Yes')
else:
  print('No')

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

Fixed submission:
a, b = (int(x) for x in input().split())
a1 = str(a)*b
b1 = str(b)*a
lis = [a1, b1]
new_lis = sorted(lis)
print(new_lis[0])

Buggy submission (verdict: Runtime Error):
a, b = (int(x) for x in input().split())
a = str(a)*b
b = str(b)*a
lis = [a, b]
new_lis = soted(lis)
print(new_lis[1])
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())

a= list(map(int,input().split()))


print(gcd_list(a))

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce

def gcd(*numbers):
    return reduce(fraction.gcd, numbers)

def gcd_list(numbers):
    return reduce(fraction.gcd, numbers)

N = int(input())

a= list(map(int,input().split()))


print(gcd_list(a))

Buggy submission (verdict: Runtime Error):


import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())

a= list(map(int,input().split()))


print(gcd_list(a))

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())

a= list(map(int,input().split()))


print(gcd_list(a))
Problem p03072 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)

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

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

Fixed submission:
s = list(str(input()))
S = []
for i in range(len(s)):
  S.append(int(s[i]))
ans1 = 100000
ans2 = 100000
ans = 0
t = 0
s = 0

if S[0]==0:
  for i in range(1,len(S),2):
    if S[i] != 1:
      t += 1
  for i in range(0,len(S),2):
    if S[i] != 0:
      s += 1
  ans1 = min(t+s,len(S)-t-s)
else:
  for i in range(1,len(S),2):
    if S[i] != 0:
      t += 1
  for i in range(0,len(S),2):
    if S[i] != 1:
      s += 1
  ans2 = min(t+s,len(S)-t-s) 
ans=min(ans1,ans2)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i in range(1,N):
  if H[i]>=max(H[:i]):
    ans += 1
print(ans)
Problem p03242 (python)

Fixed submission:
N = list(input())
for i in range(len(N)):
  if N[i] == "1":
    print("9", end="")
  else:
    print("1", end="")

Buggy submission (verdict: Runtime Error):
n = input()
a = 9 if n[0]="1" else a = 1
b = 9 if n[1]="1" else b = 1
c = 9 if n[2]="1" else c = 1
print(a*100+b*10+c)
Problem p03250 (python)

Fixed submission:
A,B,C = map(int, input().split())
if A >= B and A >= C:
  print(A*10+B+C)
elif B >= A and B >= C:
  print(B*10+A+C)
else:
  print(C*10+A+B)

Buggy submission (verdict: Runtime Error):
x = split(input()," ")
for i in range(len(x)):
  if int(x[i]) >= int(x[i-1]) and int(x[i]) >= int(x[i+1]):
    print (10*int(x[i])+int(x[i-1])+int(x[i+1]))
Problem p03315 (python)

Fixed submission:
S = input()
number = 0
for i in range(len(S)):
    if S[i] == "+":
        number += 1
    else:
        number -= 1
print(number)

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for n in N:
  S += int(n)
N = int(N)
print("Yes" if N%S == 0 else "No")
Problem p02912 (python)

Fixed submission:
import heapq
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(n):
    heapq.heappush(b, a[i] * (-1))

while m > 0:
    bb = ((heapq.heappop(b) * (-1)) // 2) * (-1)
    heapq.heappush(b, bb)
    m -= 1

total = 0
for i in range(n):
    total += b[i] * -1

print(total)

Buggy submission (verdict: Runtime Error):
# 2より大きい値段のものに高いものから順に割引券を振り分けていく
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: -x)
coupon = [0 for i in range(n)]

v = 0
for i in range(n):
    if a[i] > 2:
        v += 1

i = 0
while m > 0 and v > 0:
    if len(a) == 1:
        coupon[i] = m
        break
    if a[i] > 2:
        l = a[i] // 2**(coupon[i]+1)
        if l >= 0:
            coupon[i] += 1
            if l == 0:
                v -= 1
        m -= 1
        i += 1
    elif a[i] <= 2 and m > 0:
        i = 0

total = 0
for i in range(n):
    if a[i] < 3 and m > 0:
      total += a[i] // 2
      m -= 1
    else:
      total += a[i] // 2**coupon[i]

print(total)
Problem p03221 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
n,m = list(map(int, readline().split()))
py = []
for _ in range(m):
    py.append(list(map(int, readline().split())))

spy = sorted(py, key=lambda x: x[1])

Y = {}
for i in range(m):
    Y[spy[i][1]] = 0

P = [0 for _ in range(n+1)]

for i in range(m):
    P[spy[i][0]] += 1
    Y[spy[i][1]] = P[spy[i][0]]

for i in range(m):
    print(str(py[i][0]).zfill(6) + str(Y[py[i][1]]).zfill(6))

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
n,m = list(map(int, readline().split()))
py = []
for _ in range(m):
    py.append(list(map(int, readline().split())))

spy = sorted(py, key=lambda x: x[1])
M = len(spy)

Y = {}
for i in range(M):
    Y[spy[i][1]] = 0

P = [0 for _ in range(M+1)]

for i in range(M):
    P[spy[i][0]] += 1
    Y[spy[i][1]] = P[spy[i][0]]

for i in range(m):
    print(str(py[i][0]).zfill(6) + str(Y[py[i][1]]).zfill(6))

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
n,m = list(map(int, readline().split()))
py = []
for _ in range(m):
    py.append(list(map(int, readline().split())))

spy = sorted(py, key=lambda x: x[1])

Y = {}
for i in range(m):
    Y[spy[i][1]] = 0

P = [0 for _ in range(m+1)]

for i in range(m):
    P[spy[i][0]] += 1
    Y[spy[i][1]] = P[spy[i][0]]

for i in range(m):
    print(str(py[i][0]).zfill(6) + str(Y[py[i][1]]).zfill(6))
Problem p02711 (python)

Fixed submission:
N = input()
flag = False
for i in range(len(N)):
  if(N[i] == "7"):
    flag = True
if flag: 
    print("Yes")
else: 
    print("No")

Buggy submission (verdict: Runtime Error):
N = input()
flag = false
for i in range(N):
  if N[i] == "7":
    flag = true
if flag: print("Yes")
else: print("No")