Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import Counter
 
n = int(input())
V =list(map(int,input().split()))

V1 = V[::2]
V2 = V[1::2]
 
V1c = Counter(V1).most_common()
V2c = Counter(V2).most_common()

k1, v1 = V1c[0][0], V1c[0][1]
k2, v2 = V2c[0][0], V2c[0][1]

ans = 0
if k1 == k2:
    ans = n - v1
    m = 0
    if len(V1c) >= 2:
        m = max(m, V1c[1][1])
    if len(V2c) >= 2:
        m = max(m, vVc[1][1])
    ans = ans - m
else:
    ans = n - v1 - v2
print(ans)

Fixed submission:
from collections import Counter
 
n = int(input())
V =list(map(int,input().split()))

V1 = V[::2]
V2 = V[1::2]
 
V1c = Counter(V1).most_common()
V2c = Counter(V2).most_common()

k1, v1 = V1c[0][0], V1c[0][1]
k2, v2 = V2c[0][0], V2c[0][1]

ans = 0
if k1 == k2:
    ans = n - v1
    m = 0
    if len(V1c) >= 2:
        m = max(m, V1c[1][1])
    if len(V2c) >= 2:
        m = max(m, V2c[1][1])
    ans = ans - m
else:
    ans = n - v1 - v2
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)


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


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)

Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
c = int(input())


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)

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


 
ab = a+b
bc = b+c
ac = a+c
 
minimum = min(ab,bc,ac)
 
print(minimum)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

s = input()

print(s[:k - 1] + s[k -1].lower + s[k:])


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

print(s[:k-1]+s[k-1].lower()+s[k:])

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

s = input()

print(s[:k - 1] + s[k -1].lower + s[k:])


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

print(s[:k-1]+s[k-1].lower()+s[k:])

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

s = input()

s2 = list(s[:k-1] + s[k-1].lower + s[k:])
print(s2)


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

print(s[:k-1]+s[k-1].lower()+s[k:])

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

s = input()

s2 = list(s[:k - 1] + s[k -1].lower + s[k:])
print(s2)


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

print(s[:k-1]+s[k-1].lower()+s[k:])

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

s = input()

s2 = list(s[:k - 1] + s.lower[k -1] + s[k:])
print(s2)

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

print(s[:k-1]+s[k-1].lower()+s[k:])

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

s = [str, i for in input()]

print(s.lower(k))


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

print(s[:k-1]+s[k-1].lower()+s[k:])
Buggy python submission (verdict: Runtime Error):
s = input()

head = int(s[:2])
tail = int(s[2:])

if 0 < head <= 12 and 0 < tail <= 12:
  print("AMBIGUOUS")

elif 0 < head <= 12:
  print("MMYY")
elif 0 < tail <= 12:
  print("YYMM")
elif :
  print("NA")


Fixed submission:
s = input()

head = int(s[:2])
tail = int(s[2:])

if 0 < head <= 12 and 0 < tail <= 12:
  print("AMBIGUOUS")

elif 0 < head <= 12:
  print("MMYY")

elif 0 < tail <= 12:
  print("YYMM")

else :
  print("NA")

Buggy python submission (verdict: Runtime Error):
s = list(map(int, input()))

head = s[:1]
tail = s[1:]

if head > 12:
  print("YYMM")
if tail > 12:
  print("MMYY")
if 0 < head <= 12 and 0 < tail <=12:
  print("AMBIGUOUS")
if head = 0 or tail = 0:
  print("NA")
if head > 12 and tail > 12:
  print("NA")


Fixed submission:
s = input()

head = int(s[:2])
tail = int(s[2:])

if 0 < head <= 12 and 0 < tail <= 12:
  print("AMBIGUOUS")

elif 0 < head <= 12:
  print("MMYY")

elif 0 < tail <= 12:
  print("YYMM")

else :
  print("NA")
Buggy python submission (verdict: Runtime Error):
import math

n, k = list(map(int, input().split()))

