Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03574 (python)

Fixed submission:
h,w=map(int,input().split())
masu=[]
up=1
down=1
left=1
right=1
for i in range(h):
    masu.append([i for i in input()])
for i in range(h):
    for j in range(w):
        bakudan=0
        if masu[i][j]==".":
            if i==0:up=0
            if i==h-1:down=0
            if j==0:left=0
            if j==w-1:right=0
            if up:
                if masu[i-1][j]=="#":bakudan+=1
            if up and left:
                if masu[i-1][j-1]=="#":bakudan+=1
            if up and right:
                if masu[i-1][j+1]=="#":bakudan+=1
            if left:
                if masu[i][j-1]=="#":bakudan+=1
            if left and down:
                if masu[i+1][j-1]=="#":bakudan+=1
            if down:
                if masu[i+1][j]=="#":bakudan+=1
            if down and right:
                if masu[i+1][j+1]=="#":bakudan+=1
            if right:
                if masu[i][j+1]=="#":bakudan+=1
            masu[i][j]=str(bakudan)
        up=1
        down=1
        left=1
        right=1

for i in masu:
    s=''.join(i)
    print(s)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
masu=[]
up=1
down=1
left=1
right=1
for i in range(h):
    masu.append([i for i in input()])
for i in range(h):
    for j in range(w):
        bakudan=0
        if masu[i][j]==".":
            if i==0:up=0
            elif i==h-1:down=0
            if j==0:left=0
            elif j==w-1:right=0
            if up:
                if masu[i-1][j]=="#":bakudan+=1
            if up and left:
                if masu[i-1][j-1]=="#":bakudan+=1
            if up and right:
                if masu[i-1][j+1]=="#":bakudan+=1
            if left:
                if masu[i][j-1]=="#":bakudan+=1
            if left and down:
                if masu[i+1][j-1]=="#":bakudan+=1
            if down:
                if masu[i+1][j]=="#":bakudan+=1
            if down and right:
                if masu[i+1][j+1]=="#":bakudan+=1
            if right:
                if masu[i][j+1]=="#":bakudan+=1
            masu[i][j]=str(bakudan)
        up=1
        down=1
        left=1
        right=1

for i in masu:
    s=''.join(i)
    print(s)
Problem p03729 (python)

Fixed submission:
a,b,c=input().split()
print("YES") if a[-1]==b[0] and b[-1]==c[0] else print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split
print("YES") if a[-1]==b[0] and b[-1]==c[0] else print("NO")
Problem p04019 (python)

Fixed submission:
s=input()
judge=True
if "W" in s:
    if "E" not in s: judge=False
if "E" in s:
    if "W" not in s: judge=False
if "S" in s:
    if "N" not in s: judge=False
if "N" in s:
    if "S" not in s: judge=False
print("Yes") if judge else print("No")

Buggy submission (verdict: Runtime Error):
s=input()
judge=True
if "W" in s:
    if "E" not in s: judge=False
if "E" in s:
    if "W" not in s: judge=False
if "S" in s:
    if "N" not in s: judge=False
if "N" in s:
    if "S" not in s: judge=False
print("Yes") if judge else prit("No")
Problem p03455 (python)

Fixed submission:
a,b=map(int, input().split())
x=a*b
if x%2==0:
    print("Even")
else :
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=int(input().split())
x=a*b
if x%2==0:
    print("Even")
else :
    print("Odd")
Problem p03043 (python)

Fixed submission:
import math
n, k = map(int, input().split())
r=0
if n < k:
    for i in range(1, n+1):
        r=r+(1/n)*0.5**math.ceil(math.log2(k/i))
    print(r)
else:
    r=1-(k/n)
    for i in range(1, k+1):
        r=r+(1/n)*0.5**math.ceil(math.log2(k/i))
    print(r)

Buggy submission (verdict: Runtime Error):
r=0
if n < k:
    for i in range(1, n+1):
        r=r+(1/n)*0.5**math.ceil(math.log2(k/i))
    print(r)
