Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1

for i in range(n.length-2):
    if n[a]<n[b]:
        ans += 1
    a += 1
    b += 1
print(ans)

Fixed submission:
n = int(input())
h = [int(n) for n in input().split()]

max = h[0]
ans = 0

for i in h:
    if max<=i:
        ans += 1
        max = i
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1

for i in range(n.length-1):
    if n[a]<n[b]:
        ans += 1
    a += 1
    b += 1
print(ans)

Fixed submission:
n = int(input())
h = [int(n) for n in input().split()]

max = h[0]
ans = 0

for i in h:
    if max<=i:
        ans += 1
        max = i
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1

while b<n.length
    if n[a]<n[b]:
        ans += 1
    a += 1
    b += 1
print(ans)

Fixed submission:
n = int(input())
h = [int(n) for n in input().split()]

max = h[0]
ans = 0

for i in h:
    if max<=i:
        ans += 1
        max = i
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1
while b != h.length-1:
    while h[a]<h[b]:
        ans = ans + 1
        a = a + 1
        b = b + 1
    a += 1
    b += 1

print(ans)

Fixed submission:
n = int(input())
h = [int(n) for n in input().split()]

max = h[0]
ans = 0

for i in h:
    if max<=i:
        ans += 1
        max = i
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(n) for n in input().split()]

a = 0
b = 1
ans = 1
while h[a]<h[b]:
    ans = ans + 1
    a = a + 1
    b = b + 1
    continue

print(ans)

Fixed submission:
n = int(input())
h = [int(n) for n in input().split()]

max = h[0]
ans = 0

for i in h:
    if max<=i:
        ans += 1
        max = i