ans = 0

"i点の時、k点以上になるためにはlog2(k/i)回連続で表を出す必要がある"
for i in range (1:n + 1):
  if i < k:
    omote = math.ceil(math.log(k/i, 2))
    ans += (1/2) **(omote)
  else :
    ans += 1
print(ans/n)


Fixed submission:
import math
 
n, k = list(map(int, input().split()))
 
ans = 0
 
"i点の時、k点以上になるためにはlog2(k/i)回連続で表を出す必要がある"
for i in range (1, n + 1):
  if i < k:
    omote = math.ceil(math.log(k/i, 2))
    ans += (1/2) **(omote)
  else :
    ans += 1
print(ans/n)
Buggy python submission (verdict: Runtime Error):
antenas = list(int(input()) for i in range(5))

k = int(input)

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")


Fixed submission:
antenas = [int(input()) for i in range(5)]

k = int(input())

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")

Buggy python submission (verdict: Runtime Error):
antenas = list(int, input() for i in range(5))

k = int(input)

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")
  
  


Fixed submission:
antenas = [int(input()) for i in range(5)]

k = int(input())

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")

Buggy python submission (verdict: Runtime Error):
antenas = list(int, input() for in range(5))

k = int(input)

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")
  
  

Fixed submission:
antenas = [int(input()) for i in range(5)]

k = int(input())

if (antenas[4] - antenas[0]) <= k:
  print("Yay!")
else :
  print(":(")
Buggy python submission (verdict: Runtime Error):
N, A, B = list(map(int, input().split(' ')))

C = A^B
c = format(A^B, 'b')
p = list()
p.append(A)
for i in range(len(c)):
    if int(c[len(c)-1-i]) == 1:
        tmp = p[-1] ^ (C & (1 << i))
        p.append(tmp)
for i in range(2**N-len(p)):
    p.append(p[-2])
if B == p[2**N-1]:
    print('YES')
    for i in range(len(p)):
        print(p[i], end=' ')
else:
    print('NO')

Fixed submission:
N = int(input())
S = list(input())

sum = 1
for s in set(S):
    sum *= S.count(s) + 1
    sum %= 10**9 + 7
sum -= 1
sum %= 10**9 + 7
print(sum)
Buggy python submission (verdict: Runtime Error):
ATCG

enki = input()
if enki == "A":
  return "T"
elif enki == "T":
  return "A"
elif enki == "C":
  return "G"
elif enki == "G":
  return "C"

Fixed submission:
enki = input()
if enki == "A":
  print("T")
elif enki == "T":
  print("A")
elif enki == "C":
  print("G")
elif enki == "G":
  print("C")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ships = []
for m in range(M):
    ships.append(list(map(int,input().split())))

flag = 0
for n in range(2,N+1):
    if [1,n] in ships and [n,N] in ships:
        print("POSSIBLE")
        flag=1
        break

if flag==0:
    print("IMPOSSIBLE")


Fixed submission:
N, M = map(int,input().split())
ships_1 = []
ships_2 = []
for m in range(M):
    tmp = list(map(int,input().split()))
    if tmp[0]==1:
        ships_1.append(tmp[1])
    elif tmp[1] == N:
        ships_2.append(tmp[0])

matched_list = list(set(ships_1) & set(ships_2))
if matched_list:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
INF = 10**9+7 
import scipy.misc as scm

n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]

indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

for i in range(1,n+2):
        print(int((scm.comb(n+1,i)-scm.comb(n-(l1-l0), i-1))%INF))


Fixed submission:
INF = 10**9+7 

n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]
indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

def bin_pow(a,n):
    ans = 1
    mag = a
    while(n>0):
        if n%2==0:
            mag = (mag*mag)%INF
            n /= 2
        else:        
            ans = ans* mag%INF
            n -= 1
    return ans

factorial = [0]*(n+2)
inverse_factorial = [0] * (n+2)