else:
    r=1-(k/n)
    for i in range(1, k+1):
        r=r+(1/n)*0.5**math.ceil(math.log2(k/i))
    print(r)
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
vc=[(v[i]-c[i]) for i in range(n) if (v[i]-c[i]) > 0]
print(sum(vc))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=map(int, input().split())
c=map(int, input().split())

vc=[v[i]-c[i] for i in range(n) if (v[i]-c[i]) > 0]
print(sum(vc))
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
ans = 0
t = 0
while t <= T - A:
    ans += B
    t += A
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(ans)
Problem p03060 (python)

Fixed submission:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
#print(N, V, C)
ans = 0
for i in range(N):
    if V[i] - C[i] > 0:
        ans += V[i] - C[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(max(ans))
Problem p03061 (python)

Fixed submission:
import fractions


N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]
for i in range(N):
    gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
    gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
ans_2 = max(ans)
print(ans_2)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

gcd_l = [0]
gcd_r = [0]

for i in range(N):
    gcd_l.append(math.gcd(gcd_l[i], A[i]))
    gcd_r.append(math.gcd(gcd_r[i], A[-(i+1)]))
gcd_r = gcd_r[::-1]

ans = []
for i in range(N):
    ans.append(math.gcd(gcd_l[i], gcd_r[i+1]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))
a_list = []
b_list = []
c_list = []

A.sort()
#print(math.gcd(6, 7))
if 4 <= N:
    a, b, c = math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2])
    for i in range(3, N):
        a_list.append(math.gcd(A[i], a))
        b_list.append(math.gcd(A[i], b))
        c_list.append(math.gcd(A[i], c))
    a_list.sort()
    b_list.sort()
    c_list.sort()
    ans = max(a_list[0], b_list[0], c_list[0])

elif N == 3:
    ans = max(math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2]))

elif N == 2:
    ans = max(A[0], A[1])
else:
    ans = 1000000000
    print(N)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = list(map(int, input().split()))

A.sort()
#print(math.gcd(6, 7))
if N >= 3:
    ans = max(math.gcd(A[0], A[1]), math.gcd(A[1], A[2]), math.gcd(A[0], A[2]))
elif N == 2:
    ans = max(A[0], A[1])
else:
    ans = 1000000000

print(ans)
Problem p03415 (python)

Fixed submission:
A = input()
B = input()
C = input()

print(A[0] + B[1] + C[2])

Buggy submission (verdict: Runtime Error):
edu
cat
ion
Problem p03463 (python)

Fixed submission:
N, A, B = [int(i) for i in input().split()]
print("Alice") if (A-B)%2 == 0 else print("Borys")

Buggy submission (verdict: Runtime Error):
K = int(input())
A = [int(i) for i in input().split()]

Max, Min = 0, 0
error = -1

