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

Fixed submission:
n = int(input())
hs = input().split()
count = 1
maxh = 0
for i in range(1,n):
    maxh = max(maxh, int(hs[i-1]))
    if int(hs[i])>=maxh:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
hs = input().split()
count = 1
maxh = 0
for i in range(1,n):
    maxh = max(maxh, int(hs[i-1]))
    if int(hs[i])=>maxh:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
hs = map(int, input().split())
count = 1
maxh = 0
for i in range(1,n):
	maxh = max(maxh, hs[i-1])
	if hs[i]>maxh:
		count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
hs = map(int, input.split())
count = 1
maxh = 0
for i in range(1,n):
	maxh = max(maxh, hs[i-1])
	if hs[i]>maxh:
		count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
hs = map(int, input.split())
count = 1
maxh = 0
for i in range(1,n):
  maxh = max(maxh, hs[i-1])
  if hs[i]>maxh:
    count += 1
 print(count)
Problem p03073 (python)

Fixed submission:
colors = input()
l = len(colors)
count1 = 0
for i in range(l):
	if int(colors[i]) == (i % 2):
		count1 += 1
print(min(count1, l-count1))

Buggy submission (verdict: Runtime Error):
l = len(colors)
count1 = 0
for i in range(l):
	if int(colors[i]) == (i % 2):
		count1 += int(colors[i])
print(min(count1, l-count1))

Buggy submission (verdict: Runtime Error):
l = len(colors)
count1 = 0
for i in range(l):
	if colors[i] == i % 2:
		count1 += int(colors[i])
print(min(count1, l-count1))

Buggy submission (verdict: Runtime Error):
colors = input()
l = len(colors)
count1 = 0
for i in range(l):
  count1 += int(colors[i])
 print(min(count1, l-count1))
Problem p03107 (python)

Fixed submission:
S = input()
s = [int(S[i:i + 1]) for i in range(len(S))]
ans = 0
v1 = s[0]
index = []
index.append(0)
for i in range(1, len(s)):
    if v1 != s[i] and len(index) != 0:
        ans += 2
        index.pop(-1)
        if len(index) != 0:
            v1 = s[index[-1]]
        else:
            v1 = 10
    else:
        index.append(i)
        v1 = s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