factorial[0] = 1
for i in range(1, n+2):
    factorial[i] = factorial[i-1] * i % INF

inverse_factorial[n+1] = bin_pow(factorial[n+1], INF-2)
for i in range(n,-1,-1):
    inverse_factorial[i] = (inverse_factorial[i+1]*(i+1))%INF

def combi(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return (factorial[n] * inverse_factorial[r] )%INF * (inverse_factorial[n-r]% INF)

for i in range(1,n+2):
    print((combi(n+1,i)-combi(n-(l1-l0), i-1) )%INF)

Buggy python submission (verdict: Runtime Error):
INF = 10e9+7 
import scipy.misc as scm
n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]
indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

for i in range(1,n+2):
        print(int((scm.comb(n+1,i)-scm.comb(n-(l1-l0), i-1))%INF))


Fixed submission:
INF = 10**9+7 

n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]
indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

def bin_pow(a,n):
    ans = 1
    mag = a
    while(n>0):
        if n%2==0:
            mag = (mag*mag)%INF
            n /= 2
        else:        
            ans = ans* mag%INF
            n -= 1
    return ans

factorial = [0]*(n+2)
inverse_factorial = [0] * (n+2)

factorial[0] = 1
for i in range(1, n+2):
    factorial[i] = factorial[i-1] * i % INF

inverse_factorial[n+1] = bin_pow(factorial[n+1], INF-2)
for i in range(n,-1,-1):
    inverse_factorial[i] = (inverse_factorial[i+1]*(i+1))%INF

def combi(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return (factorial[n] * inverse_factorial[r] )%INF * (inverse_factorial[n-r]% INF)

for i in range(1,n+2):
    print((combi(n+1,i)-combi(n-(l1-l0), i-1) )%INF)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
tmp=[]
for i in range(N):
    a_i,b_i=map(int,input().split())
    tmp += [a_i]*b_i

tmp.sort()
print(tmp[K-1])

Fixed submission:
N,K = map(int,input().split())
tmp=[]
for i in range(N):
    a_i,b_i=map(int,input().split())
    tmp.append([a_i,b_i])

tmp.sort(key=lambda x:x[0])
for t in tmp:
    K -= t[1]
    if K<=0:
        print(t[0])
        break
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    w_tmp,v_tmp=map(int,input().split())
    w.append(w_tmp)
    v.append(v_tmp)

dp=[[ -1 for _ in range(W+1) ] for _  in range(N+1)]
def rec(i,j):
    if dp[i][j] != -1:
        return dp[i][j]
    if i==N:
         res=0
    elif j<w[i]:
        res=rec(i+1,j)
    else:
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i])
    dp[i][j]=res
    return res

print(rec(0,W))
    


Fixed submission:
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    w_tmp,v_tmp=map(int,input().split())
    w.append(w_tmp)
    v.append(v_tmp)

dp=[{} for _  in range(N+1)]
def rec(i,j):
    if j in dp[i] :
        return dp[i][j]
    if i==N:
         res=0
    elif j<w[i]:
        res=rec(i+1,j)
    else:
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i])
    dp[i][j]=res
    
    return res

print(rec(0,W))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N,W= map(int,input().split())
w,v=[],[]
for i in range(N):
    tmp=list(map(int,input().split()))
    w.append((i,tmp[0]))
    v.append(tmp[1])

def check(N,W,w,v):
    cost_now=0
    for i in range(1,N+1):
        tmp=list(itertools.combinations(w,i))
        for tmptmp in tmp:
            sumsum = sum([ele[1] for ele in tmptmp])
            if sumsum <= W:
                cost_tmp=sum([v[ele[0]] for ele in tmptmp])
                if cost_tmp > cost_now:
                     cost_now = cost_tmp
    return cost_now

print(check(N,W,w,v))

Fixed submission:
N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    w_tmp,v_tmp=map(int,input().split())
    w.append(w_tmp)
    v.append(v_tmp)

