Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
cnt=0  
lst=[[i for i in input()] for j in range(n)]
dic=[[] for i in range(n)]
for i in range(n):
  dic[i]=Counter(lst[i])
for left in range(n-1):
  l=sorted(dic[left].items(),key=lambda x:x[0])
  for right in range(left++1,n):
    r=sorted(dic[right].items(),key=lambda x:x[0])
    flg=True
    for ll,rr in zip(l,r):
      if ll!=rr:
        flg=False
        break
    if flg:
      cnt+=1
print(cnt)      

Fixed submission:
from scipy.misc import comb
n=int(input())
d={}
cnt=0
for i in range(n):
  a=[i for i in input()]
  a.sort()
  b="".join(a)
  d[b]= d[b]+1 if b in d else 1
for k,v in d.items():
  cnt+=comb(v,2,exact=True)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
nn,*a=open(0).read().split()
n=int(nn)
cnt=0
for left in range(n-1):
  for right in range(left+1,n):
    b=[i for i in a[right][:]]
    for leng in range(10):
      flg=True
      if a[left][leng] in b:
        b.remove(a[left][leng])
      else:  
        flg=False
        break
    if flg:
      cnt+=1
print(cnt)      

Fixed submission:
from scipy.misc import comb
n=int(input())
d={}
cnt=0
for i in range(n):
  a=[i for i in input()]
  a.sort()
  b="".join(a)
  d[b]= d[b]+1 if b in d else 1
for k,v in d.items():
  cnt+=comb(v,2,exact=True)
print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
cnt=0
for i in range(5):
  if lst[i]!=i+1:
    cnt+=1
print("YES" if cnt<=2 else "NO") 

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
cnt=0
for i in range(n):
  if lst[i]!=i+1:
    cnt+=1
print("YES" if cnt<=2 else "NO")
Buggy python submission (verdict: Runtime Error):
print(3*(int(input())**2)

Fixed submission:
print(3*int(input())**2)
Buggy python submission (verdict: Time Limit Exceeded):
n,*a=map(int,open(0).read().split())
for i in range(n):
  b=a[:]
  b.pop(i)
  print(max(b))

Fixed submission:
n,*a=map(int,open(0).read().split())
b=sorted(a)
for i in range(n):
  print(b[-1] if a[i]!=b[-1] else b[-2])
Buggy python submission (verdict: Runtime Error):
import itertools
L,R=map(int,input().split())
c=list(itertools.combinations(range(L,R+1),2))
_min=2018
for i in c:
  a=(i[0]*i[1])%2019
  if a<_min:
    _min=a
print(_min)    


Fixed submission:
L,R=map(int,input().split())
_min=2018
if L==0:
  _min=0
else:  
  for l in range(L,L+2019):
    if l>R:
      break
    for r in range(l+1,l+2020):
      if r>R:
        break
      m=(l*r)%2019
      if _min>m:
        _min=m
print(_min)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=[]
for i in range(M):
   a.append(int(input()))
dp=[0]*(N+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
for i in range(2,N+1):
    if i in a:
        continue
    dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)    

Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,*a=map(int,open(0).read().split())
dp=[0]*(N+1)
dp[0]=1
if 1 not in a:
    dp[1]=1
for i in range(2,N+1):
    if i in a:
        continue
    dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)    

Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,*a=map(int,open(0).read().split())
dp=[1]*(N+1)
for i in a:
    dp[i]=0
for i in range(2,N+1):
    if i in a:
        continue
    dp[i]=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])    

Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,*a=map(int,open(0).read().split())
dp=[1]*(N+1)
for i in a:
    dp[i]=0
for i in range(2,N+1):
    if i in a:
        continue
    dp[i]=dp[i-1]+dp[i-2]
print(dp[-1]%1000000007)    


Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,*a=map(int,open(0).read().split())
dp=[0]*(N+1)
dp[0]=1
for i in a:
    dp[i]=0
if 1 in a:
    dp[1]=0
else:
    dp[1]=1
for i in range(2,N+1):
    if i not in a:
        dp[i]=dp[i-1]+dp[i-2]
print(dp[-1]%1000000007)    


Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N,M,*a=map(int,open(0).read().split())
dp=[0]*(N+1)
dp[0]=1
if 1 in a:
    dp[1]=0
else:
    dp[1]=1
for i in range(2,N+1):
    if i in a:
        continue
    dp[i]=dp[i-1]+dp[i-2]
print(dp[-1]%1000000007)    


Fixed submission:
N,M=map(int,input().split())
dp=[1]*(N+1)
for i in range(M):
    dp[int(input())]=0
