Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
n, k = map(int, input().split())
s = input()

q = []
tmp = 0

if len(s) == 1:
    if k >= 1 or s[0] == '1':
        print(1)
    else:
        print(0)
else:
    if s[0] == '0':
        q.append(0)
    for i in range(len(s)):
        if i == 0:
            tmp += 1
        elif i != len(s)-1:
            if s[i] == s[i-1]:
                tmp += 1
            else:
                q.append(tmp)
                tmp = 1
        else:
            if s[i] == s[i-1]:
                tmp += 1
                q.append(tmp)
            else:
                q.append(tmp)
                q.append(1)
    if s[len(s)-1] == '0':
        q.append(0)

    tmp = 0
    max_k = min(math.ceil(len(q)/2), k)
    ans = []
    if max_k == math.ceil(len(q)/2):
        max_k -= 1
    for i in range(0, len(q) - 2 * max_k, 2):
        ans.append(sum(q[i:i+2*max_k+1]))

    print(max(ans))

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

q = []
tmp = 0

if len(s) == 1:
    if k >= 1 or s[0] == '1':
        print(1)
    else:
        print(0)
else:
    if s[0] == '0':
        q.append(0)
    for i in range(len(s)):
        if i == 0:
            tmp += 1
        elif i != len(s)-1:
            if s[i] == s[i-1]:
                tmp += 1
            else:
                q.append(tmp)
                tmp = 1
        else:
            if s[i] == s[i-1]:
                tmp += 1
                q.append(tmp)
            else:
                q.append(tmp)
                q.append(1)
    if s[len(s)-1] == '0':
        q.append(0)

    tmp = 0
    max_k = min(math.ceil(len(q)/2), k)
    """
    if len(q) == 1:
        if s[0] == '0' and k == 0:
            ans.append(0)
        else:
            ans.append(q[0])

    #先頭、末尾が0の時
    elif s[0] == '0' and len(q) % 2 == 1:
        for i in range(1, len(q) - 2 * max_k, 2):
            ans.append(sum(q[i:i+2*max_k+1]))
        ans.append(sum(q[:+2*max_k]))
        ans.append(sum(q[-2*max_k+1:]))
    #先頭0末尾1
    elif s[0] == '0' :
        for i in range(1, len(q) - 2 * max_k, 2):
            ans.append(sum(q[i:i+2*max_k+1]))
        ans.append(sum(q[:2*max_k]))
    #先頭1末尾0
    elif len(q) % 2 == 0:
        for i in range(1, len(q) - 2 * max_k, 2):
            ans.append(sum(q[i:i+2*max_k+1]))
        ans.append(sum(q[-2*max_k+1:]))
    else:
        if max_k == math.ceil(len(q)/2):
            max_k -= 1
        for i in range(0, len(q) - 2 * max_k, 2):
            ans.append(sum(q[i:i+2*max_k+1]))

    """
    #先頭1末尾1
    left = 0
    right = 0
    tmp = 0
    ans = 0
    for i in range(0, len(q), 2):
        next_left = i
        next_right = min(i + 2 * k+1, len(q))

        while (next_left > left):
            tmp -= q[left]
            left += 1

        while (next_right > right):
            tmp += q[right]
            right += 1

        ans = max(ans, tmp)
    print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

cnt = 0
q = []
now = 0

for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        cnt += 1
    else:
        q.append(cnt)
        cnt = 0

print(max(q))