dp=[{} for _  in range(N+1)]
def rec(i,j):
    if j in dp[i] :
        return dp[i][j]
    if i==N:
         res=0
    elif j<w[i]:
        res=rec(i+1,j)
    else:
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i])
    dp[i][j]=res
    
    return res

print(rec(0,W))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())

cnt=0
for i in range(N):
    if M>=2:    
        M    -= 2
        cnt  +=1

cnt += int(M/4)

print(cnt)

Fixed submission:
N,M = map(int, input().split())
 
tmp=M-2*N

if tmp>=0:
    print(N+int(tmp/4))
else:
    print(int(M/2))
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np
N,Ma,Mb=map(int,input().split())
yaku=[]
for _ in range(N):
    yaku.append(list(map(int,input().split())))


candi_money=[]

for n in range(N):
    candis=list(itertools.combinations(np.arange(N),n))
    for candi in candis:
        a,b,c=0,0,0
        for num in candi:
            a +=yaku[num][0]
            b +=yaku[num][1]
            c +=yaku[num][2]
        if a/flaot(Ma/Mb)=b:
            candi_money.append(c)


if len(candi_money)==0:
	print(-1)
else:
	print(min(candi_money))

Fixed submission:
input = input().split()
A,B=int(input[0]),int(input[1])
 
if A==1:
    A+=13
if B==1:
    B+=13
 
if A==B:
    print("Draw")
elif A>B:
    print("Alice")
else:
    print("Bob")
Buggy python submission (verdict: Runtime Error):
text

Fixed submission:
p, q, r = map(int, input().split())
 
m = 10e9
 
m = min(m, p + q)
m = min(m, r + q)
m = min(m, p + r)
 
print(m)

Buggy python submission (verdict: Runtime Error):
test

Fixed submission:
p, q, r = map(int, input().split())
 
m = 10e9
 
m = min(m, p + q)
m = min(m, r + q)
m = min(m, p + r)
 
print(m)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()

print(a*a-b)

Fixed submission:

a=int(input())
b=int(input())

print(a*a-b)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, raw_input().split())
A = []
for i in range(M):
    a = int(raw_input())
    A.append(a)

dp = []
dp = [0 for i in range(N + 1)]
dp[0] = 1

for i in range(N):
    if (i + 1) not in A and (i + 1) <= N:
        dp[i + 1] += dp[i]
    if (i + 2) not in A and (i + 2) <= N:
        dp[i + 2] += dp[i]


print str(dp[N]%1000000007)

Fixed submission:
N, M = map(int, raw_input().split())
A = []
A = [0 for i in range(N + 1)]
for i in range(M):
    a = int(raw_input())
    A[a] = -1

dp = []
dp = [0 for i in range(N + 1)]
dp[0] = 1

for i in range(N):
    if (i + 1) <= N and A[i + 1] == 0:
        dp[i + 1] += dp[i]
    if (i + 2) <= N and A[i + 2] == 0:
        dp[i + 2] += dp[i]


print str(dp[N]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
a = map(int, raw_input().split())
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
for i in range(len(b)):
    print b[i],

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

i = n-1
while i >= 0:
    print a[i],
    i -= 2

i = n % 2
while i < n:
    print a[i],
    i +=2
Buggy python submission (verdict: Runtime Error):
import std.stdio, std.conv, std.string, std.algorithm;

void main()
{
auto ip = readln.split.to!(int[]);
auto x = 0;
if(ip[0] <= ip[1]){
  x += ip[0];
} else {
  x += ip[0] - 1;
}
  writeln(x);
}

Fixed submission:
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(ceil((a + b) / 2))

Fixed submission:
import math

a, b = map(int, input().split())
print(math.ceil((a + b) / 2))
Buggy python submission (verdict: Runtime Error):

import sys


P = int(sys.argv[1])
Q = int(sys.argv[2])
R = int(sys.argv[3])



a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)


Fixed submission:
P,Q,R = map(int,input().split())
a1 = P + Q
a2 = P + R
a3 = Q + R
value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)

