Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
xx, y = map(str, input().split())
if int(x, 16) < int(y, 16):
    print('<')
elif int(x, 16) == int(y, 16):
    print('=')
else:
    print('>')

Fixed submission:
x, y = map(str, input().split())
if int(x, 16) < int(y, 16):
    print('<')
elif int(x, 16) == int(y, 16):
    print('=')
else:
    print('>')
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_right

N = int(input())
A = [int(i) for i in input().split()]
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])

ans = 0

for i in A:
    tyu = bisect_right(B, i)
    for j in range(tyu, N):
        ge = bisect_right(C, B[j])
        ans += N-ge
        
print(ans)

Fixed submission:
N = int(input())
A = sorted(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(map(int, input().split()))
import bisect
ans = 0

for i in B:
    iA = bisect.bisect_left(A, i)
    iB = bisect.bisect_right(C, i)
    ans += (iA)*(N-iB)
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
s = 'T'
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
    
    else:
        s = S[:i]+T+S[i+len(T):]
        s = s.replace('?', 'a')
        print(s)
        break
if s ='T':
    print('UNRESTORABLE')

Fixed submission:
S = input()
T = input()
s = 'T'
for i in range(len(S)-len(T)+1):
    for j in range(len(T)):
        if S[i+j] != T[j] and S[i+j] != '?':
            break
    
    else:
            s = S[:i]+T+S[i+len(T):]
            s = s.replace('?', 'a')
if s == 'T':
    print('UNRESTORABLE')
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
def solve():
    H, W = map(int, input().split())
    a = [list("."+input()+".") for _ in [0]*H]
    a.insert(0, list("."*(W+2)))
    a.append(list("."*(W+2)))
    result = []
 
    for y in range(1, H+1):
        for x in range(1, W+1):
            if a[y][x] == "#":
                result.append("#")
            else:
                result.append(str((a[y-1][x-1:x+2]+a[y][x-1:x+2]+a[y+1][x-1:x+2]).count("#")))
        result.append("\n")
 
    print("".join(result))
 
 
if __name__ == "__main__":
    solve()

Fixed submission:
a, b, c = map(int, input().split())
if a == b:
    print(c)
elif a==c:
    print(b)
else:
    print(a)
Buggy python submission (verdict: Runtime Error):
import numpy as np
ans = []
H, W = map(int, input().split())
S = []
S.append('.'*(W+2))
for i in range(H):
    S.append('.'+input() + '.')
S.append('.'*(W+2))

for y in range(1, H+1):
    for x in range(1, W+1):
        if S[y][x] == '.':
            cnt = S[y][x-1].count('#')+S[y][x+1].count('#')+S[y-1][x-1:x+2].count('#')+S[y+1][x-1:x+2].count('#')
            ans.append(cnt)
        else:
            ans.append('#')
np_ans = np.array(ans)
re_ans = np.reshape(np_ans, (H, W))
for i in re_ans:
    print(''.join(i))

Fixed submission:
def solve():
    H, W = map(int, input().split())
    a = [list("."+input()+".") for _ in [0]*H]
    a.insert(0, list("."*(W+2)))
    a.append(list("."*(W+2)))
    result = []
 
    for y in range(1, H+1):
        for x in range(1, W+1):
            if a[y][x] == "#":
                result.append("#")
            else:
                result.append(str((a[y-1][x-1:x+2]+a[y][x-1:x+2]+a[y+1][x-1:x+2]).count("#")))
        result.append("\n")
 
    print("".join(result))
 
 
if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
def DFS(N, copyedge):
    matrix = [[] for i in range(M)]
    for a, b in copyedge:
        matrix[a].append(b)
        matrix[b].append(a)
        
    check = [True]*N
    check[0] = False
    Que = [0]

    while len(Que) != 0:
        now = Que.pop()
        for i in matrix[now]:
            if check[i] == True:
                check[i] = False
                Que.append(i)
    if True not in check:
        return 0
    else:
        return 1
            
        

ans = 0
N, M = map(int, input().split())
edge = []

for i in range(M):
    edge.append([int(i) - 1 for i in input().split()])
    
for i in range(M):
    copyedge = edge[:i] + edge[i+1:] 
    ans += DFS(N, copyedge)
print(ans)

Fixed submission:
def DFS(N, copyedge):
    matrix = [[] for i in range(N)]
    for a, b in copyedge:
        matrix[a] += [b]
        matrix[b] += [a]
    check = [True]*N
    check[0] = False
    Que = [0]
    
    while len(Que) != 0:
        now = Que.pop()
        for j in matrix[now]:
            if check[j] == True:
                check[j] = False
                Que.append(j)
    if check == [False]*N:
        return 0
    else:
        return 1       

ans = 0
N, M = map(int, input().split())
edge = []

for i in range(M):
    edge.append([int(i)-1 for i in input().split()])

for i in range(M):
    copyedge = edge[:i]+edge[i+1:]
    ans += DFS(N, copyedge)
print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
A = collections.Counter(list(map(int, input().split())))
seihou = []
tyouhou = []
ans = 0

for i in A.keys():
    if A[i] >= 2:
        tyouhou.append(i)
    if A[i] >= 4:
        seihou.append(i)

if len(seihou) >= 1:
    ans = max(seihou)**2

if len(tyouhou) >= 2:
    c = max(tyouhou)
    tyouhou.remove(c)
    ans = max(ans, c*max(tyouhou))
print(ans)

Fixed submission:
def DFS(N, copyedge):
    matrix = [[] for i in range(N)]
    for a, b in copyedge:
        matrix[a] += [b]
        matrix[b] += [a]
    check = [True]*N
    check[0] = False
    Que = [0]
    
    while len(Que) != 0:
        now = Que.pop()
        for j in matrix[now]:
            if check[j] == True:
                check[j] = False
                Que.append(j)
    if check == [False]*N:
        return 0
    else:
        return 1       

ans = 0
N, M = map(int, input().split())
edge = []

for i in range(M):
    edge.append([int(i)-1 for i in input().split()])

for i in range(M):
    copyedge = edge[:i]+edge[i+1:]
    ans += DFS(N, copyedge)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
check = [0] * (10**5+1)
check[0] = A.count(0)+A.count(1)

for i in range(1, 10**5+1):
    
    check[i] = check[i-1] - A.count(i-2) + A.count(i+1)
print(max(check))

Fixed submission:
import collections
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 1

AA = collections.Counter(A)
cc = [0]*(max(A)+1)

for i in AA.keys():
    cc[i] = AA[i]

for i in range(len(cc)):
    ans =  max(ans, sum(cc[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
check = []
check.append(A.count(min(A))+A.count(min(A)+1))

for i in range(min(A)+1, max(A)+1):
    check.append(check[-1]-A.count(i-2)+A.count(i+1))
print(max(check))

Fixed submission:
import collections
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 1

AA = collections.Counter(A)
cc = [0]*(max(A)+1)

for i in AA.keys():
    cc[i] = AA[i]

for i in range(len(cc)):
    ans =  max(ans, sum(cc[i:i+3]))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]
ans = 0
for i in set(A):
    ans = max(ans, A.count(i)+A.count(i-1)+A.count(i+1))
print(ans)

Fixed submission:
import collections
N = int(input())
A = sorted(list(map(int, input().split())))
ans = 1

AA = collections.Counter(A)
cc = [0]*(max(A)+1)

for i in AA.keys():
    cc[i] = AA[i]

for i in range(len(cc)):
    ans =  max(ans, sum(cc[i:i+3]))

print(ans)
Buggy python submission (verdict: Runtime Error):
S = sorted(list(set(list(input()))))
test = sorted('abcdefghijklmnopqrstuvwxyz')
for num in range(len(S)):
    if num == 26:
        ans ='None'
        break
    if S[num] != test[num]:
        ans = num
        break
print('None' if ans=='None' else test[num] )

Fixed submission:
S = sorted(list(set(list(input()))))
test = sorted('abcdefghijklmnopqrstuvwxyz')
ans = -1
if S == test:
    print('None')

elif S[-1] == test[len(S)-1]:
    print(test[len(S)])

else:
    for num in range(len(S)):
        if test[num] != S[num]:
            print(test[num])
            break

Buggy python submission (verdict: Runtime Error):
S = sorted(input())
test = sorted('abcdefghijklmnopqrstuvwxyz')
for num in range(len(S)):
    if num == 26:
        ans ='None'
        break
    if S[num] != test[num]:
        ans = num
        break
print('None' if ans=='None' else test[num] )

Fixed submission:
S = sorted(list(set(list(input()))))
test = sorted('abcdefghijklmnopqrstuvwxyz')
ans = -1
if S == test:
    print('None')

elif S[-1] == test[len(S)-1]:
    print(test[len(S)])

else:
    for num in range(len(S)):
        if test[num] != S[num]:
            print(test[num])
            break

Buggy python submission (verdict: Runtime Error):
S = sorted(input())
test = sorted('abcdefghijklmnopqrstuvwxyz')
for num in range(len(S)):
    if S[num] != test[num]:
        ans = num
        break
print('None' if ans=='None' else test[num] )

Fixed submission:
S = sorted(list(set(list(input()))))
test = sorted('abcdefghijklmnopqrstuvwxyz')
ans = -1
if S == test:
    print('None')

elif S[-1] == test[len(S)-1]:
    print(test[len(S)])

else:
    for num in range(len(S)):
        if test[num] != S[num]:
            print(test[num])
            break
Buggy python submission (verdict: Runtime Error):
 = int(input())
T = sorted([int(input()) for i in range(N)])

def gcd(a, b):
    while b != 0:
        a, b = b,a%b
    return a

if N == 1:
    print(T[0])
else:
    ans = T[0]
    for i in range(1, N):
        ans = (ans*T[i])//(gcd(ans, T[i]))
    
    print(ans)

Fixed submission:
import fractions
N = int(input())
T = [int(input()) for i in range(N)]
ans = T[0]

for i in range(1, N):
    ans = (ans * T[i]) // (fractions.gcd(ans, T[i]))
    
print(ans)
#https://mathtrain.jp/abequalgl
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i input().split()]

ki = 0
gu_2 = 0
gu_4 = 0

for i in a:
    if i % 4 == 0:
        gu_4 += 1
    elif i % 2 == 0:
        gu_2 += 1
    else:
        ki += 1

if ki <= gu_4:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())
T = list(map(int, input().split()))
ans = 0

for i in range(N):
    if T[i] % 4 == 0:
        ans += 1
    elif T[i] % 2 != 0:
        ans -= 1
    
if N % 2 != 0:
    ans += 1

print('Yes' if ans >= 0 else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]
ans = 0
tyukan = []
saigo = []
 
for i in range(M):
    if ab[i][0] == 1:
        tyukan.append(ab[i][1])
 
for i in range(M):
    if ab[i][0] in tyukan:
        if ab[i][1] == N:
            ans =1
            break
 
print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE') 

Fixed submission:
N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if len(set(mid) & set(las)) != 0:
    ans =1

print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if set(mid) & set(las) != 0:
    ans = 1　

print('POSSIBLE' if ans == 1 else 'INPOSSIBLE') 

Fixed submission:
N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if len(set(mid) & set(las)) != 0:
    ans =1

print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(MM)]
ans = 0
tyukan = []
saigo = []