print(min(S.count('1'), S.count('0'))
Problem p03108 (python)

Fixed submission:
N, M = map(int, input().split())
A = []
B = []
for _ in range(M):
    a, b = map(int,  input().split())
    A.append(a)
    B.append(b)
ans = []
ans.append(N * (N - 1) / 2)

n = [-1 for i in range(N)]

def find(x):
    if n[x] < 0:
        return x
    n[x] = find(n[x])
    return n[x]

def size(x):
    return -n[find(x)]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if size(x) < size(y):
        x, y = y, x
    n[x] += n[y]
    n[y] = x
    return 1

for i in range(1, M):
    sab = size(A[-i] - 1) * size(B[-i] - 1)
    if unite(A[-i] - 1, B[-i] - 1) == 0:
        ans.append(ans[i - 1])
    else:
        ans.append(ans[i - 1] - sab)
for i in range(1, M + 1):
    print(int(ans[-i]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
B = []
for _ in range(M):
    a, b = map(int,  input().split())
    A.append(a)
    B.append(b)
ans = []
ans.append(N * (N - 1) / 2)

n = [-1 for i in range(N)]

def find(x):
    if n[x] < 0:
        return x
    return n[x] = find(n[x])

def size(x):
    return -n[find(x)]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    n[x] += n[y]
    n[y] = x
    return 1

for i in range(1, M):
    if unite(A[-i], B[-i]) == 0:
        ans.append(ans[i])
    else:
        ans.append(ans[i] - size(A[-i]) * size(B[-i]))
for i in range(M):
    print(ans[-i])
Problem p03834 (python)

Fixed submission:
print(*input().split(','))

Buggy submission (verdict: Runtime Error):
print(*input().split(',')
Problem p03250 (python)

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(c*10 + b + a)

Buggy submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input.split()))
print(c*10 + b + a)
Problem p03834 (python)

Fixed submission:
a,b,c=input().split(",")
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split(","))
print(a,b,c)
Problem p03250 (python)

Fixed submission:
a = sorted(list(map(int, input().split())))
print(10*a[2]+a[1]+a[0])

Buggy submission (verdict: Runtime Error):
a = sorted(map(int),input().split())
print(10*a[0]+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
a = sorted(map(int), list(input().split()))
print(10*a[0]+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
a = list(input().split()).sort()
print(int(a[0])*10+int(a[1])+int(a[2]))

Buggy submission (verdict: Runtime Error):
a = list(input().split()).sort()
print(a[0]*10+a[1]+a[2])
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Bob")
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e-a <= k:
	print("Yay!")
else:
	print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
e = int(input())
k = int(input())
if e-a =< k:
  print("Yay!")
else:
  print(":(")
Problem p03072 (python)

Fixed submission:
def main():
    n = input()
    s = input()
    raw_list = list(map(int, s.split()))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = input()
    s = input()
    raw_list = list(map(int, raw_list))

    max = raw_list[0]
    count = 1

    for i in range(1,len(raw_list)):
        if raw_list[i] >= max:
            count += 1
            max = raw_list[i]
    print (count)

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

Fixed submission:
s = input()
print(s.count('+')*1+s.count('-')*-1)

Buggy submission (verdict: Runtime Error):
s = input()
print(+1 if + else -1 if -)
Problem p03631 (python)

Fixed submission:
n = input()
print('Yes' if n[0]==n[2] else 'No')

Buggy submission (verdict: Runtime Error):
n = input().range(3)
print('Yes' if n[0]==n[2] else 'No')

Buggy submission (verdict: Runtime Error):
n = input()
print('YES' if n==::n else 'NO')
Problem p03705 (python)

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

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
else:
    print((B-A)*(N-2)+1)

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

if A > B:
    print(0)
elif N == 1:
    print(0)

else:
    print((B-A)(N-2)+1)

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

cnt = 0

if A > B:
    print(0)
elif N == 1:
    if A == B:
        print(1)
    else:
        print(0)
else:
    print((B-A)(N-2)+1)
Problem p03075 (python)

Fixed submission:
#!/usr/bin/env python
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if int(e) - int(a) > int(k):
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if int(e) - int(a) > k:
    print(":(")
else:
    print("Yay!")
Problem p03075 (python)

Fixed submission:
a,b,c,d,e,k = [int(input()) for _ in range(6)]
print(':(' if e-a > k else "Yay!")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k = map(int, input().split())
print(':(' if e-a > k else "Yay!")
Problem p03834 (python)

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

Buggy submission (verdict: Runtime Error):
abcde,fghihgf,edcba
Problem p03073 (python)

Fixed submission:
s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy submission (verdict: Runtime Error):
s = input()
a = s[::2].count('0') + s[1::2].count('1')
a = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy submission (verdict: Runtime Error):
s = input()
a = s[::2].count('0') + s[1::2].count('1')
a = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

Buggy submission (verdict: Runtime Error):
s = input()
a = s[::2].count(0) + s[1::2].count(1)
b = s[::2].count(1) + s[1::2].count(0)
print(min(a, b))

Buggy submission (verdict: Runtime Error):
s = input()
a = s[::2].count(0) + s[1::2].count(1)
b = s[::2].count(1) + s[1::2].count(0)
print(min(a, b)
Problem p03317 (python)

Fixed submission:
import math

N, K = map(int, input().split())
input()

print(math.ceil((N-1)/(K-1)))

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

center = A.index(1)
left_block = center + 1
right_block = len(A) - center

left_num = 0
if left_block > K:
    tmp = left_block
    while tmp > 0:
        tmp = tmp - K + 1
        left_num += 1
        if tmp == K:
            left_num -= 1
elif 2 <= left_block <= K:
    left_num = 1

right_num = 0
if right_block > K:
    tmp = right_block
    while tmp > 0 :
        tmp = tmp - K + 1
        right_num += 1
        if tmp == K:
            right_num -= 1
elif 2 <= right_block <= K:
    right_num = 1

print(left_num + right_num)

# D
K = int(input())
Problem p03775 (python)

Fixed submission:
N = int(input())

ans = []
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        ans.append(i)
        ans.append(int(N/i))

if N == 1:
    print("1")
else:
    print(len(str(ans[-1])))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

ans = []
for i in range(1, round(math.sqrt(N))):
    if N % i == 0:
        tmp = max(len(str(i)), len(str(N//i)))
        ans.append(tmp)

print(min(ans))
Problem p03075 (python)

Fixed submission:
a,b,c,d,e,k=int(input()),int(input()),int(input()),int(input()),int(input()),int(input())
if e-a > k:
  print(':(')
else:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=int(input()),int(input()),int(input()),int(input()),int(input()),int(input())
k = inputs.pop(5)
if inputs[-1] - inputs[0] > k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
inputs = []
while 1:
  tmp = input()
  if tmp:
    inputs.append(tmp)
  else:
    break
k = inputs.pop(5)
if inputs[-1] - inputs[0] > k:
  print('Yay!')
else:
  print(':(')
Problem p03208 (python)

Fixed submission:
NK = input().split(' ')
N, K = int(NK[0]), int(NK[1])
trees = []
for i in range(N):
  trees.append(int(input()))
trees.sort()
min = float("inf")
for i in range(N-K+1):
  h = trees[i+K-1]-trees[i]
  if h < min:
    min = h
print(min)

Buggy submission (verdict: Runtime Error):
NK = input().split(' ')
N, K = int(NK[0]), int(NK[1])
trees = []
for i in range(N):
  trees.append(int(input()))
trees.sort(reversed=True)
min = 0
for i in range(N-K):
  h = trees[i+K]-trees[i]
  if h < min:
    min = h
print(min)

Buggy submission (verdict: Runtime Error):
NK = input().split(' ')
N, K = int(NK[0]), int(NK[1])
trees = []
current = 0
for i in range(N):
  tree = int(input())
  if len(trees) < K:
    trees.append(tree)
  elif tree > min(trees) and tree < max(trees):
    trees.append(tree)
    tmp1 = trees.remove(min(trees))
    tmp2 = trees.remove(max(trees))
    if max(tmp1)-min(tmp1) > max(tmp2)-min(tmp2):
      trees = tmp2
    else:
      trees = tmp1
print(max(trees)-min(trees))
Problem p03107 (python)

Fixed submission:
s = input()
print(2*min(s.count('0'), s.count('1')))

Buggy submission (verdict: Runtime Error):
s = input()
count = 0
flag = True
while flag == True:
    flag = False
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            s = s[0:i]+s[i+2:]
            count += 2
            flag = True

print(count)
Problem p03075 (python)

Fixed submission:
a, b, c, d, e, k = [int(input()) for i in range(6)]
if e-a<=k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in input().split()] 
if a[4]-a[0]<=a[5]:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, k = (int(i) for i in input().split())
_dis=[a,b,c,d,e]
if a-e>k:
  print(":(")
else:
  print("Yay!")
Problem p03072 (python)

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

result = 0
now_max = 0

for i in range(n):
    if h[i] >= now_max:
        result = result + 1
        now_max = h[i]

print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
st = input()
h = []
for i in range(n):
  h.append(int(st[2*i]))
  
result = 0
now_max = 0

for i in range(n):
  if h[i] >= now_max:
    result = result + 1
    now_max = h[i]
             
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
st = input()
h = []
for i in range(n):
  h.append(int(st[2*i]))
  
result = 1
now_max = h[0]

for i in range(1,n):
  if h[i] >= now_max:
    result = result + 1
    now_max = h[i]
             
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(input()) for i in range(n)]
result = 1
now_max = h[0]

for i in range(1,n):
  if h[i] >= now_max:
    result = result + 1
    now_max = h[i]
             
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(input()) for i in range(n)]
result = 1

for i in range(1,n):
  if h[i] >= h[i-1]:
    	result = result + 1
      
print(result)
Problem p03072 (python)

Fixed submission:
N = int(input())
H = [int(i) for i in input().split()]
m = 0
b = 0
for a in H:
  if b <= a:
    m += 1
  b = max(b,a)
print(m)

Buggy submission (verdict: Runtime Error):
N = int(input())
m = 0
b = 0
for _ in range(N):
  a = int(input())
  if b <= a:
    m += 1
  b = max(b,a)
print(m)
Problem p03073 (python)

Fixed submission:
c2,c3 = 0,0
def ret(a,b,c):
  global c2,c3
  if a == b:
    if c == 2:
      c2 += 1
    else:
      c3 += 1
    if b == "0":
      return "1"
    else:
      return "0"
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0],3)
  S3[j] = ret(S3[j-1],k,3)
print(c2 if c2 <= c3 else c3)

Buggy submission (verdict: Runtime Error):
c2,c3 = 0,0
def ret(a,b,c):
  global c2,c3
  if a == b:
    if c == 2:
      c2 += 1
    else:
      c3 += 1
    if b == "0":
      return "1"
    else:
      return "0"
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
  print(S2,c2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0],3)
  S3[j] = ret(S3[j-1],k,3)
  print(S3,c3)
print(c2 if c2 <= c3 else c3)

Buggy submission (verdict: Runtime Error):
def ret(a,b,c):
  global c2,c3
  if a == b:
    if b == "0":
      return "1"
   	else:
      return "0"
    if c == 2:
      c2 += 1
    else:
      c3 += 1
  else:
    return b
S = input()
S2,S3 = list(S),list(S)
c2,c3 = 0,0
default = S2[0]
for j,k in enumerate(S2):
  if j == 0:
    continue
  S2[j] = ret(S2[j-1],k,2)
for j,k in enumerate(S3):
  if j == 0:
    S3[0] = ret(default,S3[0])
  S3[j] = ret(S3[j-1],k,3)
print(c2 if c2 >= c3 else c3)
Problem p03072 (python)

Fixed submission:
N=int(input())
H=[int(x) for x in input().split()]
can_watch = 0
for i in range(N):
  if i > 0:
    if H[i] >= max(H[:i]):
      can_watch = can_watch + 1
    else:
      pass
  else:
    can_watch = can_watch + 1
print(can_watch)

Buggy submission (verdict: Runtime Error):
N=int(input())
H=[int(x) for x in input().split()]
can_watch = 0
for i in range(N):
  if H[i] >= max(H[:i]):
    can_watch = can_watch + 1
  else:
    pass
print(can_watch)
Problem p03127 (python)

Fixed submission:
from fractions import gcd

input()
a = list(map(int, input().split()))
l = a[0]
for i in a[1:]:
    l = gcd(l,i)
print(l)

Buggy submission (verdict: Runtime Error):
from fraction import gcd
from functools import reduce
input()
print(reduce(gcd,list(map(int,input().split()))))

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int, input().split()))
l = a[0]
for i in a[1:]:
    l = math.gcd(l,i)