def N_max(a, Max, Min):
    if Max > a and Min%a != 0:
        return a*(Min//a + 2) - 1
    elif Max > a and Min%a == 0:
        return a*(Min//a + 1) - 1
    else:
        return a*2 -1
        
def N_min(a, m):
    if m > a:
        return a*(m//a + 1)
    else:
        return a

for i in range(K)[::-1]:

    if A[-1] == 2:
        if i == 0:                      #最後の処理
            Max = N_max(A[i], Max, Min)
            Min = N_min(A[i], Min)
            print(Min, Max)
            break
        
        elif A[i-1]/A[i] < 2:          #次の値が2倍以下（最後以外）
            Max = N_max(A[i], Max, Min)
            Min = N_min(A[i], Min)

        else:
            print(error)
            break
 
    else:
        print(error)
        break
Problem p03469 (python)

Fixed submission:
S = input()

ans = "2018" + S[4:]
print(ans)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
a, b, c = -1, -1, -1

if Y >= 2000 * 10000:
    ZN = 1
    YN = 1
    XN = 2000
else:
    ZN = min(N, Y//1000)
    YN = min(N, Y//5000)
    XN = min(N, Y//10000)
    
for z in range(ZN + 1):
    for y in range(YN + 1):
        for x in range(XN + 1):
            if x + y + z == N and 1000*z + 5000*y + 10000*x == Y:
                a, b, c = x, y, z
                break

print(a, b, c)
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())

max_c = 0
ans_sw = A*100
ans_s = 0

water = set()
for a in range(0, F + 1, A * 100):
    for b in range(0, F - a + 1, B * 100):
        water.add(a + b)

suger = set()
for c in range(0, F + 1, C):
    for d in range(0, F - c + 1, D):
        suger.add(c + d)

for w in water:
    for s in suger:
        
        if s <= E * w // 100 and 0 < w + s <= F:
            c = s / (w + s)
            if max_c < c:
                max_c = c
                ans_sw = s + w
                ans_s = s

print(ans_sw, ans_s)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())

tmp_c = 0

for a in range(0, F+1, A*100):
    for b in range(0, F+1, B*100):
        for c in range(0, int(F/100 * E) + 1, C):
            for d in range(0, int(F/100 * E) + 1, D):
                w = a + b
                s = c + d
                if s == 0:
                    concentration = 0
                else:
                    concentration = s / (w + s)
                    
                if concentration <= E / (100 + E) and concentration > tmp_c and w + s <= F:
                    ans_sw = s+w
                    ans_s = s
                    tmp_c = concentration

print(ans_sw, ans_s)
Problem p03079 (python)

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

if a == b and c == a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split(" "))     # マス数、呪文回数
s = input()   # マス文字
g_list = []
for i in range(len(s)):
    g_list.append([s[i], 1])
s_list = {}
for i in range(len(s)):
    s_list.setdefault(s[i], []).append(i)
sum = len(s)

# 動かす
def move(d, str):
    i = g_list[str][1]
    g_list[str][1] = 0
    if d == "L":
        if str == 0:
            sum -= i
            return
        g_list[str-1][1] += i
    else:
        if str == N-1:
            sum -= i
            return
        g_list[str+1][1] += i
    # print(g_list)


for i in range(Q):
    t, d = list(input().split(" "))
    for str in s_list[t]:
        print(str)
        if g_list[str][0] == t:
            move(d, str)
        else:
            continue
Problem p03049 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]

start = 0
end = 0
same = 0
c = 0
for x in s:
    c = c + len(x.split('AB')) - 1
    if x.startswith('B'):
        start += 1
        if x.endswith('A'):
            same += 1
    if x.endswith('A'):
        end += 1

if start == end:
    c += start
    if same > 0 and same == start:
        c  -= 1
elif start > end:
    c += end
else:
    c += start
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]

start = 0
end = 0
flg = False
c = 0
for x in s:
    if 'AB' in x:
        c += 1
    if x.startswith('B'):
        start += 1
        if x.endswith('A'):
            flg = True
    if x.endswith('A'):
        end += 1
if start = end:
    c += start
    if flg:
        c  -= 1
else if start > end:
    c += end
else:
    c += start
print(c)
Problem p03079 (python)

Fixed submission:
print('Yes') if len(set(input().split(' '))) == 1 else print('No')

Buggy submission (verdict: Runtime Error):
i = int(input())
str = input()
r_count = 0

for color in str:
    if color == 'R':
        r_count+=1

if r_count * 2 > i:
    print('Yes')
else:
    print('No')
Problem p03085 (python)

Fixed submission:
n = input()
  
if n == 'A':
  print('T')
elif n == 'T':
  print('A')
elif n == 'G':
  print('C')
else:
  print('G')

Buggy submission (verdict: Runtime Error):
 n = input()
  
if n == 'A':
  print('T')
elif n == 'T':
  print('A')
elif n == 'G':
  print('C')
else:
  print('G')
Problem p03086 (python)

Fixed submission:
n = input()

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

Buggy submission (verdict: Runtime Error):
n = input()

ls = []
isnAGCT = False
cnt = 0
for i in range(len(n)):
  if n[i] == 'A' or n[i] == 'G' or n[i] == 'C' or n[i] == 'T':
    cnt += 1
    ls.append(cnt)
  else:
    cnt = 0
    
print(max(ls))
Problem p03136 (python)

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

l.sort(reverse = True)

if len(l) == n:
  lm = l[0]

  del l[0]

  if int(lm) < sum(l):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(input().split()))

