Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S = list(input())
S_len = len(S)


def dfs(S):
    slen = len(S)
    for i in range(slen -1 ):
        if S[i] != S[i+1]:
            del S[i+1:i+2]
            dfs(S)
            break;
    End_len = len(S)
    ans = S_len - End_len
    return ans

if __name__ == '__main__':
    print(dfs(S))

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

Buggy python submission (verdict: Runtime Error):
S = list(input())
S_len = len(S)

def dfs(S):
    slen = len(S)
    for i in range(slen -1 ):
        if S[i] != S[i+1]:
            del S[i:i+2]
            dfs(S)
            break;
    End_len = len(S)
    ans = S_len - End_len
    return ans

if __name__ == '__main__':
    print(dfs(S))

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

Buggy python submission (verdict: Runtime Error):
S = list(input())
S_len = len(S)

for i in range(S_len-1):
    S[i+1]
def dfs(S):
    slen = len(S)
    for i in range(slen -1 ):
        if S[i] != S[i+1]:
            del S[i:i+2]
            dfs(S)
            break;
    End_len = len(S)
    ans = S_len - End_len
    return ans

if __name__ == '__main__':
    print(dfs(S))

Fixed submission:
s = input()
count_0 = s.count('0')
count_1 = s.count('1')
print(2*min(count_0,count_1))
Buggy python submission (verdict: Runtime Error):
N = input()
A = int(N[0])
B = int(N[2])

if B % A == 0:
    ans = B - A
else:
    ans = A + B

print(ans)

Fixed submission:
N = input().split(" ")
A = int(N[0])
B = int(N[1])

if B % A == 0:
    ans = B + A
else:
    ans = B - A

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(1,sqrt_X + 1):    ##最後は含まないので＋１する必要がある
    for p in range(2,sqrt_X): 　##pは2から始めまる
        now_num = b**p
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!

from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(sqrt_X):
    for p in range(sqrt_X - 1):
        now_num = (b+1)**(p+2)
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!

INPUT=int(input())
b=1
p=2
END=0
while True:
    while True:
        now_num = b**p
        if b == 1:
            end_num=now_num
            break
        elif p==2 and INPUT<now_num:
            END = 1
            break
        elif INPUT < now_num:
            end_num = b**(p-1)
            break
        else:
            p+=1
        
    if END == 1:
        ans=end_num
        break
    b+=1
    
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!

from math import sqrt
X=int(input())
sqrt_X=int(sqrt(X))
ans=1

for b in range(sqrt_X):
    for p in range(sqrt_X - 1):
        now_num = (b+1)**(p+2)
        if now_num <= X and ans <= now_num:
            ans =now_num
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
N=int(b[0])
M=int(b[1])
in2=[]
out2=[]
for i in range(M):
    c=input()
    d=c.split(" ")
    in1=int(d[0])
    out=int(d[1])
    if in1==1:
        in2.append(str(out))
    elif out==N:
        out2.append(str(in1))
#print(in2)
#print(out2)
len_in2=len(in2)
for q in range(len_in2):
    if in2[q] in out2:
        print("POSSIBLE")
        break
    elif q+1==len_in2:
        print("IMPOSSIBLE")
    else:
        continue

Fixed submission:
a=input()
b=a.split(" ")
N=int(b[0])
M=int(b[1])
in2=[]
out2=[]
for i in range(M):
    c=input()
    d=c.split(" ")
    in1=int(d[0])
    out=int(d[1])
    if in1==1:
        in2.append(str(out))
    elif out==N:
        out2.append(str(in1))
        
in2_set=set(in2)
out2_set=set(out2)
matched_list=list(in2_set & out2_set)
#print(matched_list)
if len(matched_list)==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
N=int(b[0])
M=int(b[1])
in2=[]
out2=[]
for i in range(M):
    c=input()
    d=c.split(" ")
    in1=int(d[0])
    out=int(d[1])
    if in1==1:
        in2.append(out)
    elif out==N:
        out2.append(in1)
