Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Fixed submission:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fraction
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Fixed submission:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))

Fixed submission:
N=int(input())
l=[]
for i in range(N):
    l.append(int(input()))
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(l))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B=1:
        C=N
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)

Fixed submission:
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B==1:
        C=1
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"
if "i" in S:
    B=S.remove("i")
    C=len(set(B)) 
    D=C+S.count("i")
    print(C,D)
else:
    E=len(set(S))
    print(E,E)

Fixed submission:
N=int(input())
S=input().split()
for i in range(0,N):
    s=int(S[i])
    if 1<=s<=399:
        S[i]="a"
    if 400<=s<=799:
        S[i]="b"
    if 800<=s<=1199:
        S[i]="c"
    if 1200<=s<=1599:
        S[i]="d"
    if 1600<=s<=1999:
        S[i]="e"
    if 2000<=s<=2399:
        S[i]="f"
    if 2400<=s<=2799:
        S[i]="g"
    if 2800<=s<=3199:
        S[i]="h"
    if 3200<=s:
        S[i]="i"

if "i" in S:
    i=S.count("i")
    B=len(set(S))
    if B==1:
        C=1
        D=N
    else:
        C=B-1
        D=C+i
    
else:
    C=len(set(S))
    D=C

print(C,D)
Buggy python submission (verdict: Runtime Error):
N, K= map(int, input().split())
g = []
for i in range(N):
    a, b = map(int, input().split())
    h=b*(b+1)/2
    if h>=K:
        g.append(a)
print(g[0])

Fixed submission:
A,B,C= map(int, input().split())
if A<=C<=B:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N, K= map(int, input().split())
h=0
for i in range(N):
    a, b = map(int, input().split())
    h+=b
    if h>=K:
        print(a)
        break

Fixed submission:
A,B,C= map(int, input().split())
if A<=C<=B:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B,C=input().split()
if A[-1]=B[0] and B[-1]=C[0]:
    print("Yes")
else:
    print("No")
    