print(i)

Buggy submission (verdict: Runtime Error):
import math
import functools

input()
a = list(map(int, input().split()))
l = a[0]
for i in a[1:]:
    l = math.gcd(l,i)
print(i)

Buggy submission (verdict: Runtime Error):
import math
import functools

n = int(input())
print(functools.reduce(math.gcd, list(map(int, input().split()))))

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

n = int(input())
print(reduce(math.gcd, list(map(int, input().split()))))

Buggy submission (verdict: Runtime Error):
n = int(input())
hp_list = list(map(int, input().split()))
i = min(hp_list)
while True:
    dividable = True
    for j in hp_list:
        if j % i != 0:
            dividable = False
    if dividable:
        break
    else:
        for j in range(2, i + 1):
            if i % j == 0:
                i /= j
                break
print(int(i))

Buggy submission (verdict: Runtime Error):
n = int(input())
hp_list = list(map(int, input().split()))
i = min(hp_list)
while True:
    dividable = True
    for j in hp_list:
        if j % i != 0:
            dividable = False
    if dividable:
        break
    else:
        for j in range(2, i + 1):
            if i % j == 0:
                i /= j
                break
print(i)
Problem p03072 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
max = l[0]
count = 0
for i in range(n):
  if l[i] >= max:
    count += 1
    max = l[i]
    