len_in2=len(in2)
for q in range(len_in2):
    if in2[q] in out2:
        print("POSSIBLE")
        break
    elif q+1==len_in2:
        print("IMPOSSIBLE")
    else:
        continue

Fixed submission:
a=input()
b=a.split(" ")
N=int(b[0])
M=int(b[1])
in2=[]
out2=[]
for i in range(M):
    c=input()
    d=c.split(" ")
    in1=int(d[0])
    out=int(d[1])
    if in1==1:
        in2.append(str(out))
    elif out==N:
        out2.append(str(in1))
        
in2_set=set(in2)
out2_set=set(out2)
matched_list=list(in2_set & out2_set)
#print(matched_list)
if len(matched_list)==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
N=int(input())
b=input()
c=b.split(" ")
d=map(int,c)
a=list(d)
sum_a=abs(sum(a))
ans=sum_a%2
if sum_a==0:
    A=map(abs,a)
    B=list(A)
    ans2=min(B)
    print(ans2*2)
else:
    print(ans)

Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=b[0]
B=b[1]

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")


Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
a=input()
b=a.split(" ")
A=b[0]
B=b[1]
C=A+B
print(b)
if C%3==0:
    print("Possible")
else:
    print("Impossible")


Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=b[0]
B=b[1]

C=A+B
if C%3==0:
    print("Possible")
else:
    print("Impossible")


Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
a=[2,3]
b=a.split(",")
A=b[0]
B=b[1]

C=A+B
if C%3==0:
    print("Possible")
else:
    print("Impossible")

Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=b[0]
B=b[1]

C=A+B
if C%3==0:
    print("Possible")
elif:
    print("Impossible")


Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=b[0]
B=b[1]

C=A+B
if C%3==0:
    print("Possible")
elif:
    print("Impossible")


Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
N=int(b[0])
K=int(b[1])

ans=[]
l=[]
for i in range(N):
    l.append(int(input()))
for w in range(K):
    ans.append(max(l))
print(sum(ans))

Fixed submission:
# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
N=int(b[0])
K=int(b[1])
ans=[]
c=input()
l=c.split(" ")
l1=map(int,l)
l2=list(l1)
for w in range(K):
    ans.append(max(l2))
    max_idx = l2.index(max(l2))
    del l2[max_idx]
print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Here your code !
N=int(input())
b=input()
c=b.split(" ")
d=map(int,c)
a=list(d)
X=sum(a)
ans=[]
for i in range(N-1):
    A=abs(X-2*sum(a[0:i+1]))
    ans.append(A)
ans1=min(ans)
print(ans1)

Fixed submission:
# coding: utf-8
# Here your code !
N=int(input())
b=input()
c=b.split(" ")
d=map(int,c)
a=list(d)
X=sum(a)
ans=[]
Y=0
for i in range(N-1):
#    A=abs(X-2*sum(a[0:i]))
    Y=Y+a[i]
    B=abs(X-2*Y)
    ans.append(B)
ans1=min(ans)
print(ans1)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a==b==c:


Fixed submission:
a,b,c = map(int, input().split())
if a == b == c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
b = int(input())

if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'G':
  print('C')
else:
  print('G')

Fixed submission:
b = input()

if b == 'A':
  print('T')
elif b == 'T':
  print('A')
elif b == 'G':
  print('C')
else:
  print('G')
Buggy python submission (verdict: Runtime Error):
a,b = map(int(input().split()))
if b%a==0:
    print(a+b)
else:
    print(b-a)


Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)

Buggy python submission (verdict: Runtime Error):
a,b = int(input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a)


Fixed submission:
a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)
Buggy python submission (verdict: Time Limit Exceeded):
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n = int(input())
hp = list(map(int, input().split()))
while len(hp) != 1:
    minhp = min(hp)
    hp = [i % minhp if not i == minhp else i for i in hp]
    hp = [i for i in hp if not i == 0]
    if min(hp) == 1:
        minhp = min(hp)
        break