for i in range(M):
    if ab[i][0] == 1:
        tyukan.append(ab[i][1])

for i in ab:
    if ab[i][0] in tyukan:
        if ab[i][1] == N:
            ans =1
            break

print('POSSIBLE' if ans == 1 else 'INPOSSIBLE')

Fixed submission:
N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if len(set(mid) & set(las)) != 0:
    ans =1

print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
sunu = sum(a)
arai = 0
ans = 2*10**9
for i in range(n-1):
  sunu -= a[i]
  arai +=  a[i]
  ans = min(ans,abs(sunu-arai))
  
print(ans)
  
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sunu = sum(a)
arai = 0
ans = 2*10**9
for i in range(n-1):
  sunu -= a[i]
  arai +=  a[i]
  ans = min(ans,abs(sunu-arai))
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans  =2*10**9
for i in range(1, N):
    ans = min(ans, abs(sum(a[:i])-sum(a[i:])))
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
sunu = sum(a)
arai = 0
ans = 2*10**9
for i in range(n-1):
  sunu -= a[i]
  arai +=  a[i]
  ans = min(ans,abs(sunu-arai))
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ans = 0
nn = 1
mm = 1
for i in range(1, N+1):
    nn *= i
for i in range(1, M+1):
    mm *= i

if N == M:
    ans = ((2*nn*mm)%(10**9+7))