print(count)

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

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

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

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

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

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

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

print(count)
Problem p03073 (python)

Fixed submission:
S = input()
c1 = c2 = 0
 
N = len(S)
c1 = N - len([s for s in S[0::2] if s == "0"]) - len([s for s in S[1::2] if s == "1"])
c2 = N - len([s for s in S[0::2] if s == "1"]) - len([s for s in S[1::2] if s == "0"])
 
print(min(c1, c2))

Buggy submission (verdict: Runtime Error):
n = input()
c1 = c2 = 0
l = len(n)
c1 = l - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = l - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

Buggy submission (verdict: Runtime Error):
n = input()
c1=c2=0
l = len(n)
c1 = l - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = l - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

Buggy submission (verdict: Runtime Error):
n = input()
c1=c2=0
l = len(n)
c1 = n - len([i for i in l[0::2] if i == "0"]) - len([i for i in l[1::2] if i == "1"])
c2 = n - len([i for i in l[0::2] if i == "1"]) - len([i for i in l[1::2] if i == "0"])

print(min(c1,c2))

Buggy submission (verdict: Runtime Error):
n = input()
c1=c2=0
l = len(n)
c1 = n - (len([i for i in l[0::2] if i == "0"])) - (len([i for i in l[1::2] if i == "1"]))
c2 = n - (len([i for i in l[0::2] if i == "1"])) - (len([i for i in l[1::2] if i == "0"]))