print(ans)
Buggy python submission (verdict: Runtime Error):
src = [int(input()) for _ in range(6)]
t = min(src[1:])
    if src[0]%t:
        print(4 + src[0]//t + 1)
    else:
        print(4 + src[0]//t)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
src = [int(input()) for _ in range(6)]
t = min(src[1:])
	if src[0]%t:
		print(4 + src[0]//t + 1)
	else:
		print(4 + src[0]//t)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

min = min(A, B, C, D, E)

ans = 4 + int(N/min)
    if N % min != 0:
        ans = ans + 1
print(ans)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())

lst = []
pos = [0,0,0,0,0]

for i in range(5):
    lst.append(i)

pos[0] = num
while (pos[0] + pos[1] + pos[2] + pos[3]) != 0:
    if pos[0] != 0:
        if pos[0] >= lst[0]:
            pos[1] += lst[0]
        else:
            pos[1] += pos[0]
    
    if pos[1] != 0:
        if pos[1] >= lst[1]:
            pos[2] += lst[1]
        else:
            pos[2] += pos[1]
    
    if pos[2] != 0:
        if pos[2] >= lst[2]:
            pos[3] += lst[2]
        else:
            pos[3] += pos[2]

    if pos[3] != 0:
        if pos[3] >= lst[3]:
            pos[4] += lst[3]
        else:
            pos[4] += pos[3]
    
print(pos,lst)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
min = min(A, B, C, D, E)
 
ans = 4 + int(N/min)
if N % min != 0:
    ans = ans + 1
print(ans)

Fixed submission:
H, W = map(int,input().split())
h, w = map(int,input().split())

val = H * (W - w)
dis = h*(W-w)
val = val - dis
print(val)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().splid())

hect = a*b*0.5
print(hect)

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

hect = int(a*b*0.5)
print(hect)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(float,input().split())

num = 0
pre = 100000
for i in range(N):
    x = float(input())
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(num)

Fixed submission:
N = int(input())
T,A = map(float,input().split())
H = list(map(int,input().split()))

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(float,input().split())

num = 0
pre = A
for i in range(N):
    x = float(input())
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(num)

Fixed submission:
N = int(input())
T,A = map(float,input().split())
H = list(map(int,input().split()))

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(float,input().split())

num = 0
pre = A
for i in range(N):
    x = float(input())
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(i)

Fixed submission:
N = int(input())
T,A = map(float,input().split())
H = list(map(int,input().split()))

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
T,A = map(float,input().split())

num = 0
pre = A
for i in range(N):
    x = float(input())
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(i)

Fixed submission:
N = int(input())
T,A = map(float,input().split())
H = list(map(int,input().split()))

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)

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

num = 0
pre = A
for i in range(N):
    x = input()
    ave = T - x*0.006
    if abs(A-ave)<pre:
        pre = abs(A-ave)
        num = i
print(i)

Fixed submission:
N = int(input())
T,A = map(float,input().split())
H = list(map(int,input().split()))

dis = []
for i in range(N):
    dis.append(abs(A-(T-H[i]*0.006)))
print(dis.index(min(dis))+1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
book=[]
for i in range(N):
    s,p =input().split()
    book.append((s,int(p),i))
    
s=sorted(book, key=lambda x: ( x[0],-x[1]))
for i in range(N):
    print(s[i][2]+1)


Fixed submission:
A,P = map(int, input().split())
print((3*A+P)//2)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i + j + k == s:
                count += 1
print(count)


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

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()[::-1]
words = [w[::-1] for w in ['dream', 'dreamer', 'erase', 'eraser']]

can = 'YES'
while s:
    print(s)
    match_any = False
    for w in words:
        if s.startswith(w):
            s = s.replace(w, '', 1)
            match_any = True
            break
    if not match_any:
        can = 'NO'
        break
print(can)


Fixed submission:
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
import numpy as np
import matplotlib.pyplot as plt

def main():
	a = int(input())
	p = int(input())

	tips = a * 3 + p
	pie = int(tips / 2)

	print(pie)

if __name__ == '__main__':
	main()

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

tips = a * 3 + p
pie = tips // 2

print(pie)

Buggy python submission (verdict: Runtime Error):
import numpy as np
import matplotlib.pyplot as plt

def main():
	print('Input A')
	a = int(input())
	print('Input P')
	p = int(input())

	tips = a * 3 + p
	pie = int(tips / 2)

	print("output\n"+str(pie))


if __name__ == '__main__':
	main()

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

tips = a * 3 + p
pie = tips // 2

print(pie)
Buggy python submission (verdict: Runtime Error):
N = int(input())
lst = []
for i in range(N):
  city, score = map(int, input().split())
  lst.append((city, score, i+1))

lst.sort(key=lambda x: x[1], reverse=True)
lst.sort(key=lambda x: x[0])
for tup in lst:
  c, s, i = tup
  print(i)

Fixed submission:
from sys import stdin

N = int(input())
lst = []
for i in range(N):
    city, score = stdin.readline().split()
    lst.append((city, int(score), i + 1))

lst.sort(key=lambda x: x[1], reverse=True)
lst.sort(key=lambda x: x[0])
for tup in lst:
    c, s, i = tup
    print(i)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

N, M = map(int, stdin.readline().split())
A = list(map(int, stdin.readline().split()))
for _ in range(M):
    B, C = map(int, stdin.readline().split())
    A.extend([C]*B)
A.sort(reverse=True)
ans = 0
for i in range(N):
    ans += A[i]

print(ans)


Fixed submission:
from sys import stdin

A, B = map(int, stdin.readline().split())
if A >= 13:
  print(B)
elif 12 >- A and A >= 6:
  print(B // 2)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
from sys import stdin

A, B = map(int, stdin.readline().split())
if A >= 13:
  print(B):
elif 12 >= A >= 6:
  print(B // 2)
else:
  print(0)

Fixed submission:
from sys import stdin

A, B = map(int, stdin.readline().split())
if A >= 13:
  print(B)
elif 12 >- A and A >= 6:
  print(B // 2)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

N, G = map(int, stdin.readline().split())
dic = {key: 0 for key in range(1, N + 1)}
left, right = N+1, -1
this, next = set(), set()
for i in range(G):
    if i == 0:
        l, r = map(int, stdin.readline().split())
        for j in range(l, r + 1):
            this.add(j)
    else:
        l, r = map(int, stdin.readline().split())
        for j in range(l, r + 1):
            if j in this:
                next.add(j)
        this = next
        next = set()

print(len(this))


Fixed submission:
from sys import stdin, exit

N, G = map(int, stdin.readline().split())
left, right = 1, N
for i in range(G):
    l, r = map(int, stdin.readline().split())
    if l > left:
        left = l
    if r < right:
        right = r
    if right < left:
        print(0)
        exit()

print(right - left + 1)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

n, q = map(int, stdin.readline().split())
s = stdin.readline().strip()
count = 0
for i in range(q):
    l, r = map(int, stdin.readline().split())
    for j in range(l - 1, r - 1):
        if s[j] + s[j + 1] == 'AC':
            count += 1

    print(count)
    count = 0


Fixed submission:
from sys import stdin

n, q = map(int, stdin.readline().split())
s = stdin.readline().strip()
counts = [0 for i in range(n)]
count = 0
for i in range(1, n):
    if s[i-1:i+1] == 'AC':
        count += 1
    counts[i] = count

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

Buggy python submission (verdict: Runtime Error):
from sys import stdin
n, q = stdin.readline().split()
s = stdin.readline().strip()
count = 0
for i in range(q):
  l, r = map(int, stdin.readline().split())
  for j in range(l-1, r-1):
    if s[j] + s[j+1] == 'AC':
      count += 1
      
  print(count)


Fixed submission:
from sys import stdin

n, q = map(int, stdin.readline().split())
s = stdin.readline().strip()
counts = [0 for i in range(n)]
count = 0
for i in range(1, n):
    if s[i-1:i+1] == 'AC':
        count += 1
    counts[i] = count

for i in range(q):
    l, r = map(int, stdin.readline().split())
    print(counts[r-1] - counts[l-1])
Buggy python submission (verdict: Runtime Error):
from sys import stdin

N, M, C = map(int, stdin.readline().split())
B = list(map(int, stdin.readline().split()))
ans = 0
for i in range(N):
  A = list(map(int, stdin.readline().split()))
  temp = 0
  for j in range(N):
    temp += A[j] * B[j]
  if temp + C > 0:
    ans += 1

print(ans)

Fixed submission:
from sys import stdin

N, M, C = map(int, stdin.readline().split())
B = list(map(int, stdin.readline().split()))
ans = 0
for i in range(N):
  A = list(map(int, stdin.readline().split()))
  temp = 0
  for j in range(M):
    temp += (A[j] * B[j])
  if temp + C > 0:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from queue import PriorityQueue

PREFEC, CITIES = list(map(int, stdin.readline().split()))
pref = {str(key): PriorityQueue() for key in range(1, PREFEC+1)}
city = dict()
out = [0] * CITIES
for i in range(CITIES):
    p, c = stdin.readline().split()
    pref[p].put(c)
    dic = p + '0' + c
    city[dic] = i

for j in range(1, PREFEC+1):
    i = str(j)
    pref_index = 1
    while not pref[i].empty():
        si = pref[i].get()
        temp = i + '0' + si
        index = city[temp]
        sy = str(pref_index)
        p = i

        while len(p) != 6:
            p = '0' + p
        while len(sy) != 6:
            sy = '0' + sy

        out[index] = p + sy

        pref_index += 1

for o in out:
    print(o)

Fixed submission:
from sys import stdin

x, y = list(map(int, stdin.readline().split()))
print(x + y//2)
Buggy python submission (verdict: Runtime Error):
n = input()

for i,v in enumerate(n):
  if v == '9':
    n[i] = '1'
  elif v == '1':
    n[i] = '9'
    
print(n)

Fixed submission:
n = input()

ans = ''
for i, v in enumerate(n):
    if v == '9':
        ans += '1'
    elif v == '1':
        ans += '9'
    else:
        ans += v

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = ((int(x) - 2) % 100 for x in input().split())
print('Draw' if a == b else 'Alice' a > b else 'Bob')

Fixed submission:
a, b = ((int(x) - 2) % 100 for x in input().split())
print('Draw' if a == b else 'Alice' if a > b else 'Bob')
Buggy python submission (verdict: Time Limit Exceeded):
F=lambda:tuple(int(X)for X in input().split());H,W,N=F();S={F()for _ in[0]*N};T=set();Z=[0]*10
for Y,X in S:
	for A in range(9):
		P=A,B=X-A%3,Y-A//3
		if(0<A<W-1)*(0<B<H-1)*(P not in T):T.add(P);Z[sum((B+C//3,A+C%3)in S for C in range(9))]+=1
Z[0]+=(H-2)*(W-2)-sum(Z);print(*Z,sep='\n')

Fixed submission:
F=lambda:tuple(int(X)for X in input().split());H,W,N=F();S={F()for _ in[0]*N};T=set();Z=[0]*10
for Y,X in S:
	for A in range(9):
		P=A,B=X-A%3,Y-A//3
		if(0<A<W-1)*(0<B<H-1)*(P not in T):T.add(P);Z[sum((B+C//3,A+C%3)in S for C in range(9))]+=1
Z[0]+=(H-2)*(W-2)-sum(Z);print(*Z,sep='\n')
Buggy python submission (verdict: Time Limit Exceeded):
F=lambda:tuple(int(X)for X in input().split());H,W,N=F();S={F()for _ in[0]*N};T=set();Z=[0]*10;*R,=range(9)
for Y,X in S:
	for A in R:
		P=A,B=X-A%3,Y-A//3
		if(0<A<W-1)*(0<B<H-1)*(P not in T):T.add(P);Z[sum((B+C//3,A+C%3)in S for C in R)]+=1
Z[0]+=(H-2)*(W-2)-sum(Z);print(*Z,sep='\n')

Fixed submission:
F=lambda:tuple(int(X)for X in input().split());H,W,N=F();S={F()for _ in[0]*N};T=set();Z=[0]*10;*R,=range(9)
for Y,X in S:
	for A in R:
		P=A,B=X-A%3,Y-A//3
		if(0<A<W-1)*(0<B<H-1)*(P not in T):T.add(P);Z[sum((B+C//3,A+C%3)in S for C in R)]+=1
Z[0]+=(H-2)*(W-2)-sum(Z);print(*Z,sep='\n')
Buggy python submission (verdict: Runtime Error):
M=10**9+7;F=[pow(X,M-2,M)for X in range(2*10**5)];H,W,A,B=map(int,input().split());Z=C=1
for I in range(H-1):Z=C=C*(W+H-B-2-I)*F[I+1]%M
for I in range(1,H-A):C=C*(B-1+I)*F[I]*(H-I)*F[W+H-B-1-I]%M;Z=(Z+C)%M
print(Z)

Fixed submission:
print('YES' if sorted(input().split()) == ['5', '5', '7'] else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
data = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
for i in range(M):
  id = list(range(data[i][0],data[i][1]+1))
  if i == 0:
      num = id
  else:
      num = set(num) & set(id)
print(len(num))

Fixed submission:
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
data = [[int(x) for x in stdin.readline().rstrip().split()] for _ in range(M)]
min_id =0
max_id = 100000
for i in range(M):
  min_id = max(min_id,data[i][0])
  max_id = min(max_id,data[i][1])
num = max_id - min_id + 1 if max_id - min_id >= 0 else 0
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
k, s = map(int,input().split())
count = 0
if k == s/3:
  print(1)
  exit()
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x + y + z == s:
        #print(x,y,z)
        count += 1
print(count)


Fixed submission:
# -*- coding: utf-8 -*-
k, s = map(int,input().split())
count = 0
if k == s/3:
  print(1)
  exit()
for x in range(k+1):
  for y in range(k+1):
    z = s - x -y
    if (z >= 0 and z <= k):
      #print(x,y,z)
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import datetime

x = input()

y = datetime.date(2019, 4, 30)
x_date = datetime.date(x.replace('/', ','))

if x_date <= y
    print('Heisei')
else
    print('TBD')


Fixed submission:
import datetime

x = input()
x_date = datetime.datetime.strptime(x, '%Y/%m/%d')

y = datetime.datetime(2019, 4, 30, 0, 0, 0)

if x_date <= y :
    print('Heisei')
else:
    print('TBD')
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, raw_input().split())
V = map(int, raw_input().split())

score = {}

def Compute(n, D, S):
    D2 = tuple(D)
    S2 = tuple(S)
    if (n, D2, S2) in score:
        return score[(n, D2, S2)]
    if n == 0:
        return sum(S)

    candidate = [Compute(n - 1, D, S)]
    if len(D) > 0:
        candidate.append(Compute(n - 1, D[1:], sorted(S + [D[0]])))
        candidate.append(Compute(n - 1, D[:-1], sorted(S + [D[-1]])))
    for i in range(len(S)):
        candidate.append(Compute(n - 1, D + [S[i]], S[:i] + S[i+1:]))
        candidate.append(Compute(n - 1, [S[i]] + D, S[:i] + S[i+1:]))
    return max(candidate)

print Compute(K, V, [])


Fixed submission:
import bisect

N, K = map(int, raw_input().split())
V = map(int, raw_input().split())

score = -1e100

M = min(N, K)
for A in range(0, M + 1):
    for B in range(0, M - A + 1):
        S = []
        if A > 0:
            S += V[:A]
        if B > 0:
            S += V[-B:]
        S.sort()
        score = max(score, sum(S) - sum(filter(lambda x: x < 0, S)[:max(0, K - A - B)]))

print score
Buggy python submission (verdict: Runtime Error):
a,p = input().split()
int(a)
int(p)
print((a*3+p)//2)

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
A = int(input())
P = int(input())
 
pi = round((A*3 + P)/2)
 
print(pi)

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
A = input()
P = input()

pi = round((A*3 + P)/2)

print(pi)


Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):

pi = round((A*3 + P)/2)




return pi

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):

pi = (A*3 + P)/2

return pi

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
import sys

A = sys.argv[1]
B = sys.argv[2]

if A <= 5:
  print(0)
elif A <= 12:
  print(int(B/2))
else:
  print(B)
  

Fixed submission:
import sys
inp = list(map(int,input().split()))
A, B = inp[0], inp[1]
if A <= 5:
  print(0)
elif A <= 12:
  print(int(B/2))
else:
  print(B)
Buggy python submission (verdict: Runtime Error):
A, P = input().split()
B = 3 * A + P
print(B/2)


Fixed submission:
A, P = input().split()
print(int((3*int(A)+int(P))/2))

Buggy python submission (verdict: Runtime Error):
A,P = input().split()
print((3*A+P)/2)


Fixed submission:
A, P = input().split()
print(int((3*int(A)+int(P))/2))

Buggy python submission (verdict: Runtime Error):
A, P = input().split()
print((3*A+P)/2)

Fixed submission:
A, P = input().split()
print(int((3*int(A)+int(P))/2))
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
# print(a)
# print(b)

if a > b:
    print(a + a - 1)
elif a < b:
    print(b + b - 1)
else:
    print(a + a)

Fixed submission:
A, B = map(int, input().split())
if A > B:
    print(A + A - 1)
elif B > A:
    print(B + B - 1)
else:
    print(A + A)
Buggy python submission (verdict: Runtime Error):
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter1 = 0
counter2 = 0
for i in range(1, M + 1):
    for ans in data:
        num = ans[0]
        #print(ans[1 : num + 1])
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        print(i)
        counter2 += 1
print(counter2)


Fixed submission:
N, M = map(int, input().split())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter2 = 0
for i in range(1, M + 1):
    counter1 = 0
    for ans in data:
        num = ans[0]
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        counter2 += 1
print(counter2)
Buggy python submission (verdict: Runtime Error):
def divide(n):
    counter = 0
    counter1 = 0
    if n % 2 != 0:
        for i in range(1, n+1, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    else:
        for i in range(1, n, 2):
            for j in range(1, i+1):
                if i % j == 0:
                    counter += 1
            if counter == 8:
                counter1 += 1
            counter = 0
    return counter1

                         
if __name__ == '__main__':
    n = int(input())
    print(divide(n))

Fixed submission:
a, b = map(int, input().split())
print((a - 1) * (b - 1))

Buggy python submission (verdict: Runtime Error):

def main():
    n = int(input())

    
    
    def divide(n):
        counter = 0
        counter1 = 0
        if n % 2 != 0:
            for i in range(1, n+1, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        else:
            for i in range(1, n, 2):
                for j in range(1, i+1):
                    if i % j == 0:
                        counter += 1
                if counter == 8:
                    counter1 += 1
                counter = 0
        return counter1

    print(divide(n))
                         
if __name__ == '__main__':
    main()

Fixed submission:
a, b = map(int, input().split())
print((a - 1) * (b - 1))
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

counter = 0
for h in range(K + 1):
    for i in range(K + 1):
        for j in range(K + 1):
            if h + i + j == S:
                counter += 1
print(counter)

Fixed submission:
K, S = map(int, input().split())
        
counter = 0
for h in range(K + 1):
    for i in range(K + 1):
        j = S - h - i
        if j <= K and j >= 0:
            counter += 1
print(counter)