elif abs(N-M) ==1:
    ans = ((nn*mm)%(10**9+7))

print(ans)

Fixed submission:
N, M = map(int, input().split())
ans = 0
nn = 1
mm = 1
for i in range(1, N+1):
    nn = (nn*i)%(10**9+7)
for i in range(1, M+1):
    mm = (mm*i)%(10**9+7)

if N == M:
    ans = ((2*nn*mm)%(10**9+7))

elif abs(N-M) ==1:
    ans = ((nn*mm)%(10**9+7))

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i range(n)]
summ = sum(s)
ans = [0]*summ
for i in range(n):
  ans[i] -= s[i]
ans.sort(reverse = True)
for i in ans:
  if i % 10 != 0:
    print(i)
    break
else:
  print(0)

Fixed submission:
N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i range(n)]
summ = sum(s)
ans = [0]*summ
for i in range(n):
  ans[i] -= a[i]
ans.sort(reverse = True)
for i in ans:
  if i % 10 != 0:
    print(i)
    break

Fixed submission:
N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for i range(n)]
summ = sum(s)
ans = [0]*summ
for i in range(n):
  ans[i] -= 

Fixed submission:
N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)

Buggy python submission (verdict: Runtime Error):
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)
 
if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        ans = sum(s)-s_shadow[0]
        for i in s_shadow:
            ans = max(ans, anss-i)
            
