Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
Min = float('inf')
Max = math.ceil(math.sqrt(N))
for i in range(1,Max+1):
    if N%i==0:
        b = N//i
        Min = min(Min,i+b-2)
print(Min

Fixed submission:
import math
N = int(input())
Min = float('inf')
Max = math.ceil(math.sqrt(N))
for i in range(1,Max+1):
    if N%i==0:
        b = N//i
        Min = min(Min,i+b-2)
print(Min)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L = [int(i) for i in input().split()]

L.sort()

ans = 0
for a in range(len(L)):
    for b in range(a+1,len(L)):
        c_max = L[a]+L[b]-1
        left = b+1
        right = len(L)
        mid = (right+left)//2
        while left<right:
            mid = (right+left)//2
            if c_max < L[mid]:
                right = mid
            else:
                left = mid+1
        ans += left-(b+1)
       
        
        
print(ans)

Fixed submission:
import bisect
import copy

#bisect2回使用する計算はアウト

N = int(input())
L = [int(i) for i in input().split()]
L.sort()
ans = 0
for i in range(N):
    for j in range(i+1,N):
        Max = bisect.bisect_left(L,L[i]+L[j])
        ans += max(Max-(j+1),0)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
k = int(input())

s += s[0]

cnt = 0
pre = s[0]
for i in range(1,len(s)):
    if s[i]==pre:
        cnt += 1
        pre =''
    else:
        pre = s[i]
ans = cnt*k
if (s[-3]!=s[-2]) and (s[-2]==s[-1]):
    print(ans-1)
else:
    print(ans)

Fixed submission:
s = list(input())
k = int(input())
s += '+'

releki = []
cnt = 1
pre = s[0]
for i in range(1,len(s)):
    if pre==s[i]:
        cnt += 1
    else:
        releki.append([pre,cnt])
        pre = s[i]
        cnt = 1
        
ans = 0
for i in range(len(releki)):
    ans += releki[i][1]//2
if len(releki)==1:
    print((len(s)-1)*k//2)
    exit()
if s[0]!=s[-3]:
    print(ans*k)
else:
    a = releki[0][1]
    b = releki[-1][1]
    ans = ans*k - (k-1)*(a//2 +b//2 -(a+b)//2)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
A,B = map(int,input().split())

import math


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        return [1]
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
Max = max(A,B)
def koyaku(a,b,arr):
    for i in range(1,Max+1):
        if a%i==0 and b%i==0:
            arr.append(i)
    return arr
Koyaku =[]
cnt = 0
Koyaku = koyaku(A,B,Koyaku)
Koyaku.sort()

data = get_sieve_of_eratosthenes(Koyaku[-1])
data.append(1)
for i in Koyaku:
    if i in data:
        cnt+=1
print(cnt)

Fixed submission:
import fractions
import collections
import math
A,B = map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    
    return arr
Gcd = fractions.gcd(A,B)
ans = factorization(Gcd)
print(len(ans)+1)

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

import math


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
Max = max(A,B)
def koyaku(a,b,arr):
    for i in range(2,Max+1):
        if a%i==0 and b%i==0:
            arr.append(i)
    return arr
Koyaku =[]
cnt = 0
Koyaku = koyaku(A,B,Koyaku)
data = get_sieve_of_eratosthenes(Max)
for i in Koyaku:
    if i in data:
        cnt+=1
print(cnt+1)

Fixed submission:
import fractions
import collections
import math
A,B = map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    
    return arr
Gcd = fractions.gcd(A,B)
ans = factorization(Gcd)
print(len(ans)+1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [i%(i+1) for i in range(1,N)]
print(sum(P))

Fixed submission:
N = int(input())
N = N-1
ans = N*(N+1)//2
print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = [int(i) for i in range(1,N+1)]
ans = 0
for i in range(1,N):
    ans += i%P[i]
print(ans)

Fixed submission:
N = int(input())
N = N-1
ans = N*(N+1)//2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for i in range(N):
    tmp = list(input())
    tmp.sort()
    S.append(tmp)
cnt = 0

for i in range(N):
    for j in range(i+1,N):
        if S[i]==S[j]:
            cnt += 1

print(cnt)

Fixed submission:
N = int(input())
S = []
for i in range(N):
    tmp = list(input())
    tmp.sort()
    S.append(''.join(tmp))
cnt = 0

mydict = {}

for i in range(N):
    if (S[i] in mydict.keys()) == False:
        mydict[S[i]] = 0
    else:
        cnt += mydict[S[i]]+1
        mydict[S[i]] += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
L,R = map(int,input().split())
mod = 2019
cnt = 0
ans = float('inf')
List = [False for i in range(2019)]
for i in range(L,R):
    for j in range(i+1,R+1):
        tmp = (i*j)%mod
        List[tmp] = True
        ans = min(tmp,L*R,ans)
        if all(List):
            print(ans)
            sys.exit()
print(ans)

Fixed submission:
import sys
L,R = map(int,input().split())
mod = 2019
cnt = 0
ans = float('inf')
List = [False for i in range(2019)]
for i in range(L,R):
    for j in range(i+1,R+1):
        tmp = (i*j)%mod
        List[tmp] = True
        ans = min(tmp,L*R,ans)
        if cnt>=10**6 or all(List)==True:
            print(ans)
            sys.exit()
        cnt +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
Num = 1000000007
N,K = map(int,input().split())

def conbinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))


for i in range(1,K+1):
    tmp = conbinations_count(N-K+1,i)*conbinations_count(K-1,i-1)
    print(tmp%Num)

Fixed submission:
import math
Num = 1000000007
N,K = map(int,input().split())

def conbinations_count(n, r):
    if n<0 or r<0 or n-r<0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))