Fixed submission:
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        if all('ACGT'.count(c) == 1 for c in s[i:j+1]):
            ans = max(ans, j-i+1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
flg = 0

ac_list = []

for i in range(len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list.append(1)
    else:
        ac_list.append(0)

for i in range(q):
    l, r = map(int, input().split())
    print(sum(ac_list[l-1:r-1]))


Fixed submission:
n, q = map(int, input().split())
s = input()
flg = 0

ac_list = [0]

for i in range(0, len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list.append(ac_list[i]+1)
    else:
        ac_list.append(ac_list[i])

#print(ac_list)

for i in range(q):
    l, r = map(int, input().split())
    print(ac_list[r-1] - ac_list[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
flg = 0
for i in range(q):
    l, r = map(int, input().split())
    cnt = 0
    for i in range(l-1, r):
        if s[i] == 'A':
            flg = 1
        elif s[i] == 'C' and flg == 1:
            cnt += 1
            flg = 0
        else:
            flg =0
    print(cnt)


Fixed submission:
n, q = map(int, input().split())
s = input()
flg = 0

ac_list = [0]

for i in range(0, len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        ac_list.append(ac_list[i]+1)
    else:
        ac_list.append(ac_list[i])

#print(ac_list)

for i in range(q):
    l, r = map(int, input().split())
    print(ac_list[r-1] - ac_list[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

k += 1

ans = 0
for x in range(k):
    for y in range(k):
        for z in range(k):
            if x + y + z == s:
                ans += 1

print(ans)


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

k += 1

ans = 0
for x in range(k):
    for y in range(k):
        if s - (x + y) >= 0 and s - (x + y) <=k-1:
                ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()

if s[3]==s[4] and s[5]==s[6]:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()

if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
S = len(s)
l = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
m = "ABCDEFGHIJKLMNOQPRSTUVWXYZ"
old_word = 0
new_word = 0
ans = []
#print(S)
#print(l[n])
#print(m[n])

for i in range(S):
    old_word = l.index(s[i])
    #print(old_word)
    new_word = old_word + n
    print(new_word)
    if new_word > 25:
        new_word = new_word - 26
    ans.append(l[new_word])


#print(l.index("B"))
print(ans)


Fixed submission:
s = input()
List = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
#print(List.index(s))
print(7-List.index(s))
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
m = n**0.5
ans = 0
#print(n)
#print(m)
for i in range(1,math.floor(m+1)):
    if m%i==0:
        ans = i
print(math.floor(ans+ n/ans -2))

Fixed submission:
import math
n = int(input())
m = n**0.5
ans = 1
x = 0 #確認
#print(n)
#print(m)
for i in range(1,math.floor(m)+1):
    x += 1 #確認
    if n%i==0:
        ans = i

print(math.floor(ans+ n/ans -2))
Buggy python submission (verdict: Runtime Error):
n,l = map(int,input().split())
a_list = []
for i in range(1,n+1):
    #print(i)
    a_list.append(l+i-1)
if int(a_list[0])>0:
    a_list.remove(a_list[0])
if 0 in a_list:
    a_list.remove(0)
if int(a_list[n-1])<0:
    a_list.remove(a_list[n-1])
print(sum(a_list))

Fixed submission:
n,l = map(int,input().split())
a_list = []
for i in range(1,n+1):
    #print(i)
    a_list.append(l+i-1)

if int(a_list[n-1])<0:
    a_list.remove(a_list[n-1])

if int(a_list[0])>0:
    a_list.remove(a_list[0])

if 0 in a_list:
    a_list.remove(0)
'''
エラーコード    if int(a_list[n])<0:
               IndexError: list index out of range
if int(a_list[n-2])<0:
    a_list.remove(a_list[n-1])
'''
print(sum(a_list))
Buggy python submission (verdict: Runtime Error):
import math
A = int(input())
B = int(input())
C = int(input())
if A > B:
    print(0)
else :
    if B >= A * C:
        print(C)
    else :
        print(math.floor(B/A))

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

if a > b:
    print("0")
else :
    if b >= a * c:
        print(c)
    else :
        print(math.floor(b/a))

Buggy python submission (verdict: Runtime Error):
import math
A = int(input())
B = int(input())
C = int(input())

if B >= A * C:
    print(C)
else :
    print(math.floor(B/A))
if A > B:
    print(0)

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

if a > b:
    print("0")
else :
    if b >= a * c:
        print(c)
    else :
        print(math.floor(b/a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[int(x) for x in input().split()]
c=0
for i in range(len(l)-2):
    for j in range(i+1,len(l)-1):
        for k in range(j+1,len(l)):
            if l[i]<l[j]+l[k] and l[j]<l[i]+l[k] and l[k]<l[i]+l[j]:
                c=c+1
print(c)                


Fixed submission:
def CountTriangles( A): 
  n = len(A); 
  A.sort();  
  count = 0; 
  for i in range(n - 1, 0, -1): 
        l = 0; 
        r = i - 1; 
        while(l < r): 
            if(A[l] + A[r] > A[i]): 
                count += r - l;  
                r -= 1;  
            else:  
                l += 1;  
  print(count)
n=int(input())
l=[int(x) for x in input().split()]
CountTriangles(l)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    print(a.count(i+1))

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
t = [0]*n
for i in range(n-1):
    t[a[i]-1] += 1
for i in t:
    print(i)
Buggy python submission (verdict: Runtime Error):
a = [map(int,input().split()) for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[0][1],a[1][1],a[2][1]]
a8 = [a[0][2],a[1][2],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= set(B) or set(a2) <= set(B) or set(a3) <= set(B) or set(a4) <= set(B) or set(a5) <= set(B) or set(a6) <= set(B) or set(a7) <= set(B) or set(a8) <= set(B):
    print('Yes')
else:
    print('No')

Fixed submission:
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a6 = set()
a7 = set()
a8 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
a6.update({a1[0],a2[0],a3[0]})
a7.update({a1[1],a2[1],a3[1]})
a8.update({a1[2],a2[2],a3[2]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B or a6 <= B or a7 <= B or a8 <= B:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
a = [input().split() for a in range(3)]
a1 = [a[0][0],a[0][1],a[0][2]]
a2 = [a[1][0],a[1][1],a[1][2]]
a3 = [a[2][0],a[2][1],a[2][2]]
a4 = [a[0][0],a[1][1],a[2][2]]
a5 = [a[0][2],a[1][1],a[2][0]]
a6 = [a[0][0],a[1][0],a[2][0]]
a7 = [a[1][0],a[1][1],a[2][1]]
a8 = [a[2][0],a[2][1],a[2][2]]
n = int(input())
B = [int(input()) for i in range(n)]
if set(a1) <= B or set(a2) <= B or set(a3) <= B or set(a4) <= B or set(a5) <= B or set(a6) <= B or set(a7) <= B or set(a8) <= B:
    print('Yes')
else:
    print('No')

Fixed submission:
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
a3 = list(map(int,input().split()))
a4 = set()
a5 = set()
a6 = set()
a7 = set()
a8 = set()
a4.update({a1[0],a2[1],a3[2]})
a5.update({a1[2],a2[1],a3[0]})
a6.update({a1[0],a2[0],a3[0]})
a7.update({a1[1],a2[1],a3[1]})
a8.update({a1[2],a2[2],a3[2]})
n = int(input())
B =set()
for i in range(n):
    b = int(input())
    B.add(b)
if set(a1) <= B or set(a2) <= B or set(a3) <= B or a4 <= B or a5 <= B or a6 <= B or a7 <= B or a8 <= B:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
digit = ['-2']*n
for i in range(m):
    s,c = input().split()
    s = int(s)
    if digit[s-1] == '-2' or digit[s-1] == c:
        digit[s-1] = c
    else:
        digit[s-1] = '-1'
if ('-1' in digit) or (len(digit)!=1 and digit[0] == '0'):
    print(-1)
else:
    print("".join(digit.replace('-2','0')))

Fixed submission:
n,m = map(int,input().split())
digit = ['-2']*n
for i in range(m):
    s,c = input().split()
    s = int(s)
    if digit[s-1] == '-2' or digit[s-1] == c:
        digit[s-1] = c
    else:
        digit[s-1] = '-1'
if ('-1' in digit) or (len(digit)!=1 and digit[0] == '0' and digit[1] == '-2'):
    print(-1)
else:
    if digit[0] != '-2' or (len(digit)==1 and digit[0] == '-2'):
        print("".join(digit).replace('-2','0'))
    else:
        digit[0] = '1'
        print("".join(digit).replace('-2','0'))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().strip().split())
for number in a:
    if number%2==0:
        if number%3==0 or number%5==0:
            flag = 1
            continue
        else:
            flag = 0
            print('DENIED')
            break
if flag == 1:
    print('APPROVED')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
even = [i for i in a if i%2 ==0]
count = 0 
for i in even:
    if i%3 == 0 or i%5 ==0:
        count += 1
print('APPROVED' if count == len(even) else 'DENIED')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic ={}
for i in range(n):
    a = input()
    if dic.get(a):
        dic[a] += 1
    else:
        dic[a] = 1
res = sorted(list(filter(lambda key:dic[key]==max(dic.values()),list(dic))))
for key in res:
    print(key)

Fixed submission:
n = int(input())
dic ={}
for i in range(n):
    key = input()
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
max_v = max(dic.values())
res = sorted(list(filter(lambda key:dic[key]==max_v,list(dic))))
for key in res:
    print(key)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
dic ={}
for i in range(n):
    key = input()
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
res = sorted(list(filter(lambda key:dic[key]==max(dic.values()),list(dic))))
for key in res:
    print(key)

Fixed submission:
n = int(input())
dic ={}
for i in range(n):
    key = input()
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
max_v = max(dic.values())
res = sorted(list(filter(lambda key:dic[key]==max_v,list(dic))))
for key in res:
    print(key)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [input() for i in range(n)]
dic ={}
for key in s:
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
res = sorted(list(filter(lambda key:dic[key]==max(dic.values()),list(dic))))
for key in res:
    print(key)

Fixed submission:
n = int(input())
dic ={}
for i in range(n):
    key = input()
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
max_v = max(dic.values())
res = sorted(list(filter(lambda key:dic[key]==max_v,list(dic))))
for key in res:
    print(key)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
dic = {}
correct = penalty = 0
for i in range(m):
    p,s = input().split()
    if p not in dic:
        a = []
        a.append(s)
        dic[p] = a
    else:
        if 'AC' not in dic[p]:
            dic[p].append(s)
for p in dic:
    if 'AC' in dic[p]:
        correct += 1
        penalty += (len(dic[p])-1)
print(correct, penalty)

Fixed submission:
n,m = map(int,input().split())
a = [False]*n
b = [0]*n
for i in range(m):
    p,s = input().split()
    p = int(p)
    if s == 'AC':
        a[p-1] = True
    if s == 'WA' and a[p-1] == False:
        b[p-1] += 1
correct = a.count(True)
penalty = 0
for i in range(len(a)):
    if a[i] == True:
        penalty += b[i]
print(correct, penalty)
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
gcd = math.gcd(A,B)
print(int(A*B/gcd))

Fixed submission:
A,B = map(int,input().split())
def gcd(A,B):
    temp = A % B
    while temp != 0:
        A = B
        B = temp
        temp = A%B
    return B
print(int(A*B/gcd(A,B)))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
gcd = math.gcd(A,B)
print(int(A*B/gcd))

Fixed submission:
A,B = map(int,input().split())
def gcd(A,B):
    temp = A % B
    while temp != 0:
        A = B
        B = temp
        temp = A%B
    return B
print(int(A*B/gcd(A,B)))

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())
gcd = math.gcd(A,B)
print(int(A*B/gcd))

Fixed submission:
A,B = map(int,input().split())
def gcd(A,B):
    temp = A % B
    while temp != 0:
        A = B
        B = temp
        temp = A%B
    return B
print(int(A*B/gcd(A,B)))

Buggy python submission (verdict: Time Limit Exceeded):
A,B = map(int,input().split())
greater = max(A,B)
lcm = 0
while(True):
    if((greater % A == 0) and (greater % B == 0)):
        lcm = greater
        break
    greater += 1
print(greater)

Fixed submission:
A,B = map(int,input().split())
def gcd(A,B):
    temp = A % B
    while temp != 0:
        A = B
        B = temp
        temp = A%B
    return B
print(int(A*B/gcd(A,B)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(2,n):
    if (n % i) == 0 and i < 10 and n/i <10:
        res = 1
        break
    else:
        res = -1
if res == 1:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
res = []
for i in range(1,10):
    for j in range(1,10):
        res.append(i*j)
res = set(res)
if n in res:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int,input().split()))
a = [-1]*n
a[0] = b[0]
a[-1:] = b[-1:]
for i in range(n-2):
    a[i+1] = min(b[i],b[i+1])
print(sum(a))

Fixed submission:
n = int(input())
print(n**3)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
b = [-1]*n
for i in range(n):
    b[i] = max(a[:i]+a[i+1:])
for key in b:
    print(key)

Fixed submission:
import numpy as np
n = int(input())
a = [int(input()) for i in range(n)]
max = np.max(a)
max_pos = np.argmax(a)
b = [max]*n
b[max_pos] = np.max(a[:max_pos]+a[max_pos+1:])
for key in b:
    print(key)
Buggy python submission (verdict: Runtime Error):
def wheel(a,b):
    if a>=13:
        return b
    if a>=6 and a<=12:
        return b/2
    if a<6:
    return 0   
a,b = map(int, input().split())
print(wheel(a,b))

Fixed submission:
def wheel(a,b):
    if a>=13:
        return b
    if a>=6 and a<=12:
        return int(b/2)
    if a<=5:
        return 0   
a,b = map(int, input().split())
print(wheel(a,b))

Buggy python submission (verdict: Runtime Error):
def wheel(a,b):
    if a>=13:
        return b
    if a>=6 and a<=12:
        return b/2
    if a<6
    return 0   
a,b = map(int, input().split())
print(wheel(a,b))

Fixed submission:
def wheel(a,b):
    if a>=13:
        return b
    if a>=6 and a<=12:
        return int(b/2)
    if a<=5:
        return 0   
a,b = map(int, input().split())
print(wheel(a,b))
Buggy python submission (verdict: Runtime Error):
c = []
d = []
n,m = map(int, input().split())
for i in range(m):
    a,b = map(int,input().split())
    c.append(a)
    d.append(b)
minl = max(c)   
maxr = min(d)
if min1>maxr:
    print(0)
else:
    print(maxr-minl+1)

Fixed submission:
c = []
d = []
n,m = map(int, input().split())
for i in range(m):
    a,b = map(int,input().split())
    c.append(a)
    d.append(b)
minl = max(c)   
maxr = min(d)
if minl>maxr:
    print(0)
else:
    print(maxr-minl+1)

Buggy python submission (verdict: Runtime Error):
a = []
b = []
n,m = map(int, input().split())
for i in range(m):
    a,b = map(int,input().split())
    a.append(a)
    b.append(b)
minl = max(a)   
maxr = min(b)
print(maxr-minl)

Fixed submission:
c = []
d = []
n,m = map(int, input().split())
for i in range(m):
    a,b = map(int,input().split())
    c.append(a)
    d.append(b)
minl = max(c)   
maxr = min(d)
if minl>maxr:
    print(0)
else:
    print(maxr-minl+1)
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        temp = a % b
        a = b
        b = temp
    return a
def blackbord(n,a):
    return max(list(hcf(a[i],j) for i in range(len(a)) for j in a[0:i] + a[i + 1:]))
n = int(input())
a=list(map(int, input().split()))
print(blackbord(n,a))

Fixed submission:
def biscuit(a,b,t):
    i = 1
    while i*a<=t:
        i = i+1
    return b*(i-1)
    
a,b,t = map(int, input().split())
print(biscuit(a,b,t))
Buggy python submission (verdict: Runtime Error):
def Ways(a,b,c):
    if c>=a and c<=b:
        return 'Yes'
    else:
        return 'No'

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

Fixed submission:
def Ways(a,b,c):
    if c>=min(a,b) and c<=max(a,b):
        return 'Yes'
    else:
        return 'No'

a,b,c = map(int, input().split())
print(Ways(a,b,c))
Buggy python submission (verdict: Runtime Error):
def eee(s,k):
    a = s[k]
    for i in range(len(s)):
        if s[i]!=a:
            s[i] = '*'            
    return ''.join(s)

n = int(input())
s = list(input())
k = int(input())
print(eee(s,k))

Fixed submission:
def eee(s,k):
    a = s[k-1]
    k = list(filter(lambda x:x!=a,s))
    z = ''.join(s)
    for i in k:
        z = z.replace(i,'*')
    return z

n = int(input())
s = list(input())
k = int(input())
print(eee(s,k))
Buggy python submission (verdict: Runtime Error):
def button(a,b):
    if a==b:
        return int(a)+int(b)
    else:
        return 2*int(max(a,b))-1
a = int(input())
b = int(input())
button(a,b)

Fixed submission:
def button(a,b):
    if a==b:
        return int(a)+int(b)
    else:
        return 2*int(max(a,b))-1
a,b = map(int, input().split())
print(button(a,b))

Buggy python submission (verdict: Runtime Error):
def button(a,b):
    if a>b:
        return 2*int(a)-1
    if a<b:
        return 2*int(b)-1
    if a==b:
        return int(a)+int(b)
a = input()
b = input()
button(a,b)

Fixed submission:
def button(a,b):
    if a==b:
        return int(a)+int(b)
    else:
        return 2*int(max(a,b))-1
a,b = map(int, input().split())
print(button(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
S = input()
res = []
for i in range(q):
    l,r = map(int,input().split())
    res.append(S[l-1:r].count('AC'))
for i in res:
    print(i)

Fixed submission:
N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
    t[i+1]=t[i]+(1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
S = input()
L = []
R = []
for i in range(q):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
for i in range(q):    
    print(S[L[i]-1:R[i]].count('AC'))

Fixed submission:
N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
    t[i+1]=t[i]+(1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = sorted([int(input()) for i in range(n)])
res = [0]*(n-k+1)
for i in range(n-k+1):
    res[i] = h[i+n-k]-h[i]
print(min(res))

Fixed submission:
n,k = map(int,input().split())
h = sorted([int(input()) for i in range(n)])
res = [0]*(n-k+1)
for i in range(n-k+1):
    res[i] = h[i+k-1]-h[i]
print(min(res))
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
res = []
dic = {}
for i in range(m):
    p,y = map(int,input().split())
    res.append([p,y])
    if p not in dic:
        dic[p] = [y]
    else:
        dic[p].append(y)
        dic[p] = sorted(dic[p])        
for i in range(m):
    res[i][1] = dic[res[i][0]].index(res[i][1])+1
    print(str(res[i][0]).zfill(6)+str(res[i][1]).zfill(6))

Fixed submission:
N,M = map(int,input().split())
PY = [[int(i) for i in input().split()]+[j] for j in range(M)]

dic = {}
PY.sort(key = lambda x:x[1])
ken = [0 for i in range(N)]
for k,value,s in PY:
    ken[k-1] += 1
    s1 = str(k).zfill(6)
    s2 = str(ken[k-1])
    s2 = s2.zfill(6)
    dic[s] = s1+s2

ans = sorted(dic.items(),key=lambda x:x[0])

for i,j in ans:
    print(j)
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
CT = [list(map(int,input().split())) for i in range(N)]
CT = list(filter(lambda x:x[1]<=N,CT))
print(min(CT[0]))

Fixed submission:
N,T = map(int,input().split())
CT = [list(map(int,input().split())) for i in range(N)]
CT = list(filter(lambda x:x[1]<=T,CT))
if len(CT)==0:
    print('TLE')
else:
    print(min(CT)[0])