print(ans)

Fixed submission:
N = int(input())
s = [int(input()) for i in range(N)]
s_shadow = [i for i in s if i % 10 != 0]
ans = sum(s)

if ans % 10 == 0:
    if len(s_shadow) == 0:
        ans = 0
    
    else:
        s_can = sorted([ans-i for i in s_shadow])
        ans = s_can[-1]
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = []
for i in range(M):
    ab += list(map(int, input().split()))

for i in range(1, N+1):
    print(ab.count(i))

Fixed submission:
a, b, c = map(int, input().split())
if a <= c <= b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
check = 0
ans = []
for i in range(n):
    a, b = map(int, input().split())
    check += b
    ans.append(str(a)*b)
    if check >= k:
        ans = "".join(ans)
        print(ans[k-1])
        break 

Fixed submission:
N, K = map(int, input().split())
ans = 0
memory = [0]*(10**5+1)

for i in range(N):
    a, b = map(int, input().split())
    memory[a] += b

for i in range(10**5+1):
    ans += memory[i]
    if ans >= K:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
check = 0
ans = []
for i in range(n):
  a, b = map(int, input().split())
  check += b
  ans.append(str(a)*b)
  if check <= k:
    ans = "".join(ans)
    print(ans[k-1])
    break 


Fixed submission:
N, K = map(int, input().split())
ans = 0
memory = [0]*(10**5+1)

for i in range(N):
    a, b = map(int, input().split())
    memory[a] += b

for i in range(10**5+1):
    ans += memory[i]
    if ans >= K:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
hikaku = 0
for i in range(N):
    hikaku += ab[i][1]
    if K <= ans:
        print(ab[i][0])
        break

Fixed submission:
N, K = map(int, input().split())
ans = 0
memory = [0]*(10**5+1)

for i in range(N):
    a, b = map(int, input().split())
    memory[a] += b

for i in range(10**5+1):
    ans += memory[i]
    if ans >= K:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
O, E = map(int, input().split())
ans = ''
if len(O) == len(E):
    for i in range(len(O)):
        ans += O[i]
        ans += E[i]
else:
    for i in range(len(E)):
        ans += O[i]
        ans += E[i]
    ans += O[-1]
print(ans)

Fixed submission:
O = list(input())
E = list(input())
llist = list(range(1, len(E)*2, 2))
for num in range(len(E)):
    O.insert(llist[num], E[num])

print(''.join(O))

Buggy python submission (verdict: Runtime Error):
O = list(input())
E = list(input())
llist = list(range(1, len(E)+3, 2))
for i in range(len(E)):
    O.insert(llist[i],E[i] )
print(''.join(O))

Fixed submission:
O = list(input())
E = list(input())
llist = list(range(1, len(E)*2, 2))
for num in range(len(E)):
    O.insert(llist[num], E[num])

print(''.join(O))
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = [input() for i in range(n)]
check = set(S[i])
ans = []

for c in check:
    num = float('inf')
    for s in S:
        num = min(num, s.count(c))
        
    ans.append(num*c)
print(''.join(sorted(''.join(ans))))

Fixed submission:
moji_list =sorted(list('abcdefghijklmnopqrstuvwxyz'))

n = int(input())
S = [0]*n
for  i in range(n):
    S[i] = input()
    
moji_con = [0] * len(moji_list)

for i in range(len(moji_list)):
    MM = []
    moji = moji_list[i]
    
    for word in S:
        MM.append(word.count(moji))
    
    moji_con[i] = min(MM)
    