for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
N,M=map(int,input().split())
x=set()
L,R=map(int,input().split())
x=set(range(L,R+1))
for i in range(M-1):
    L,R=map(int,input().split())
    x=x & set(range(L,R+1))
print(len(x))    

Fixed submission:
import sys
N,M=map(int,input().split())
_min,_max=map(int,input().split())
for i in range(M-1):
   L,R=map(int,input().split())
   if R<_min or L>_max:
       print(0)
       sys.exit()
   _min,_max=max(_min,L),min(_max,R)
print(_max+1-_min)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
N,M=map(int,input().split())
lst=[]
for i in range(M):
    L,R=map(int,input().split())
    lst.append(set(range(L,R+1)))
print(len(reduce(lambda a,b:a&b,lst)))

Fixed submission:
import sys
N,M=map(int,input().split())
_min,_max=map(int,input().split())
for i in range(M-1):
   L,R=map(int,input().split())
   if R<_min or L>_max:
       print(0)
       sys.exit()
   _min,_max=max(_min,L),min(_max,R)
print(_max+1-_min)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
from operator import add
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print(reduce(add,[v[i]-c[i] for i in range(n) if v[i]>c[i]]))

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])

ans=0
for i in range(1 << len(dif)):
    sum=0
    for j in range(len(dif)):
        if ((i>>j)&1)==1:
            sum += dif[j]
    ans = max(ans, sum)
print(ans)

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
ans=0
for i in range(1 << n):
    sum=0
    for j in range(n):
        if ((i>>j)&1)==1:
            sum += v[j] - c[j]
    ans = max(ans, sum)
print(ans)

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
b_lst=[]
for i in range(1 << n):
    sum_v=0
    sum_c=0
    for j in range(n):
        if ((i>>j)&1)==1:
            sum_v += v[j]
            sum_c += c[j]
    b_lst.append(sum_v - sum_c)
print(max(b_lst))

Fixed submission:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
N,*a=map(int,open(0).read().split())
L=[]
R=[]
for i in range(N):
    L.append(reduce(fractions.gcd,a[:i+1]))
    R.append(reduce(fractions.gcd,a[(N-1)-i:]))
L.pop()
R.pop()
R.reverse()    
#print(L,R)
LR=[R[0]]
for i in range(1,N-1):
    LR.append(fractions.gcd(L[i-1],R[i]))
LR.append(L[-1])
print(max(LR))

Fixed submission:
import fractions
#from functools import reduce
N,*a=map(int,open(0).read().split())
L=[]
L_base=a[0]
b=a[:]
b.reverse()
R=[]
R_base=b[0]
for i in range(N-1):
    L_base=fractions.gcd(L_base,a[i])
    L.append(L_base)
    R_base=fractions.gcd(R_base,b[i])
    R.append(R_base)
LR=[R[-1]]
for i in range(N-2):
    LR.append(fractions.gcd(L[i],R[-2-i]))
LR.append(L[-1])
print(max(LR))

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
N,*a=map(int,open(0).read().split())
_max=0
for i in a:
    b=a[:]
    b.remove(i)
    _max=max(_max,reduce(fractions.gcd,b))
print(_max)

Fixed submission:
import fractions
#from functools import reduce
N,*a=map(int,open(0).read().split())
L=[]
L_base=a[0]
b=a[:]
b.reverse()
R=[]
R_base=b[0]
for i in range(N-1):
    L_base=fractions.gcd(L_base,a[i])
    L.append(L_base)
    R_base=fractions.gcd(R_base,b[i])
    R.append(R_base)
LR=[R[-1]]
for i in range(N-2):
    LR.append(fractions.gcd(L[i],R[-2-i]))
LR.append(L[-1])
print(max(LR))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
N,*a=map(int,open(0).read().split())
_max=0
for i in a:
    b=a[:]
    b.remove(i)
    _max=max(_max,reduce(math.gcd,b))
print(_max)

Fixed submission:
import fractions
#from functools import reduce
N,*a=map(int,open(0).read().split())
L=[]
L_base=a[0]
b=a[:]
b.reverse()
R=[]
R_base=b[0]
for i in range(N-1):
    L_base=fractions.gcd(L_base,a[i])
    L.append(L_base)
    R_base=fractions.gcd(R_base,b[i])
    R.append(R_base)
LR=[R[-1]]
for i in range(N-2):
    LR.append(fractions.gcd(L[i],R[-2-i]))
LR.append(L[-1])
print(max(LR))
Buggy python submission (verdict: Runtime Error):
import math