for i in range(1,K+1):
    tmp = conbinations_count(N-K+1,i)*conbinations_count(K-1,i-1)
    print(tmp%Num)
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Fixed submission:
import fractions

def lcm(x,y):
    return x*y // fractions.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

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

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Fixed submission:
import fractions

def lcm(x,y):
    return x*y // fractions.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

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

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

Fixed submission:
import fractions

def lcm(x,y):
    return x*y // fractions.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)

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

def lcm(x,y):
    return x*y // math.gcd(x,y)


a,b,c,d = map(int,input().split())
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-(a//c)-(a//d)+(a//lcm(c,d))

print(not_b-not_a_1)

Fixed submission:
import fractions

def lcm(x,y):
    return x*y // fractions.gcd(x,y)


a,b,c,d = map(int,input().split(' '))
not_a_1 =0
not_b = 0
not_b =  b-(b//c)-(b//d)+(b//lcm(c,d))
not_a_1 = a-1-((a-1)//c)-((a-1)//d)+((a-1)//lcm(c,d))

print(not_b-not_a_1)
Buggy python submission (verdict: Runtime Error):
S = []
N,M = map(int,input().split())
for i in range(M):
    tmp = [int(i) for i in input().split()]
    K.append(tmp[0])
    tmp.pop(0)
    S.append(tmp)
P = [int(i) for i in input().split()]
List = []
for i in range(2**N):
    tmp = []
    for j in range(N):
        if ((i>>j) & 1):
            tmp.append('1')
        else:
            tmp.append('0')
    List.append(tmp)

for i in range(M):
    kouho = []
    for j in range(len(List)):
        cnt = 0
        for k in range(len(List[j])):
            if List[j][k] == '1':
                """if  not (k+1) in S[i]:
                    if not List[j] in kouho:
                        kouho.append(List[j])
                    break"""
                if k+1 in S[i]:
                    cnt += 1
        if cnt % 2 != P[i] and not List[j] in kouho:
            kouho.append(List[j])
    for x in kouho:
        List.remove(x)
print(len(List))  


Fixed submission:
K = []
S = []
N,M = map(int,input().split())
for i in range(M):
    tmp = [int(i) for i in input().split()]
    K.append(tmp[0])
    tmp.pop(0)
    S.append(tmp)
P = [int(i) for i in input().split()]
List = []
for i in range(2**N):
    tmp = []
    for j in range(N):
        if ((i>>j) & 1):
            tmp.append('1')
        else:
            tmp.append('0')
    List.append(tmp)

for i in range(M):
    kouho = []
    for j in range(len(List)):
        cnt = 0
        for k in range(len(List[j])):
            if List[j][k] == '1':
                if k+1 in S[i]:
                    cnt += 1
        if cnt % 2 != P[i] and not List[j] in kouho:
            kouho.append(List[j])
    for x in kouho:
        List.remove(x)
print(len(List))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())

l,r = map(int,input().split())
Kouho = [int(i) for i in range(l,r+1)]
for i in range(M-1):
    l,r = map(int,input().split())
    tmp = [int(i) for i in range(l,r+1)]
    for j in Kouho[:]:
        if not j in tmp:
            Kouho.remove(j)

   
print(len(Kouho))


Fixed submission:
N,M = map(int,input().split())
Max_l = 0
Min_r = float('inf')

for i in range(M):
    l,r = map(int,input().split())
    Max_l = max(Max_l,l)
    Min_r = min(Min_r,r)
ans = 0
if Max_l<=Min_r:
    ans = Min_r-Max_l+1
    

   
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
List = []
for i in range(M):
    l,r = map(int,input().split())
    tmp = [int(i) for i in range(l,r+1)]
    List.append(tmp)
Kouho = List[0]

for i in range(1,M):
    for j in Kouho[:]:
        if not j in List[i]:
            Kouho.remove(j)
print(len(Kouho))


Fixed submission:
N,M = map(int,input().split())
Max_l = 0
Min_r = float('inf')

for i in range(M):
    l,r = map(int,input().split())
    Max_l = max(Max_l,l)
    Min_r = min(Min_r,r)
ans = 0
if Max_l<=Min_r:
    ans = Min_r-Max_l+1
    

   
print(ans)
Buggy python submission (verdict: Runtime Error):
import copy
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
A_copy = copy.deepcopy(A)
CB = []
for i in range(M):
    b,c = map(int,input().split())
    CB.append([c,b])
CB.sort(reverse = True)
tmp = 0
for c,b in CB:
    for i in range(b):
        if A_copy[tmp+i]<=c:
            A[tmp+i] = c
        else:
            print(sum(A))
            exit()
    tmp += b

Fixed submission:
import copy
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
A_copy = copy.deepcopy(A)
CB = []
for i in range(M):
    b,c = map(int,input().split())
    CB.append([c,b])
CB.sort(reverse = True)
tmp = 0
for c,b in CB:
    for i in range(b):
        if tmp+i >= N:
            print(sum(A))
            exit()
            
        if A_copy[tmp+i]<c:
            A[tmp+i] = c
        else:
            break
    tmp += b
print(sum(A))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
List = [int(i) for i in input().split()]

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=math.gcd(L[i-1],List[i])
    R[-i-1]=math.gcd(R[-i],List[-i+1])
for i in range(N):
    M.append(math.gcd(L[i],R[i+1]))
print(max(M))

Fixed submission:
N = int(input())
List = [int(i) for i in input().split()]

def gcd(x,y):
    while y!=0:
        tmp = x
        x = y
        y = tmp%y
    return x

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=gcd(L[i-1],List[i])
    R[-i-1]=gcd(R[-i],List[-i+1])
for i in range(N):
    M.append(gcd(L[i],R[i+1]))
print(max(M))

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
List = [int(i) for i in input().split()]

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=math.gcd(L[i-1],List[i])
    R[-i]=math.gcd(R[-i+1],List[-i])
for i in range(N):
    M.append(math.gcd(L[i],R[i+1]))
print(max(M))

Fixed submission:
N = int(input())
List = [int(i) for i in input().split()]

def gcd(x,y):
    while y!=0:
        tmp = x
        x = y
        y = tmp%y
    return x

M = []
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1,N):
    L[i]=gcd(L[i-1],List[i])
    R[-i-1]=gcd(R[-i],List[-i+1])
for i in range(N):
    M.append(gcd(L[i],R[i+1]))
print(max(M))
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <cmath>

using namespace std;

int main(){
 int a,b;
 cin >> a >> b;
 cout << max(a,b)+max(a,b)-1 << endl;

  
}

Fixed submission:
a,b = map(int,input().split())
ans = 0
for i in range(2):
    if a>b:
        ans+=a
        a-=1
    elif a<=b:
        ans+= b
        b-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
Str = input()
if Str == 'A':
    print('T')
elif Str =='T':
    print('A')
elif Str =='C':
    print('G')
else:
    print(C)

Fixed submission:
Str = input()
if Str == 'A':
    print('T')
elif Str =='T':
    print('A')
elif Str =='C':
    print('G')
else:
    print('C')
Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = list(input())
S.append(0)
tmp_input = []
count = 0
Ans = []

for i in range(Q):
    x,y = map(int,input().split())
    count = 0
    tmp_List = S[x-1:y]
    tmp_List.append(0)
    for j in range(len(tmp_List)-1):
        if (tmp_List[j] == 'A') & (tmp_List[j+1] == 'C') ==True:
            count += 1
    Ans.append(count)
for i in range(len(Ans)):
    print(Ans[i])




Fixed submission:
N, Q = map(int,input().split())
S = list(input())
S.append(0)
par = [0]*(N+1)#par[0]は無視
Ans = []
for i in range(N):
        par [i+1]=par[i]+(1 if (S[i]=='A') & (S[i+1]=='C') else 0)
for i in range(Q):
        x,y = map(int,input().split())
        print(par[y-1]-par[x-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int,input().split())
S = list(input())
S.append(0)
List = []
tmp_input = []
count = 0
for i in range(Q):
    tmp_input = input().split()
    List.append(tmp_input)

for i in range(Q):
    count = 0
    tmp_x = int(List[i][0])
    tmp_y = int(List[i][1])
    tmp_List = S[tmp_x-1:tmp_y]
    tmp_List.append(0)
    for j in range(len(tmp_List)-1):
        if (tmp_List[j] == 'A') & (tmp_List[j+1] == 'C') ==True:
            count += 1
    print(count)




Fixed submission:
N, Q = map(int,input().split())
S = list(input())
S.append(0)
par = [0]*(N+1)#par[0]は無視
Ans = []
for i in range(N):
        par [i+1]=par[i]+(1 if (S[i]=='A') & (S[i+1]=='C') else 0)
for i in range(Q):
        x,y = map(int,input().split())
        print(par[y-1]-par[x-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M = map(int,input().split())
A = []
B = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    A.append(tmp_a)
    B.append(tmp_b)
sum_A,sum_B = 0,0
while(M-sum_B)>0:
    min_index = A.index(min(A))
    if (M-sum_B) > B[min_index]:
        sum_A += min(A)*B[min_index]
        sum_B += B[min_index]
        A.pop(min_index)
        B.pop(min_index)
    else:
        sum_A += min(A)*(M-sum_B)
        print(sum_A)
        sys.exit()
        

Fixed submission:
import sys
N,M = map(int,input().split())
List =[]
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_a,tmp_b])
List.sort()
sum_a,sum_b = 0,0
for i in range(N):
    if M-sum_b > List[i][1]:
        sum_a += List[i][0]*List[i][1]
        sum_b += List[i][1]
    else:
        sum_a += List[i][0]*(M-sum_b)
        sum_b += M-sum_b
        print(sum_a)
        sys.exit()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M = map(int,input().split())
A = []
B = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    A.append(tmp_a)
    B.append(tmp_b)
sum_A,sum_B = 0,0
for i in range(N):
    min_index = A.index(min(A))
    if (M-sum_B) > B[min_index]:
        sum_A += min(A)*B[min_index]
        sum_B += B[min_index]
        A.pop(min_index)
        B.pop(min_index)
    else:
        sum_A += min(A)*(M-sum_B)
        print(sum_A)
        sys.exit()

Fixed submission:
import sys
N,M = map(int,input().split())
List =[]
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_a,tmp_b])
List.sort()
sum_a,sum_b = 0,0
for i in range(N):
    if M-sum_b > List[i][1]:
        sum_a += List[i][0]*List[i][1]
        sum_b += List[i][1]
    else:
        sum_a += List[i][0]*(M-sum_b)
        sum_b += M-sum_b
        print(sum_a)
        sys.exit()

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
A = []
B = []
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    A.append(tmp_a)
    B.append(tmp_b)