print(min(c1,c2))
Problem p03073 (python)

Fixed submission:
S = input().rstrip()
s = list(S)
N = len(S)
c = 0
v = [None] * N
v[0] = s[0]
if N == 1:
  print(c)
else:
  for i in range(1,N):
    
    if s[i]=='0' and v[i-1] =='0':
      v[i] = '1'
      c +=1
    elif s[i] =='1' and v[i-1] == '1':
      v[i] = '0'
      c +=1
    elif s[i] =='1' and v[i-1] == '0':
      v[i] = '1'
    elif s[i] =='0' and v[i-1] == '1':
      v[i] = '0'
    

  print(c)

Buggy submission (verdict: Runtime Error):
S = input().rstrip()
s = list(S)
print(s)
N = len(S)
c = 0
if N == 1:
  print(0)
else:
  for i in range(1,N)
  	if S[i-1] == '0' and S[i] == '0':
      S[i] = 1
      c +=1
    elif S[i-1] == '1' and S[i] == '1':
      S[i] = 0
      c +=1
print(c)
Problem p03072 (python)

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

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

Fixed submission:
import numpy as np

S = input()

tile_color = []
for i in S:
    tile_color.append(int(i))

candidate = np.zeros((2,len(S)))
candidate[0, 0::2] = 1
candidate[1, 1::2] = 1

distance = [np.sum(np.abs(candidate[0,:] - tile_color)), np.sum(np.abs(candidate[1,:] - tile_color))]

print(int(min(distance)))

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

S = input()
S_int = int(S)

tile_color = []

keta = len(S)
for i in range(keta):
    if S_int/10 == int(S_int/10):
        tile_color.insert(0, '0')
    else:
        tile_color.insert(0, '1')
    S_int = int(S_int/10)

length_of_S = len(tile_color)

candidate_1 = np.zeros((1,length_of_S))
candidate_1[0,0::2] = 1
candidate_2 = np.zeros((1,length_of_S))
candidate_2[0,1::2] = 1

tile_color = [int(n) for n in tile_color]

distance = [np.sum(np.abs(tile_color - candidate_1[0,:])), np.sum(np.abs(tile_color - candidate_2[0,:]))]

print(int(min(distance)))

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

S = input()
S_int = int(S)

tile_color = []

keta = len(S)
for i in range(keta):
    if S_int/10 == int(S_int/10):
        tile_color.insert(0, '0')
    else:
        tile_color.insert(0, '1')
    S_int = int(S_int/10)

length_of_S = len(tile_color)

candidate_1 = np.zeros((1,length_of_S))
candidate_1[0,0::2] = 1
candidate_2 = np.zeros((1,length_of_S))
candidate_2[0,1::2] = 1

tile_color = [int(n) for n in tile_color]

distance = [np.sum(np.abs(tile_color - candidate_1[0,:])), np.sum(np.abs(tile_color - candidate_2[0,:]))]

print(int(min(distance)))
Problem p03073 (python)

Fixed submission:
S = input().strip()
ansB = 0
ansW = 0
for i,c in enumerate(S):
	if (i % 2 == 0):
		if (c == '0'):
			ansW += 1
		else:
			ansB += 1
	else:
		if (c == '1'):
			ansW += 1
		else:
			ansB += 1
ans = min(ansW, ansB)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input().strip()
ansB = 0
ansW = 0
for i,c in emumerate(S):
  if (i % 2 == 0):
    if (c == '0'):
      ansW += 1
  else:
   	if (c == '1'):
      ansB += 1

ans = min(ansW, ansB)
print(ans)
Problem p03075 (python)

Fixed submission:
a = [int(input()) for i in range(5)]
k = int(input())
flag = True
for i in range(5):
    for j in range(i + 1, 5):
        flag &= a[j] - a[i] <= k
print("Yay!" if flag else ":(")

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
k = int(input())
tf = any(a[i + 1] - a[i] > k for i in range(4))
print("Yay!" if !tf else ":(")