lst = []
min_1 = "129"
for i in range(5):
    s = input()
    lst.append(s)
    if s[-1] != "0" and s[-1] <= min_1[-1]:
        min_1 = s
lst.remove(min_1)
a = list(map(lambda x:math.ceil(int(x)/10)*10,lst))
print(sum(a) + int(min_1))


Fixed submission:
just=[]
left=[]
for i in range(5):
  a=int(input())
  if a%10 == 0:
    just.append(a)
  else:
    left.append(a)
_sum = sum(just)    
_min=10
index=-1
for i in range(len(left)):
  i1=left[i]%10
  if _min > i1:
    _min = i1
    index = i
for i in range(len(left)):
  if i == index:
    _sum += left[i]
  else:
    b=left[i]%10
    _sum += left[i] + (10-b)
print(_sum)

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

lst = []
min_1 = "9"
for i in range(5):
    s = input()
    lst.append(s)
    if s[-1] != "0" and s[-1] < min_1[-1]:
        min_1 = s
lst.remove(min_1)
a = list(map(lambda x:math.ceil(int(x)/10)*10,lst))
print(sum(a) + int(min_1))


Fixed submission:
just=[]
left=[]
for i in range(5):
  a=int(input())
  if a%10 == 0:
    just.append(a)
  else:
    left.append(a)
_sum = sum(just)    
_min=10
index=-1
for i in range(len(left)):
  i1=left[i]%10
  if _min > i1:
    _min = i1
    index = i
for i in range(len(left)):
  if i == index:
    _sum += left[i]
  else:
    b=left[i]%10
    _sum += left[i] + (10-b)
print(_sum)
Buggy python submission (verdict: Time Limit Exceeded):
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

ABC = []
for a in A:
    for b in B:
        for c in C:
            ABC.append(a+b+c)
ABC = sorted(ABC,reverse=True)
for k in range(K):
    print(ABC[k])


        

Fixed submission:
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

AB = []
for a in A:
    for b in B:
            AB.append(a+b)
AB = sorted(AB,reverse=True)[:K]
C = sorted(C,reverse=True)
ABC = []

for c in C:
    for ab in AB:
        ABC.append(c + ab)
ABC = sorted(ABC,reverse=True)        
print(*ABC[:K],sep="\n")
Buggy python submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
    if i==(len(s)-1):
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0])    

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])

Buggy python submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0]) 

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])

Buggy python submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l) if len(l)>1 else l[0])    

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])

Buggy python submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l))    

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])

Buggy python submission (verdict: Runtime Error):
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l))    

Fixed submission:
s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])
Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
s_cnt=[]
cnt=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        s_cnt.append(1)
    else:
        s_cnt.append(0)
for i in range(Q):
    l,r=map(int,input().split())
    print(sum(s_cnt[l-1:r-1]))

Fixed submission:
N,Q=map(int,input().split())
S=input()
s_cnt=[]
cnt=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        cnt+=1
        s_cnt.append(cnt)
    else:
        s_cnt.append(cnt)
for i in range(Q):
    l,r=map(int,input().split())
    l-=2
    r-=2
    if l<0:
        print(s_cnt[r])
    else:    
        print(s_cnt[r] - s_cnt[l])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
s_cnt=[]
for i in range(N):
    s_cnt.append(S[:i+1].count("AC"))
#print(s_cnt)    
for i in range(Q):
    l,r=map(int,input().split())
    if l-2 < 0:
        print(s_cnt[r-1])
    else:    
        print(s_cnt[r-1] - s_cnt[l-1])

Fixed submission:
N,Q=map(int,input().split())
S=input()
s_cnt=[]
cnt=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        cnt+=1
        s_cnt.append(cnt)
    else:
        s_cnt.append(cnt)
for i in range(Q):
    l,r=map(int,input().split())
    l-=2
    r-=2
    if l<0:
        print(s_cnt[r])
    else:    
        print(s_cnt[r] - s_cnt[l])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q=map(int,input().split())
S=input()
for i in range(Q):
    l,r=map(int,input().split())
    print(S[l-1:r].count("AC"))

Fixed submission:
N,Q=map(int,input().split())
S=input()
s_cnt=[]
cnt=0
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        cnt+=1
        s_cnt.append(cnt)
    else:
        s_cnt.append(cnt)
for i in range(Q):
    l,r=map(int,input().split())
    l-=2
    r-=2
    if l<0:
        print(s_cnt[r])
    else:    
        print(s_cnt[r] - s_cnt[l])
Buggy python submission (verdict: Time Limit Exceeded):
def check_val(ind):
    if ind > len(b): return False 
    if b[ind-1] == ind:
        ans.append(ind)
        del b[ind-1]
        return True
    else:
        return False