l.sort(reverse = True)

if len(l) == n:
  lm = l[0]

  del l[0]

  if int(lm) < sum(l):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input().split())

l.sort(reverse = True)

if len(l) == n:
  lm = l[0]

  del l[0]

  if lm < sum(l):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(input().split())

l.sort(reverse = True)

if len(l) == n:
  lm = l[0]

  del l[0]

  if lm < sum(l):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(input().split()))

l.sort(reverse = True)

if len(l) == n:
  lm = l[0]

  del l[0]

  if lm < sum(l):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(input().split()))

l.sort(reverse = True)

lm = l[0]

del l[0]

if lm < sum(l):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
l = list(map(int, input().split()))

l.sort(reverse=true)

lm = l[0]
del l[0]

if lm < sum(l):
  print('Yes')
else:
  print('No')
Problem p03328 (python)

Fixed submission:
tower = [0]

for i in range(1, 1000):
    tower.append(tower[i-1]+i)

a, b = map(int, input().split())
t = tower[b - a]
print(t - b)

Buggy submission (verdict: Runtime Error):
tower = [0]

for i in range(1, 15):
    tower.append(tower[i-1]+i)
a, b = map(int, input().split())
t = tower[b - a]
print(t - b)
Problem p03377 (python)

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

if x >= a and x <= a+b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
sx = sorted(x)

min_mid = sx[int(n/2-1)]
max_mid = sx[int(n/2)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(str, input().split()))
sx = sorted(x)

max_mid = sx[int(n/2)]
min_mid = sx[int(n/2-1)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)
Problem p03379 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
sx = sorted(x)

min_mid = sx[int(n/2-1)]
max_mid = sx[int(n/2)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(str, input().split()))
sx = sorted(x)

max_mid = sx[int(n/2)+1]
min_mid = sx[int(n/2)]

for i in x:
    if i <= min_mid:    # 左半分から取られてる時
        print(max_mid)
    else:               # 右半分から取られてる時
        print(min_mid)
Problem p03456 (python)

Fixed submission:
import sys
a, b = map(str, input().split())
x = int(a+b)

for i in range(1001):
    if x == i*i:
        print("Yes")
        sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import sys
a, b = map(str, input().split())
x = int(a+b)

for i in range(1001):
    if x == i*i:
        print("Yes")
        sys.exit(1)
print("No")
Problem p03543 (python)

Fixed submission:
S = input()
if S[0]==S[1]==S[2]:
    print("Yes")
elif S[1]==S[2]==S[3]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S[1]==S[2]==S[3]:
    print("Yes")
elif S[2]==S[3]==S[4]:
    print("Yes")
else:
    print("No")
Problem p03059 (python)

Fixed submission:
A,B,T=map(int,input().split())
print(int(T/A)*B)

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

def GCD(L):
  while(len(L)>1):
    a=min(L)
    M=map(lambda x: x%a, L)
    L=[a]+list(filter(lambda x: x!=0, M))
  return a

cogcd=[ 0 for i in range(N)]

for i in range(N):
  cogcd[i]=GCD(A[:i]+A[i+1:])

print(max(cogcd))

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

def GCD(a,b):
  if(a<b): a,b=b,a
  while(b!=0):
    a,b=b,a%b
  return a

cogcd=[0 for i in range(N)]
allgcd=GCD(A[0],A[1])
cogcd[0]=A[1]
cogcd[1]=A[0]

for i in range(2,N):
  for j in range(i):
    cogcd[j]=GCD(cogcd[j],A[i])
  cogcd[i]=allgcd
  allgcd=GCD(allgcd,A[i])