print(minhp)


Fixed submission:
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n = int(input())
hp = list(map(int, input().split()))
while len(hp) != 1:
    minhp = min(hp)
    hp = [i % minhp if not i == minhp else i for i in hp]
    hp = [i for i in hp if not i == 0]
    if min(hp) == 1:
        minhp = min(hp)
        break
    elif hp == [minhp for i in hp]:
        break
print(minhp)

Buggy python submission (verdict: Time Limit Exceeded):
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n = int(input())
hp = list(map(int, input().split()))
while len(hp) != 1:
    minhp = min(hp)
    hp = [i % minhp if not i == minhp else i for i in hp]
    hp = [i for i in hp if not i == 0]
    
print(minhp)


Fixed submission:
#-*-coding:utf8;-*-
#qpy:3
#qpy:console
n = int(input())
hp = list(map(int, input().split()))
while len(hp) != 1:
    minhp = min(hp)
    hp = [i % minhp if not i == minhp else i for i in hp]
    hp = [i for i in hp if not i == 0]
    if min(hp) == 1:
        minhp = min(hp)
        break
    elif hp == [minhp for i in hp]:
        break
print(minhp)
Buggy python submission (verdict: Runtime Error):
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'NO'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)

    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'YES'
    else:
        break


print(ans)

Fixed submission:
s = input().rstrip().split(' ')
a = int(s[0])
b = int(s[1])
if a*b%2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

first = H[0]
for i, h in enumerate(H[1:]):
    if first > h:
        break
    first = h
print(i+1)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
count = 0
for i, h in enumerate(H):
    if i == 0:
        count += 1
    elif i == 1:
        count += 1 if  H[1] >= H[0] else 0
    else:
        count += 1 if h >= max(H[:i]) else 0
print(count)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(map(int, input()))
 
Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]
result = 0
if len(Z) <= K:
    print(N)
else:
    for i in range(len(Z)-K):
        if i == 0:
            result = Z[i+K]
        else:
            result = max(result, Z[i+K] - Y[i])
    print(result)

Fixed submission:
N, K = map(int, input().split())
S = list(map(int, input()))
 
Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]
result = 0
if len(Z) <= K:
    print(N)
else:
    for i in range(len(Z)-K):
        if i == 0:
            result = Z[i+K]
        else:
            result = max(result, Z[i+K] - Y[i if Y[0] < Z[0] else i-1])
    print(result)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = list(map(int, input()))

Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)] + [N]
result = 0
if len(Z) <= K:
    print(N)
else:
    for i in range(len(Z)-K):
        if i == 0:
            result = Z[i+K]
        else:
            result = max(result, Z[i+K] - max([y for y in Y if y <= Z[i]]))
    print(result)

Fixed submission:
N, K = map(int, input().split())
S = list(map(int, input()))
 
Z = [j for j, s in enumerate(S) if (j > 0 and s == 0 and S[j] != S[j-1]) or (j == 0 and s == 0)] + [N]
Y = [j for j, s in enumerate(S) if (j > 0 and s == 1 and S[j] != S[j-1]) or (j == 0 and s == 1)]
result = 0
if len(Z) <= K:
    print(N)
else:
    for i in range(len(Z)-K):
        if i == 0:
            result = Z[i+K]
        else:
            result = max(result, Z[i+K] - Y[i if Y[0] < Z[0] else i-1])
    print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
A, B = map(int, input().split())
bins = np.array([list(map(int, list('{number:0>40}'.format(number=bin(i)[2:])))) for i in range(A, B+1)]).T
bins = np.sum(bins, axis=1) % 2
result = 0
for d, i in enumerate(bins[::-1]):
    if i == 1:
        result += 2 ** d
print(result)

Fixed submission:
A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)