N,*b = map(int,open(0).read().split())
if b[0] != 1: 
    print(-1)
    exit()

set_b = sorted(set(b),reverse=True)
ans = []
while len(b) != 0:
    flg = False
    for i in set_b:
        flg = check_val(i)
        if flg: break
    if set_b[-1] not in b: del set_b[-1]
else: #消せるものがなくなった
    if len(b) == 0:
        print(*ans[::-1],sep="\n")
    else:
        print(-1)
    
    

Fixed submission:
def check_val(ind):
    if ind > len(b): return False 
    if b[ind-1] == ind:
        ans.append(ind)
        del b[ind-1]
        if ind not in b: set_b.remove(ind)
        return True
    else:
        return False


N,*b = map(int,open(0).read().split())
if b[0] != 1: 
    print(-1)
    exit()

set_b = sorted(set(b),reverse=True)
ans = []

while len(b) != 0:
    flg = False
    for i in set_b:
        flg = check_val(i)
        if flg: break
    
    if flg == False:
        print(-1)
        exit() 
else: #消せるものがなくなった
    print(*ans[::-1],sep="\n")

Buggy python submission (verdict: Time Limit Exceeded):
def check_val(ind):
    if ind > len(b): return False 
    if b[ind-1] == ind:
        ans.append(ind)
        del b[ind-1]
        return True
    else:
        return False


N,*b = map(int,open(0).read().split())
if b[0] != 1: 
    print(-1)
    exit()

set_b = sorted(set(b),reverse=True)
ans = []
while len(b) != 0:
    flg = False
    for i in set_b:
        flg = check_val(i)
        if flg: break
else: #消せるものがなくなった
    if len(b) == 0:
        print(*ans[::-1],sep="\n")
    else:
        print(-1)
    
    

Fixed submission:
def check_val(ind):
    if ind > len(b): return False 
    if b[ind-1] == ind:
        ans.append(ind)
        del b[ind-1]
        if ind not in b: set_b.remove(ind)
        return True
    else:
        return False


N,*b = map(int,open(0).read().split())
if b[0] != 1: 
    print(-1)
    exit()

set_b = sorted(set(b),reverse=True)
ans = []

while len(b) != 0:
    flg = False
    for i in set_b:
        flg = check_val(i)
        if flg: break
    
    if flg == False:
        print(-1)
        exit() 
else: #消せるものがなくなった
    print(*ans[::-1],sep="\n")
Buggy python submission (verdict: Time Limit Exceeded):
s=[i for i in input()]
leng=len(s)
flg=True
while flg:
    flg=False
    for i in range(len(s)-1):
        if s[i]!=s[i+1]:
            s.pop(i+1)
            s.pop(i)
            flg=True
            break
print(leng - len(s))     
    

Fixed submission:
s=input()
print(min(s.count("0") , s.count("1")) * 2)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,*h=map(int,open(0).read().split())
dp = [0]*n
for i in range(1,n):
  dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i))
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
#自分のコードがTLEになるので、他の人が書いたコードでAC出来るのか確認。

Buggy python submission (verdict: Time Limit Exceeded):
n,k,*h=map(int,open(0).read().split())
dp = [0]*n
for i in range(1,n):
  dp[i]=min([dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i)])
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
#自分のコードがTLEになるので、他の人が書いたコードでAC出来るのか確認。

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=map(int,input().split())
h=np.array(input().split(), dtype=int)
dp=np.zeros(n, dtype=int)
dp=[0]*n
for i in range(1, n):
    left=max(0, i - k)
    dp[i]=min(abs(h[i]-h[left:i])+dp[left:i])
print(dp[-1])


Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
#自分のコードがTLEになるので、他の人が書いたコードでAC出来るのか確認。

Buggy python submission (verdict: Time Limit Exceeded):
n,k,*h=map(int,open(0).read().split())
dp = [0]*n
for i in range(1,n):
  lst = [dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-k),i)]
  dp[i] = min(lst)
print(dp[-1])

Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
#自分のコードがTLEになるので、他の人が書いたコードでAC出来るのか確認。

Buggy python submission (verdict: Time Limit Exceeded):
n,k,*h=map(int,open(0).read().split())
dp=[0]*n
for i in range(1,n):
  left=max(i-k,0)
  lst=[dp[j]+abs(h[i]-h[j]) for j in range(left,i)]
  dp[i]=min(lst)
print(dp[-1])  


Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)
#自分のコードがTLEになるので、他の人が書いたコードでAC出来るのか確認。