sum_A,sum_B = 0,0
for i in range(N):
    if (M-sum_B) >= B[A.index(min(A))]:
        sum_A += min(A)*B[A.index(min(A))]
        sum_B += B[A.index(min(A))]
        A.pop(A.index(min(A)))
        B.pop(A.index(min(A)))
    else:
        sum_A += min(A)*(M-sum_B)
        print(sum_A)
        sys.exit()

Fixed submission:
import sys
N,M = map(int,input().split())
List =[]
for i in range(N):
    tmp_a,tmp_b = map(int,input().split())
    List.append([tmp_a,tmp_b])
List.sort()
sum_a,sum_b = 0,0
for i in range(N):
    if M-sum_b > List[i][1]:
        sum_a += List[i][0]*List[i][1]
        sum_b += List[i][1]
    else:
        sum_a += List[i][0]*(M-sum_b)
        sum_b += M-sum_b
        print(sum_a)
        sys.exit()
Buggy python submission (verdict: Runtime Error):
import math
A,B,K = map(int,input().split())
ans = []
if A>B:
    Max = A
else:
    Max = B
for i in range(1,Max):
    if (A%i==0) & (B%i==0):
        ans.append(i)
print(ans[len(ans)-K])


Fixed submission:
import math
A,B,K = map(int,input().split())
ans = []
if A>B:
    Max = A