ans = ''
for i in range(len(moji_con)):
    if moji_con[i] != 0:
        ans += moji_con[i]*moji_list[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M =map(int, input().split())
a, b = [0]*N, [0]*N
c, d = [0]*N, [0]*N
ans = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(M):
    c[i], d[i] = map(int, input().split())
    

for i in range(N):
    length = 10**9
    ind = 0
    for j in range(M):
        man =  abs(a[i] - c[j])+abs(b[i] - d[j])
        if length > man:
            length = man
            ind = j+1
    ans.append(ind)

for i in ans:
    print(i)

Fixed submission:
N, M =map(int, input().split())
a, b = [0]*N, [0]*N
c, d = [0]*M, [0]*M
ans = []
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(M):
    c[i], d[i] = map(int, input().split())
    

for i in range(N):
    length = 10**9
    ind = 0
    for j in range(M):
        man =  abs(a[i] - c[j])+abs(b[i] - d[j])
        if length > man:
            length = man
            ind = j+1
    ans.append(ind)

for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
X = int(input())
for i in range(1, 10**6):
    if X <= 0.5 * i (i + 1):
        print(i)
        break

Fixed submission:
X = int(input())
t = 1
max_t = (t* (t+1)) // 2

# t=1で1 t=2で 2,3 t= 3で 4, 5, 6  t=4で 7,8,9,10  t=5で 11,12,13,14,15までいける

while max_t < X:
    
    t += 1 
    max_t = (t* (t+1)) // 2
    
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1
for num in range(1, N+1):
    power = power*num

print(power%(10**9+7))

Fixed submission:
N = int(input())
power = 1

for i in range(1, N+1):
    power = (power*i)%(10**9+7)
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
S, C = map(int,input().split())
ans = 0

flag = True
while flag:
  if S >= 1 and C >= 2:
    S -= 1
    C -= 2
  elif C >= 4:
    C -= 4
  else:
    break
  ans += 1
print(ans)

Fixed submission:
N, M = map(int, input().split())
ans = 0

if M <= 1:
    ans = 0

elif N >= M:
    ans = M//2

elif N < M:
    if N*2 >= M:
        ans = M//2
    else:
        ans += N
        ans += (M-N*2)//4
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
ans = 0
while N>=1 and M>=2 or M>=4:
    if N >=1 and M >= 2:
        N -= 1
        M -= 2
        ans += 1
    elif M >=4:
        M -= 4
        ans += 1
print(ans)

Fixed submission:
N, M = map(int, input().split())
ans = 0

if M <= 1:
    ans = 0

elif N >= M:
    ans = M//2

elif N < M:
    if N*2 >= M:
        ans = M//2
    else:
        ans += N
        ans += (M-N*2)//4
print(ans)
Buggy python submission (verdict: Runtime Error):
k,s=map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
        if s>=i+j and s-(i+j)<=k:
            c+=1
print(c)

Fixed submission:
print(input().replace(',',' '))
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0
for a in range(K+1):
    for b in range(K+1):
        for c in range(K+1):
            if a + b + c == S:
                ans += 1
print(ans)

Fixed submission:
k,s=map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
        if s>=i+j and s-(i+j)<=k:
            c+=1
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0

for x in range(K+1):
    for y in range(x+1):
        for z in range(y+1):
            if x+y+z == S:
                
                if x==y==z:
                    ans += 1
                elif x==y or y==z or x==z:
                    ans += 3
                else:
                    ans += 6
print(ans)

Fixed submission:
k,s=map(int,input().split())
c=0
for i in range(k+1):
    for j in range(k+1):
        if s>=i+j and s-(i+j)<=k:
            c+=1
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if N % 2 == 0:
    
    for i in list(range(1, N, 2)):
        if A.count(i) != 2:
            ans = 0
            break
            
else:
    if A.count(0) == 1:
        for i in list(range(2, N, 2)):
            if A.count(i) != 2:
                ans = 0
                break
    else:
        ans = 0

if ans == 0:
    print(0)
else:
    print((2**(N//2))%(10**9+7))

Fixed submission:
sx,sy,tx,ty=map(int,input().split())
dx=tx-sx
dy=ty-sy
 
a="U"*dy+"R"*dx
b="D"*dy+"L"*dx
c="L"+"U"*(dy+1)+"R"*(dx+1)+"D"
d="R"+"D"*(dy+1)+"L"*(dx+1)+"U"
print(a+b+c+d)