Fixed submission:
A,B,C=input().split()
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in range(1,int(N**(0.5))):
    if N%i==0:
        a.append(max(len(str(i)),len(str(N//i))))
print(min(a))

Fixed submission:
N=int(input())
a=[]
for i in range(1,int(N**(0.5)+1)):
    if N%i==0:
        a.append(max(len(str(i)),len(str(N//i))))
print(min(a))
Buggy python submission (verdict: Runtime Error):
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and c>0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)   

Fixed submission:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C-1
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>=0 and c>=0:    
        j+=1
    else:     
        a+=1
        c=C-1
        k=K
        j+=1
print(a+1)

Buggy python submission (verdict: Runtime Error):
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and c>0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)   

Fixed submission:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C-1
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>=0 and c>=0:    
        j+=1
    else:     
        a+=1
        c=C-1
        k=K
        j+=1
print(a+1)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x<1200:
    print(ABC)
else:
    print(ARC)

Fixed submission:
x=int(input())
if x<1200:
    print("ABC")
else:
    print("ARC")
Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
L=0
for X in range(0,int(K)+1):
    for Y in range(0,int(K)+1):
        Z=int(S)-(X+Y)
        if 0<=Z<=int(K):
            L+=1
        
print(L)        
        

Fixed submission:
K,S=input().split()
k=int(K)
s=int(S)
L=0
for X in range(0,k+1):
    for Y in range(0,k+1):
        Z=s-(X+Y)
        if 0<=Z<=k:
            L+=1
        
print(L)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
L=0
for i in range(0,int(K)+1):
    X=i
    for j in range(0,int(K)+1):
        Y=j
        Z=int(S)-(X+Y)
        if 0<=Z<=int(K):
            L=L+1
        
print(L)        
        

Fixed submission:
K,S=input().split()
k=int(K)
s=int(S)
L=0
for X in range(0,k+1):
    for Y in range(0,k+1):
        Z=s-(X+Y)
        if 0<=Z<=k:
            L+=1
        
print(L)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
L=0
for i in range(0,int(K)+1):
    X=i
    if 0<int(S)-X<int(K)*2:
        for j in range(0,int(K)+1):
            Y=j
            Z=int(S)-(X+Y)
            if 0<=Z<=int(K):
                L=L+1
            else:
                L=L
    if int(S)-X==0 or int(S)-X==int(K)*2:
        L=L+1
    else:
        L=L
print(L)        
        

Fixed submission:
K,S=input().split()
k=int(K)
s=int(S)
L=0
for X in range(0,k+1):
    for Y in range(0,k+1):
        Z=s-(X+Y)
        if 0<=Z<=k:
            L+=1
        
print(L)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
L=""
for i in range(0,int(K)+1):
    X=i
    if 0<int(S)-X<int(K)*2:
        for j in range(0,int(K)+1):
            Y=j
            Z=int(S)-(X+Y)
            if 0<=Z<=int(K):
                L+="A"
            else:
                L=L
    if int(S)-X==0 or int(S)-X==int(K)*2:
        L+="A"
    else:
        L=L
print(L.count("A"))        

Fixed submission:
K,S=input().split()
k=int(K)
s=int(S)
L=0
for X in range(0,k+1):
    for Y in range(0,k+1):
        Z=s-(X+Y)
        if 0<=Z<=k:
            L+=1
        
print(L)

Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
L=""
for i in range(0,int(K)+1):
    X=i
    if 0<=int(S)-X<=int(K)*2:
        for j in range(0,int(K)+1):
            Y=j
            Z=int(S)-(X+Y)
            if 0<=Z<=int(K):
                L+="A"
            else:
                L=L
    else:
        L=L
print(L.count("A"))        
        

Fixed submission:
K,S=input().split()
k=int(K)
s=int(S)
L=0
for X in range(0,k+1):
    for Y in range(0,k+1):
        Z=s-(X+Y)
        if 0<=Z<=k:
            L+=1
        
print(L)
Buggy python submission (verdict: Runtime Error):
S=input().split(“ “)
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]==“+”
    print(A+B)
if S[1]==“-”
    print(A-B)

Fixed submission:
S=input().split()
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]=="+":
    print(A+B)
if S[1]=="-":
    print(A-B)

Buggy python submission (verdict: Runtime Error):
S=input().split(“ “)
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]=“+”
    print(A+B)
if S[1]=“-”
    print(A-B)

Fixed submission:
S=input().split()
A=int(S[0])
B=int(S[2])
C=S[1]
if S[1]=="+":
    print(A+B)
if S[1]=="-":
    print(A-B)
Buggy python submission (verdict: Runtime Error):
import collections
N=int(input())
A=list(map(int,input().split()))
if N%2==1:
    if 0 not in A:
        print(0)
    else:
        B=A.remove(0)
        Bc=dict(collections.Counter(B))
        for i in Bc.keys():
            if Bc[i]!=2:
                print(0)
                break
        else:
            print(2**(B//2)%(10**9+7))
else:
    Bc=dict(collections.Counter(A))
    for i in Bc.keys():
        if Bc[i]!=2:
            print(0)
            break
    else:
        print(2**(B//2)%(10**9+7))            

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
if N%2==1:
    if 0 not in A:
        print(0)
    else:
        A.remove(0)
        Bc=dict(collections.Counter(A))
        for i in Bc.keys():
            if Bc[i]!=2:
                print(0)
                break
        else:
            print((2**(len(A)//2))%(10**9+7))
else:
    Bc=dict(collections.Counter(A))
    for i in Bc.keys():
        if Bc[i]!=2:
            print(0)
            break
    else:
        print((2**(len(A)//2))%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
T=input().split(" ")
a=int(T[0])
b=int(T[1])
x=int(T[2])
U=[i for i in range(a,b+1) if i%x==0]
print(len(U))

Fixed submission:
T=input().split(" ")
a=int(T[0])
b=int(T[1])
x=int(T[2])
if a==0:
    print(b//x+1)
else:
    print((b//x)-((a-1)//x))

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
T=S.split(" ")
a=int(T[0])
b=int(T[1])
x=int(T[2])
U=[i for i in range(a,b+1) if i%x==0]
print(len(U))

Fixed submission:
T=input().split(" ")
a=int(T[0])
b=int(T[1])
x=int(T[2])
if a==0:
    print(b//x+1)
else:
    print((b//x)-((a-1)//x))
Buggy python submission (verdict: Runtime Error):
N,x=map(int,input().split())
a=list(map(int,input().split()))
b=0
for i in range(N//2):
    b+=max(a[2*i],a[2*(i+1)])+a[2*i+1]-x
print(b)

Fixed submission:
N,x=map(int,input().split())
a=list(map(int,input().split()))
b=0
for i in range(N-1):
    if a[i]+a[i+1]>x:
        if a[i]<=x:
            b+=max(0,a[i+1]-x+a[i])
            a[i+1]=max(0,x-a[i])
        else:
            b+=a[i]-x+a[i+1]
            a[i+1]=0
            a[i]=x
b+=max(0,a[-2]+a[-1]-x)
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
N,T=map(int,input().split())
A=list(map(int,input().split()))
i=0
j=1
a=0
b=0
while i<=N-1:
    if j==N:
        i+=1
        j=i+1
    elif A[i]>A[j]:
        i=j
        j+=1
    else:
        if A[j]-A[i]>a:
            a=A[j]-A[i]
            b=1
            j+=1
        elif A[j]-A[i]==a:
            b+=1
            j+=1
        elif A[j]-A[i]<a:
            j+=1
print(b)

Fixed submission:
N,T=map(int,input().split())
A=list(map(int,input().split()))
i=0
j=1
a=0
b=0
while i<=N-1:
    if j==N:
        i=N
    elif A[i]>A[j]:
        i=j
        j+=1
    else:
        if A[j]-A[i]>a:
            a=A[j]-A[i]
            b=1
            j+=1
        elif A[j]-A[i]==a:
            b+=1
            j+=1
        elif A[j]-A[i]<a:
            j+=1
print(b)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[-1]:
    a*=0
for i in range(1,n):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
    else:
        a=a*(min(T[i],A[i]))%(10**9+7)
print(a)

Fixed submission:
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
    print(0)
else:
    for i in range(1,N-1):
        
        if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
            a*=min(T[i],A[N-i])
        if T[i]>T[i-1] or A[N-i]>A[N-i+1]:
            a*=1
    print(a%(10**9+7))

Fixed submission:
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input().split()
T=list(int(S[i]) for i in range(len(S)))
B=input().split()
A=list(int(B[i]) for i in range(len(B)))
a=1
if max(T)!=max(A):
    print(-1)
else:
    for i in range(1,N-1):
        
        if T[i]==T[i-1] and A[N-i]==A[N-i+1]:
            a*=min(T[i],A[N-i])
        if T[i]>T[i-1] or A[N-i]>A[N-i+1]:
            a*=1
    print(a%(10**9+7))

Fixed submission:
N=int(input())
T = list(map(int, input().split()))
A = list(map(int, input().split()))
a = 1
if T[0]>A[0] or A[-1]>T[-1] or T[-1]!=A[0]:
    a*=0
for i in range(1,N-1):
    if T[i-1]!=T[i]:
        if T[i]>A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    if A[i]!=A[i+1]:
        if T[i]<A[i]:
            a*=0
            break
        else:
            a*=1
            continue
    a=(a*min(T[i],A[i]))%(10**9+7)
print(a)
Buggy python submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
print(len(S))

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

Buggy python submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
while 0<=i<=len(S)-2:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        if S[i+1]=="S":
            i+=1
    if S[i]=="T":
        i+=1
print(len(S))

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

Buggy python submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-1:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i-=1
        else:
            i+=1
    else:
        i+=1
print(len(S))

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

Buggy python submission (verdict: Runtime Error):
S=list(input())
i=0
while 0<=i<=len(S)-1:
    if S[i]=="S":
        if S[i+1]=="T":
            S.remove(S[i])
            S.remove(S[i])
            i=0
        else:
            i+=1
    else:
        i+=1
print(len(S))
            

Fixed submission:
S=input()
t=0
u=0
for i in range(len(S)):
    if S[i]=="S":
        t+=1
    else:
        if t>=1:
            u+=2
            t-=1
print(len(S)-u)
Buggy python submission (verdict: Runtime Error):
S=input()
T=S[:4]+" "+S[4:]
ptint(T)

Fixed submission:
S=input()
T=S[:4]+" "+S[4:]
print(T)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=0
for i in range(N):
    for j in range(i+1,N):
        if a[i]==j+1 and a[j]==i+1:
            b+=1
print(b)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=0
for i in range(N):
    if i+1==a[a[i]-1]:
        b+=1
print(b//2)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

num=Counter(input())
 ans="YES"  
for X in num.values():
    if X%2!=0:
        ans="NO"
   
print(ans)

Fixed submission:
from collections import Counter
w = Counter(input())
ans = "Yes"
for i in w.values():
    if i % 2 != 0:
        ans = "No"
print(ans)
Buggy python submission (verdict: Runtime Error):
X={int(input()),int(input()),int(input())}
if X in [{5,5,7},{5,7,5},{7,5,5}]:
    print("YES")
else:
    print("NO")

Fixed submission:
X=input()
if X in ["5 5 7","5 7 5","7 5 5"]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
def main():
    A=int(input())
    B=int(input())
    C=int(input())
    if (A/B) < C:
        print(int(B/A))
    else:
        print(C)

main()

Fixed submission:
def main():
    A, B, C = map(int, input().split())
    if (B/A) < C:
        print(int (B/A))
    else:
        print(C)

main()
Buggy python submission (verdict: Runtime Error):
def main():
    A,B,C = map(int, input().split())
    if A>B:
        D=A
    else:
        D=B

    list =[]
    for i in range(D):
        if i!=0:
            if (A%i == 0) & (B%i == 0) :
                list.append(i)
    print(list[(len(list)-C)])

main()

Fixed submission:
def main():
    A,B,C = map(int, input().split())
    if A>B:
        D=A
    else:
        D=B

    list =[]
    for i in range(D+1):
        if i!=0:
            if (A%i == 0) & (B%i == 0) :
                list.append(i)
    print(list[(len(list)-C)])
    


main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
S = input()
u, counts = np.unique(list(S),return_counts=True)
result = 0 if len(u) == 1 else len(S) - abs(counts[0]-counts[1])
print(result)

Fixed submission:
S = input()
num_0 = list(S).count('0')
num_1 = list(S).count('1')
print(len(S) - abs(num_0 - num_1))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
len_org = len(S)
while True:
    len_before = len(S)
    S = S.replace("10","").replace("01","")
    len_after = len(S)
    if len_before == len_after:
        break

print(len_org - len_after)

Fixed submission:
S = input()
num_0 = list(S).count('0')
num_1 = list(S).count('1')
print(len(S) - abs(num_0 - num_1))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
len_org = len(S)
while True:
    len_before = len(S)
    S = S.replace("10","").replace("01","").replace("11110000","").replace("00001111","")
    len_after = len(S)
    if len_before == len_after:
        break

print(len_org - len_after)

Fixed submission:
S = input()
num_0 = list(S).count('0')
num_1 = list(S).count('1')
print(len(S) - abs(num_0 - num_1))

Buggy python submission (verdict: Runtime Error):
S = input()
c0, c1 = 0,0
ans = 0
for ch in S:
  if c0 == 0 and ch = '1':
    c1 += 1
  elif c1 == 0 and ch = '0':
    c0 += 1
  elif ch == '1':
    ans += 2
    c0 -= 1
  else:
    ans += 2
    c1 -= 1
    
print(ans)


Fixed submission:
S = input()
c0, c1 = 0,0
ans = 0
for ch in S:
  if c0 == 0 and ch == '1':
    c1 += 1
  elif c1 == 0 and ch == '0':
    c0 += 1
  elif ch == '1':
    ans += 2
    c0 -= 1
  else:
    ans += 2
    c1 -= 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

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

max = max(a, b)
if max > 101:
    max = 101

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])

Fixed submission:
# -*- coding: utf-8 -*-

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

max = 101
#if a < b:
#    max = a

list = []

for ta in range(max):
    if ta == 0:
        continue
    elif a % ta == 0 and b % ta == 0:
        list.append(ta)

print(list[-c])
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
 
count = 0
index = 0

if A > B:
  for i in range(B):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A % i == 0 and B % i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)  

Fixed submission:
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in reversed(range(1, B+1)):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in reversed(range(1,A+1)):
      if A % (i) == 0 and B % (i) == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)

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

count = 0
index = 0
if A > B:
  for i in range(B):
    if A // i == 0 and B // i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in range(A):
      if A // i == 0 and B // i == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)  

Fixed submission:
A, B, K = map(int, input().split())
 
count = 0
index = 0
 
if A >= B:
  for i in reversed(range(1, B+1)):
    if A % i == 0 and B % i == 0:
      index = i
      count = count+1
      if count == K:
        break
elif A < B:
    for i in reversed(range(1,A+1)):
      if A % (i) == 0 and B % (i) == 0:
        index = i
        count = count+1
        if count == K:
          break
  
print(index)