else:
    Max = B
for i in range(1,Max+1):
    if (A%i==0) & (B%i==0):
        ans.append(i)
print(ans[len(ans)-K])
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Quve = S
count = 0
flag = 0
Quve.append("")
while(flag ==0):
    tmp = count
    for i in range(len(Quve)-1):
        if ((Quve[i]=="0") & (Quve[i+1]=="1")) | ((Quve[i]=="1") & (Quve[i+1]=="0")):
            del Quve[i]
            del Quve[i]
            count += 2
            break
    if (tmp == count):
        flag = 1
print(count)


Fixed submission:
#TLE
# 0と1を数えて少ないほうの2倍を取れば勝ち
S = list(input())
count0 = 0
count1 = 0
for i in range(len(S)):
    if S[i]=='0':
        count0 += 1
    else:
        count1 += 1
print(2*min(count0,count1))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Quve = S
count = 0
flag = 0
Quve.append("")
while(flag ==0):
    tmp = count
    for i in range(len(Quve)-1):
        if ((Quve[i]=="0") & (Quve[i+1]=="1")) | ((Quve[i]=="1") & (Quve[i+1]=="0")):
            del Quve[i]
            del Quve[i]
            count += 2
            break
    if (tmp == count):
        flag = 1
print(count)


Fixed submission:
#TLE
# 0と1を数えて少ないほうの2倍を取れば勝ち
S = list(input())
count0 = 0
count1 = 0
for i in range(len(S)):
    if S[i]=='0':
        count0 += 1
    else:
        count1 += 1