Buggy python submission (verdict: Runtime Error):
import numpy as np
bins = np.array([list(map(int, list('{number:0>40}'.format(number=bin(i)[2:])))) for i in range(A, B+1)]).T
bins = np.sum(bins, axis=1) % 2
result = 0
for d, i in enumerate(bins[::-1]):
    if i == 1:
        result += 2 ** d
print(result)

Fixed submission:
A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)

Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
digit_A = math.ceil(math.log2(A))
digit_B = math.ceil(math.log2(A))
result = A
for i in range(A+1, 2 ** digit_A):
    result = result ^ i
for i in range(2 ** (digit_B-1), B + 1):
    result = result ^ i
print(result)

Fixed submission:
A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())
result = A
for i in range(A+1, B+1):
    result = result ^ i
print(result)

Fixed submission:
A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
tmpx = 0
tmpy = 0
for s in range(n):
    tmpx = a[s][1] - tmpx
    tmpy = a[s][2] - tmpy
    if((dx+dy)>a[s][0]):
        print("NO")
        break
    if(((dx+dy)%2) == (a[s][0]%2)):
        print("YES")
        break
    else:
        print("NO")
        break

Fixed submission:
n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
dx = 0
dy = 0
c = 0
k = 0
for s in range(n):
    dx = a[s][1] - dx
    dy = a[s][2] - dy
    if((dx+dy)>a[s][0]):
        print("No")
        break
    if(((abs(dx)+abs(dy))%2) == ((a[s][0]-k)%2)):
        c += 1
        k += a[s][0]
    else:
        print("No")
        break
if(c == n):
    print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys
M=input()

for i in range(l0):
  if(M.find(str(i))!=-1):
    print("Yes")
    sys.exit()
print("No")

Fixed submission:
import sys
M=input()
 
for i in range(10):
  if(M.find(str(i)*3)!=-1):
    print("Yes")
    sys.exit()
print("No")
Buggy python submission (verdict: Runtime Error):
X, Y, Z, K = map(int,input().split())
A_list = sorted(list(map(int,input().split())), reverse=True)
B_list = sorted(list(map(int,input().split())), reverse=True)
C_list = sorted(list(map(int,input().split())), reverse=True)

E_list = sorted([ai+bi for ai in A_list for bi in B_list], reverse=True)[:K]
sum_list = sorted([ei+ci for ci in E_list for ci in C_list], reverse=True)[:K]

for i in range(K):
    print(sum_list[i])


Fixed submission:
X, Y, Z, K = map(int,input().split())
A_list = sorted(list(map(int,input().split())), reverse=True)
B_list = sorted(list(map(int,input().split())), reverse=True)
C_list = sorted(list(map(int,input().split())), reverse=True)

E_list = sorted([ai+bi for ai in A_list for bi in B_list], reverse=True)[:K]
sum_list = sorted([ei+ci for ei in E_list for ci in C_list], reverse=True)[:K]

for i in range(K):
    print(sum_list[i])

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

X, Y, Z, K = map(int,input().split())
A_list = list(map(int,input().split()))
B_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))

E_list = []
for i in A_list:
    for j in B_list:
        # print(i+j)
        E_list.append(i+j)

E_list = np.array(E_list)
E_list = np.sort(E_list)[::-1]

sum_list = []
for i in E_list[:K]:
    for j in C_list:
        sum_list.append(i+j)

sum_list = np.array(sum_list)
sum_list = np.sort(sum_list)[::-1]

for i in range(K):
    print(sum_list[i])


Fixed submission:
X, Y, Z, K = map(int,input().split())
A_list = sorted(list(map(int,input().split())), reverse=True)
B_list = sorted(list(map(int,input().split())), reverse=True)
C_list = sorted(list(map(int,input().split())), reverse=True)

E_list = sorted([ai+bi for ai in A_list for bi in B_list], reverse=True)[:K]
sum_list = sorted([ei+ci for ei in E_list for ci in C_list], reverse=True)[:K]