print(max(cogcd))
Problem p03071 (python)

Fixed submission:
A,B=list(map(int,input().split()))
if A==B:
  print(2*A)
else:
  print(2*max(A,B)-1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
First=S[0]
Now=First
cnt=0
A=[0]
for s in S:
    if Now=='1' and s=='0':
        A+=[cnt]
        Now='0'
    elif Now=='0' and s=='1':
        A+=[cnt]
        Now='1'
    cnt+=1
A+=[N]
dp=2*K+1
ans=[]

if First=="0":
    p=1
    ans.append(A[min(dp-1,len(A)-1)])
else:
    p=0
    ans.append(A[min(dp,len(A)-1)])

while p+dp<len(A):
	ans.append(A[p+dp]-A[p])
	p+=2

print(A)
print(max(ans))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
First=S[0]
Last=S[N-1]

Now=First
cnt=0
A=[0,0]
for s in S:
    if Now=='1' and s=='0':
        A+=[cnt]
        Now='0'
    elif Now=='0' and s=='1':
        A+=[cnt]
        Now='1'
    cnt+=1
A+=[cnt,cnt]

ans=0
dp=2*K+1
if First=="0":
    p=0
else:
    p=1
while p+dp<len(A):
   if A[p+dp]-A[p]>ans:ans=A[p+dp]-A[p]
   p+=2
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
S=input()
First=S[0]
Last=S[N-1]

Now=First
cnt=0
A=[0,0]
for s in S:
    if Now=='1' and s=='0':
        A+=[cnt]
        Now='0'
    elif Now=='0' and s=='1':
        A+=[cnt]
        Now='1'
    cnt+=1
A+=[cnt,cnt]

ans=0
dp=2*K+1
if First=="0":
    p=0
else:
    p=1
while p+dp<len(A):
   if A[p+dp]-A[p]>ans:ans=A[p+dp]-A[p]
   p+=2
print(ans)
Problem p03390 (python)

Fixed submission:
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	if x==0:
		print(0)
		continue
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

Buggy submission (verdict: Runtime Error):
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab))-1,AB[1]+2):
		if i*i>=ab:
			x=i-1
			break
	for i in range(int(ab/x)-1,ab+2):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

Buggy submission (verdict: Runtime Error):
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

Buggy submission (verdict: Runtime Error):
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

Buggy submission (verdict: Runtime Error):
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(AB[0],AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	for i in range(x,ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)
Problem p03059 (python)

Fixed submission:
A,B,T = map(int,input().split())
H = (T + 0.5) // A
F = B * H // B * H
print(round(B * H))

Buggy submission (verdict: Runtime Error):
A,B,T = map(int,input().split())
H = (T + ) // A
print(B * H)
Problem p03071 (python)

Fixed submission:
A,B = map(int,input().rstrip().split())

X = max(A,B)
if A == B:
    G = X * 2
else:
    Y = max(A,B) - 1
    G = X + Y
print(G)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().rstrip().split())
if A == B:
    print(A*A)
else:
    print(max(A,B) * (max(A,B) - 1)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().rstrip().split())
if A == B:
    print(A*A)
else:
    print(max(A,B) + (max(A,B) - 1)
Problem p03101 (python)

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

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().rsplit().split())
h,w = map(int,input().rsplit().split())
print(H * W - h * w)
Problem p03145 (python)

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

print(a * b // 2)

Buggy submission (verdict: Runtime Error):
s = int(input())
x = 1
if s == 1 or s == 2:
    print(4)
else:
    while not s == 4:
        if s % 2 != 0:
            s = 3 * s + 1
            x = x + 1
               
        else:
            s = s // 2
            x = x + 1
        
        
print(x + 3)
Problem p03210 (python)

Fixed submission:
X = int(input())
if X == 3 or X == 5 or X ==7:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
X = int(input())
if X == 3,5,7:
  print('YES')
else:
  print('NO')