print(2*min(count0,count1))

Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
Quve = []
count = 0
flag = 0
for i in range(len(S)):
    if int(S[i])==0:
        Quve.append("a")#赤文字をaで表記
    else:
        Quve.append("b")
Quve.append("")
while(flag ==0):
    tmp = count
    for i in range(len(Quve)-1):
        if ((Quve[i]=="a") & (Quve[i+1]=="b")) | ((Quve[i]=="b") & (Quve[i+1]=="a")):
            del Quve[i]
            del Quve[i]
            count += 2
            break
    if (tmp == count):
        flag = 1
print(count)


Fixed submission:
#TLE
# 0と1を数えて少ないほうの2倍を取れば勝ち
S = list(input())
count0 = 0
count1 = 0
for i in range(len(S)):
    if S[i]=='0':
        count0 += 1
    else:
        count1 += 1
print(2*min(count0,count1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
otoshidama = []
otoshidama_sum = 0
for i in range(N):
    otoshidama.append(input().split())
for i in range(N):
    otoshidama[i][0] = int(otoshidama[i][0])
    if otoshidama[i][1] == 'BTC':
        otoshidama[i][0] = otoshidama[i][0]*380000
    otoshidama_sum += otoshidama[i][0]
print(otoshidama_sum)

Fixed submission:
N = int(input())
otoshidama = []
otoshidama_sum = 0
for i in range(N):
    otoshidama.append(input().split())
for i in range(N):
    otoshidama[i][0] = float(otoshidama[i][0])
    if otoshidama[i][1] == 'BTC':
        otoshidama[i][0] = otoshidama[i][0]*380000
    otoshidama_sum += otoshidama[i][0]
print(otoshidama_sum)