Buggy python submission (verdict: Runtime Error):

import sys


P = int(sys.argv[1]) 
Q = int(sys.argv[2]) 
R = int(sys.argv[3]) 
 
a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300

if __name__ == '__main__':
    if a1 < value:
        value = a1
    if value > a2:
        value = a2
    if value > a3:
        value = a3
    print(value) 


Fixed submission:
P,Q,R = map(int,input().split())
a1 = P + Q
a2 = P + R
a3 = Q + R
value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)

Buggy python submission (verdict: Runtime Error):

import sys


P = int(sys.argv[1]) 
Q = int(sys.argv[2]) 
R = int(sys.argv[3]) 
 
a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300

if __name__ == '__main__':
    if a1 < value:
        value = a1
    if value > a2:
        value = a2
    if value > a3:
        value = a3
    print(value) 


Fixed submission:
P,Q,R = map(int,input().split())
a1 = P + Q
a2 = P + R
a3 = Q + R
value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)

Buggy python submission (verdict: Runtime Error):

import sys


P = sys.argv[1]
Q = sys.argv[2]
R = sys.argv[3]




numbers = [P,Q,R]

combinations = ['_','_','_']

numbers = []

a1 = P + Q.
a2 = P + R
a3 = Q + R

value = 300 


 
if __name__ == '__main__': 
    if a1 < value:
        value = a1 
    if value < a2:
        value = a2
    if value < a3:
        value = a3 
    return value 
 

Fixed submission:
P,Q,R = map(int,input().split())
a1 = P + Q
a2 = P + R
a3 = Q + R
value = 300
if a1 < value:
    value = a1
if value > a2:
    value = a2
if value > a3:
    value = a3
print(value)
Buggy python submission (verdict: Runtime Error):
N=input()
if   (N=='1'):
            print('Hello word')
            
if   (N=='2'):
    A=input()
    B=input()
            print(A+B)

Fixed submission:
N=int(input())
if   (N==1):
            print('Hello World')
            
if   (N==2):
    A=int(input())
    B=int(input())
    if((A>=1)&(A<=9)):
        if((B>=1)&(B<=9)):
            print(A+B)
Buggy python submission (verdict: Runtime Error):
print('\n'.join([s[2] for s in sorted([input().split() + [i + 1] for i in range(int(input()))], key=lambda x:(x[0], -int(x[1])))]))

Fixed submission:
print('\n'.join([l[2] for l in sorted(sorted([[l[1][0], int(l[1][1]), str(l[0] + 1)] for l in enumerate(input().split() for _ in range(int(input())))], key=lambda l: l[1], reverse=True), key=lambda l: l[0])]))

Buggy python submission (verdict: Runtime Error):
print('\n'.join([l[2] for l in sorted(sorted([[l[1][0], int(l[1][1]), l[0] + 1] for l in enumerate(input().split() for _ in range(int(input())))], key=lambda l: l[1], reverse=True), key=lambda l: l[0])]))