for i in range(K):
    print(sum_list[i])
Buggy python submission (verdict: Runtime Error):
a, b, c = input().split()


print(max(c, b//a))

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


print(min(c, b//a))
Buggy python submission (verdict: Runtime Error):
# a, b, k = map(int, input().split())
s = input()

n = len(s)


def rep(str):
    ret = str.replace('01', '')
    ret = ret.replace('10', '')

    if ret != str:
        ret = rep(ret)

    return ret


input_str = s
# ret = None
#
# while ret is None or input_str != ret:
#     ret = input_str
#     input_str = rep(input_str)

ret = rep(s)

print(n - len(ret))


Fixed submission:

s = input()

n = len(s)

cnt0 = s.count('0')
cnt1 = s.count('1')

print(min(cnt0, cnt1)*2)

Buggy python submission (verdict: Time Limit Exceeded):
# a, b, k = map(int, input().split())
s = input()

n = len(s)


def rep(str):
    str = str.replace('01', '')
    str = str.replace('10', '')
    return str


input_str = s
ret = None

while ret is None or input_str != ret:
    ret = input_str
    input_str = rep(input_str)

print(n - len(ret))


Fixed submission:

s = input()

n = len(s)

cnt0 = s.count('0')
cnt1 = s.count('1')

print(min(cnt0, cnt1)*2)
Buggy python submission (verdict: Runtime Error):
import itertools
x, y, z, k = map(int, input().split())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))
sum_list = [sum(i) for i in itertools.product(al, bl, cl)]
sum_list.sort(reverse=True)
for i in sum_list[:k]:
  print(i)

Fixed submission:
import itertools
l = [int(input()) for i in range(5)]
k = int(input())
for i in itertools.combinations(l, 2):
  if i[1] - i[0] > k:
    print(':(')
    exit()
print('Yay!')

Buggy python submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
k = int(input())
for i in itertools.combinations(l, 2):
  if i[1] - i[0] > k:
    print(':(')
    exit()
print('Yay!')

Fixed submission:
import itertools
l = [int(input()) for i in range(5)]
k = int(input())
for i in itertools.combinations(l, 2):
  if i[1] - i[0] > k:
    print(':(')
    exit()
print('Yay!')
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, K = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]

K_str = format(K, 'b')
max_order = len(K_str)

B = np.array([list(format(a, '0{}b'.format(max_order)))
              for a in A]
             ).astype('i')[:, :max_order]
B = B.sum(axis=0)
B = np.where(B < N/2, 1, 0)

X_str = ''.join(map(str, B))
X = int(X_str, 2)

print(sum(map(lambda a: X ^ a, A)))

Fixed submission:
T, X = map(int, input().split())

print(T / X)
Buggy python submission (verdict: Runtime Error):
from itertools import groupby
from heapq import heapify, heappop

N, K = map(int, input().split())
sushi = [tuple(map(int, input().split())) for _ in range(N)]

srt = sorted(sushi, key=lambda x: x[1], reverse=True)
eat, non_eat = srt[:K], srt[K:]

maxs = []
rems = []
kinds = set()
for k, g in groupby(sorted(eat, key=lambda x: x[0]), key=lambda x: x[0]):
    d = list(list(zip(*g))[1])
    maxs.append(d.pop(0))
    rems.extend(d)
    kinds.add(k)
heapify(rems)
ans = sum(maxs) + sum(rems) + len(kinds)**2

for k, g in groupby(sorted(non_eat, key=lambda x: x[0]), key=lambda x: x[0]):
    if k in kinds:
        continue
    if not rems:
        break
    d = list(list(zip(*g))[1])
    maxs.append(d.pop(0))
    heappop(rems)
    kinds.add(k)
    ans = max(ans, sum(maxs) + sum(rems) + len(kinds)**2)

print(ans)


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

print(a*b//2)