Fixed submission:
print('\n'.join([l[2] for l in sorted(sorted([[l[1][0], int(l[1][1]), str(l[0] + 1)] for l in enumerate(input().split() for _ in range(int(input())))], key=lambda l: l[1], reverse=True), key=lambda l: l[0])]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

p = s.count('.')
q = 0
r = p

for i in range(n):
    if s[i] == '#':
        q += 1
    else:
        p -= 1
    # r = min(r, p + q)
   	r = r if r < p + q else p + q

print(r)

Fixed submission:
n = int(input())
s = list(input())

p = s.count('.')
q = 0
r = p

for i in range(n):
    if s[i] == '#':
        q += 1
    else:
        p -= 1
    r = min(r, p + q)
    # r = r if r < p + q else p + q

print(r)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
if all([v == '.' for v in s]):
    print(0)
else:
    r = 0
    s = s[s.find('#'):]
    while (True):
        k = s.find('.#') + 1
        if k == 0:
            r += min(s.count('.'), s.count('#'))
            break
        else:
            t = s[:k]
            r += min(t.count('.'), t.count('#'))
            s = s[k:]
    print(r)

Fixed submission:
n = int(input())
s = list(input())

p = s.count('.')
q = 0
r = p

for i in range(n):
    if s[i] == '#':
        q += 1
    else:
        p -= 1
    r = min(r, p + q)
    # r = r if r < p + q else p + q

print(r)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
r = 0

def rec(a, b, s):
    global r
    if len(s) == 0:
        return [a] + [b]
    if a == '0' and b == '0':
        b = '1'
        r += 1
    elif a == '1' and b == '1':
        b = '0'
        r += 1
    return [a] + [b] + rec(b, s[0], s[1:])

if len(s) == 1:
    print(0)
else:
    rec(s[0], s[1], s[2:])
    print(r)

Fixed submission:
S = input()
n = len(S)
s = int(S, 2)
b = ''.join(map(str, [i % 2 for i in range(n)]))
p = int(b, 2)
q = int(b[1:] + str(int(b[-1]) ^ 1), 2)
print(min(bin(s ^ n).count('1') for n in [p, q]))
Buggy python submission (verdict: Runtime Error):
n, h, w = [int(i) for i in input().split()]
print(sum(h <= a and w <= b for a, b in ([int(i) for i in input().split()] for _ in range(n))))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
m = max([a, b, c, d, e])
n = min([a, b, c, d, e])
print('Yay!' if k >= (m - n) else ':(')

Buggy python submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().strip

l = [int(input()) for _ in range(5)]
k = int(input())
print('Yay!' if k >= l[4] - l[0] else ':(')

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
m = max([a, b, c, d, e])
n = min([a, b, c, d, e])
print('Yay!' if k >= (m - n) else ':(')

Buggy python submission (verdict: Runtime Error):
l=[int(input())for _ inrange(5)]
print([':(','Yay!'][int(input())>=l[4]-l[0]])


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
m = max([a, b, c, d, e])
n = min([a, b, c, d, e])
print('Yay!' if k >= (m - n) else ':(')
Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
l = []
for i in range(len(s)):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        l.append(ans)
        ans = 0
l.append(ans)
print(max(li))


Fixed submission:
s = list(input())
n = len(s)
ans = 0
li = []
for i in range(n):
    if s[i] in list('ACGT'):
        ans += 1
    else:
        li.append(ans)
        ans = 0
li.append(ans)
print(max(li))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ws = list(map(int, input().split()))

sum = sum(ws)
mini = sum
tmp_sum = 0
for w in ws:
  tmp_sum += ws
  mini = min(mini, abs(tmp_sum - (sum - tmp_sum)))
print(mini)

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

min = 100000
for i in range(1, N):
  s1 = sum(ws[:i])
  s2 = sum(ws[i:])
  diff = abs(s1 - s2)
  if diff < min:
    min = diff
print(min)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input())
HS = list(map(int, input().split()))

result = 0
min_dif = 10000
for i in range(N):
  dif = abs(A, T - HS[i] * 0.0060 )
  if dif < min_dif:
    min_dif = dif
    result = i
print(result)

Fixed submission:
N = int(input())
T, A = map(int, input().split())
HS = list(map(int, input().split()))
 
result = 1
min_dif = 10000
for i in range(N):
  dif = abs(A - (T - HS[i] * 0.0060))
  if dif < min_dif:
    min_dif = dif
    result = i + 1
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(intm input().split()))

print(max(A) - min(A))
  

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
# print(max(A) - min(A))

min = A[0]
max = A[0]
for i in range(N):
  if A[i] > max:
    max = A[i]
  if A[i] < min:
    min = A[i]
print(max - min)
Buggy python submission (verdict: Runtime Error):
S = input()
S[0:4] = "2018"
print(S)

Fixed submission:
S = input()
print("2018" + S[4:])