Problem:


Score : 300 points

Problem Statement

Snuke loves puzzles.

Today, he is working on a puzzle using S- and c-shaped pieces.
In this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:

Snuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.

Find the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.

Constraints

1 ≤ N,M ≤ 10^{12}

Input

The input is given from Standard Input in the following format:

N M

Output

Print the answer.

Sample Input 1

1 6

Sample Output 1

2

Two Scc groups can be created as follows:

Combine two c-shaped pieces into one S-shaped piece

Create two Scc groups, each from one S-shaped piece and two c-shaped pieces

Sample Input 2

12345 678901

Sample Output 2

175897



Sample input:
1 6


Sample output:
2

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = 0
if N >= 2*M: ans = M
else:
    ans += N
    M -= 2*N
    ans += M //4

print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = 0
if N >= 2*M: ans = N
else:
    ans += N
    M -= 2*N
    ans += M //4

print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = 0
if N >= 2*M: ans = N
else:
    k = (M - 2*N) // 4
    ans = N + k

print(ans)

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
if a[0]*2 == a[1]:
    print(str(a[0]))
elif a[0]*2 < a[1]:
    a[1]-=a[0]*2
    print(str(a[0]+int(a[1]/4)))
else:
    a[0]-=int(a[1]/2)
    print(str(int(a[1]/2)+int(a[0]/2)))

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
if a[0] == 2*a[1]:
    print(str(a[0]))
elif a[0] < 2*a[1]:
    a[1]-=a[0]*2
    print(str(a[0]+int(a[1]/4)))
else:
    a[0]-=int(a[1]/2)
    print(str(int(a[1]/2)+int(a[0]/2)))

Submission status: Wrong Answer

Solution code:
a=list(map(int,input().split()))
if a[0] == a[1]:
    print(str(a[0]))
elif a[0] < 2*a[1]:
    a[1]-=a[0]*2
    print(str(a[0]+int(a[1]/4)))
else:
    a[0]-=int(a[1]/2)
    print(str(int(a[1]/2)+int(a[0]/2)))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
num = 0
if n * 2 >= m:
  print(m//2)
else:
  num += n
  m -= n*2
  n = 0
  print(num + m//3)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if N<2*M:
    x=M-2*N
    y=x//4
    print(N+y)
if N==2*M:
    print(N)
if N>2*M:
    print(M//2)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if N<2*M:
    x=M-2*N
    y=x//4
    print(N+y)
if N==2*M:
    print(N)
if N>2*M:
    print(M)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
print((2*n+m) // 4)

Submission status: Wrong Answer

Solution code:
N, M = map( int, input().split())
if N*2 <= M:
    print(N+(M-N*2)//4)
else:
    print(M)

Submission status: Wrong Answer

Solution code:
N, M = map( int, input().split())
if N >= M*2:
    print(M)
else:
    print(N+(M-N*2)//4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

if N == M//2:
    print(N)

elif N > M//2:
    print(M//2 + (N - M//2)//2)

else:
    print(N + (M - N*2 )//4)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
d = 0
if c > 2*s:
    d = c//2
else:
    d = s + (c-2*s)//4
print(d)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
d = 0
if c > 2*s:
    while s>0:
        s -= 1
        c -= 2
        d += 1
else:
    d = s + (c-2*s)//4
print(d)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c > 2*s:
    print(min(s,c//2))
else:
    print(s + (c-2*s)//4)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c > 2*s:
    print(c//2)
else:
    print(s + (c-2*s)//4)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c > 2*s:
    print(c//2)
else:
    print(s + (c-2*s)//2)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
print((2*N+M)//4)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 0
if 2 * N >= M:
    ans = N
else:
    ans = int((M-2*N)/4) + N
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=0
a=M-2*N
if a<0:
    ans=N
else:
    ans+=N+a//4
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=[int(i) for i in input().split()]
print(max(M//4,N+((M-2*N)//4)))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=0
for i in range(N):
    M-=2
    ans+=1
ans+=M//4
print(ans)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if m <= 2*n:
  print(m//2)
else:
  print((m-2*n)//3 + n)

Submission status: Wrong Answer

Solution code:
N, M = map( int, input().split())
if M <= N*2:
    print(N)
else:
    print(N+(M-N*2)//4)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
s = n*2
ans = 0

if m > s:
    remain = m-s
    ans = n
    while remain >= 4:
        ans += 1
        remain -= 4
else:
    while m > 0:
        ans += 1
        m -= 2

print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if N > M:
    print(M // 2)
else:
    cnt = N
    M -= 2 * N
    cnt += M // 4
    print(cnt)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = 0

# Sをつかう
if M-2*N >=0:
  ans += N
else:
  ans += max(N, M//2)

M -= 2*ans

# Cだけ
ans += M // 4

print(ans)

Submission status: Wrong Answer

Solution code:
ns,nc=map(int,input().split())
if ns>=2*nc:
    print(nc//2)
    exit()
print(ns+(nc-ns*2)//4)

Submission status: Wrong Answer

Solution code:
N, M = (int(i) for i in input().split())

ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
N, M = (int(i) for i in input().split())

print(N + (M-2*N) // 4)

Submission status: Wrong Answer

Solution code:
N, M = (int(i) for i in input().split())

print(N + (M//4))

Submission status: Wrong Answer

Solution code:
N,M=(int(i) for i in input().split())
if 2*N >= M:
    print(M/2)
else:
    print(N+((M-2*N)//4))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

if n < 2*m:
    pair = n
    m = m - 2*n
    pair = pair + (m//4)
else:
    pair = m//2

print(pair)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

pair = n
m = m - 2*n
pair = pair + (m//4)

print(pair)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
print((m - n * 2) // 4 + n)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n * 2 > m:
    print(n)
else:
    q = m - n * 2
    print(n + q // 4)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n >= m // 2:
    print(n)
else:
    q = m - n * 2
    print(n + q // 4)

Submission status: Wrong Answer

Solution code:
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()
            
            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

#sの数
n = int(arr_data[0][0])
#cの数
m = int(arr_data[0][1])

num=min(n//1,m//2)

print(n,m)
cnt=num

n-=num*1
m-=num*2

print(n,m,cnt)

#cnt+=n//3
cnt+=m//4

print(cnt)

Submission status: Wrong Answer

Solution code:
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()
            
            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

#sの数
n = int(arr_data[0][0])
#cの数
m = int(arr_data[0][1])

num=min(n//1,m//2)

cnt=num

n-=num*1
m-=num*2

cnt+=n//3
cnt+=m//4

print(cnt)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
t=(M-2*N)//4
s=0
a,b=N+t,M-2*t
s=a
b=b-a*2
s+=(b//4)
print(s)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
v=(M+2*N)//4
print(v)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
ans = 0
for m in range(2, M + 1):
	temp_m = M - m
	temp_n = N + m //2
	temp_ans = min(temp_m// 2, temp_n)
	if temp_ans >= ans:
		ans = max(temp_ans, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
s,c = map(int,input().split())

if s<c/2:
    c_s = (c-2*s)//4
    sc = s
    print(c_s+sc)
else:
    sc = min(s,c/2)
    print(sc)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N,M = map(int, input().split())

print((N*2 + M) // 4)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
print(N + (M - 2*N) // 4)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
x = max((M - 2 * N) // 4, 0)
print(N + x)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(' '))

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

print(int((N * 2 + M) // 4))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

print(int((N * 2 + M) / 4))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

if N <= 2 * M:
    print(max((N + (M - N*2) // 4), M//4))
else:
    print(M//2)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

print(N + max(0, (M - N*2) // 4))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

print(N + max(0, (M - N) // 4))

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
A = M - 2 * N
print(N + (A // 4))

Submission status: Wrong Answer

Solution code:
I = raw_input()
L = I.split(" ")
N = int(L[0])
M = int(L[1])
print N + (M - N * 2) / 4

Submission status: Wrong Answer

Solution code:
I = raw_input()
L = I.split(" ")
N = int(L[0])
M = int(L[1])
ans = (N * 2 + M) / 4
print ans

Submission status: Wrong Answer

Solution code:
N,M = map(int, input().split())
s = N
c = M
i = 0
if 2*N>=M:
  print(M//2)
else:
  d= M-2*N
  N = N+d//4
  M = M-d//2
print(N)

Submission status: Wrong Answer

Solution code:
def m():
    s, c = map(int, input().split())
    if s >= c*2:
        return c//2
    ans = s
    ans += (c - s*2) // 4
    return ans

print(m())

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))

    if n == m == 1:
        print(0)
    else:
        print((2 * n + m) // 4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))

    if n <= m // 2:
        print((2 * n + m) // 4)
    else:
        print((n + 2 * m) // 4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))

    if n <= m:
        print((2 * n + m) // 4)
    else:
        print((n + 2 * m) // 4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem C

if __name__ == '__main__':
    n, m = list(map(int, input().split()))
    print((2 * n + m) // 4)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
ans = 0
while n > 0:
    n -= 1
    m -= 2
    ans += 1
ans += (m // 4)
print(ans)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
comb = 0

if n >= m // 2:
    comb += m // 2
    m -= m // 2
else:
    comb += n
    m -= 2 * n

comb += m // 4

print(comb)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
comb = 0

if m >= 2 * n:
    comb += n
    m -= 2 * n

comb += m // 4

print(comb)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
p = n*2+m
print(p//4)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if m<=2*n:
    print(m//2)
else:
    res=m-2*n
    print(n+res//3)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N, M = map(int, input().split())

print(int((2 * N + M) / 4))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = m - 2*n
if d >= 0: 
    ans = n    
    ans += d // 4
else:
    k = m // 2
    ans = n - k
print(ans)

Submission status: Wrong Answer

Solution code:
n,m =list(map(int,input().split()))

if n >= 2*m:
    print(m//2)
else:
    print((2*n+m)//4)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans=0


ans+=n
m-=2*n

ans+=m//4
print(ans)

Submission status: Wrong Answer

Solution code:
n , m  = list(map(int,input().split()))
counter = 0
if n <= m // 2:
    counter = n
    m = m - 2* n
else:
    counter = m //2
    n = n - m //2

counter = counter + m //4 

kouho = m //4
print(max(counter,kouho))

Submission status: Wrong Answer

Solution code:
n , m  = list(map(int,input().split()))
counter = 0
if n < m // 2:
    counter = n
    m = m - 2* n
else:
    counter = m //2
    n = n - m //2

counter = counter + m //4 

kouho = m //4
print(max(counter,kouho))

Submission status: Wrong Answer

Solution code:
n , m  = list(map(int,input().split()))
counter = 0
if n < m // 2:
    counter = n
    m = m - 2* n
else:
    counter = m //2
    n = n - m //2

counter = counter + m //4 
    
print(counter)

Submission status: Wrong Answer

Solution code:
n, m = map(int,input().split())
ans = n if n <= 2*m else 2*m
n -= ans
m -= 2*ans
ans += m//4 if (n==0 and m>1) else 0
print(ans)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
m//=2
print((n+m)//2)

Submission status: Wrong Answer

Solution code:
s,c=[int(i) for i in input().split()]

def cul(s,c):
  if s < c // 2:
    x = s
    x += max(c - s * 2, 0)//4
  else:
    x = s
  return x
print(cul(s,c))

Submission status: Wrong Answer

Solution code:
s,c=[int(i) for i in input().split()]

def cul(s,c):
  if s >= c // 2:
    x = s
    c = max(c - s * 2,0)
    x += c//4
  else:
    x = s
  return x
print(cul(s,c))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if N>=2*M:
    print(M//2)
else:
    print(N+(M-2*N)//4)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if N>=2*M:
    print(M)
else:
    print(N+(M-2*N)//4)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ac = 2*s + c
ans = 0
if ac // 4 > s:
    print((c - s*2) // 4 + s)
else:
    print(s)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ac = 2*s + c
ans = 0
if ac // 4 > s:
    print(ac//4)
else:
    print(s)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split()) 
a = M / 2

ans = int((N + a) // 2)
print(ans)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
a = M // 2

ans = (N + a) // 2
print(ans)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c<s//2:
    print(c//2)
else:
    v=c-2*s
    print(s+v//4)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c<s//2:
    print(c//2)
else:
    v=c-(2*s)
    print(s+v//4)

Submission status: Wrong Answer

Solution code:
s,c=map(int,input().split())
if c<=s//2:
    print(c//2)
else:
    v=c-(2*s)
    print(s+v//4)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if 2*m<n:
    print(m//2)
else:
    v=n-2*m
    print(n+(v//4))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if 2*m<=n:
    print(m//2)
else:
    v=m-2*n
    print(n+(v//4))

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
ans = 0
if 2 * N > M:
    ans += M // 2
    res = M - M // 2
else:
    ans += N
    res = M - 2 * N
ans += res // 4
print(ans)

Submission status: Wrong Answer

Solution code:
S,C = list(map(int,input().split()))
ans = 0
ans += min(S,C//2)
if C - ans*2 > 0:
  ans += C//4
print (ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,raw_input().split())
if M-2*N<0:
	print 0
else:
	print N+(M-2*N)/4

Submission status: Wrong Answer

Solution code:
N,M=map(int,raw_input().split())
print N+(M-2*N)/4

Submission status: Wrong Answer

Solution code:
def solve():
    while 1:
        N, M = list(map(int, input().split(" ")))
        if M < 2:
            print(0)
            break

        number_of_c = M + 2 * N
        print(N + (M - 2 * N) // 4)
        break


solve()

Submission status: Wrong Answer

Solution code:
def solve():
    while 1:
        N, M = list(map(int, input().split(" ")))
        if M < 2:
            print(0)
            break

        number_of_c = M + 2 * N
        print(number_of_c // 4)
        break


solve()

Submission status: Wrong Answer

Solution code:
def solve():
    N, M = list(map(int, input().split(" ")))
    number_of_c = M + 2 * N
    print(number_of_c // 4)


solve()

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
if N >= M // 2:
    print(N)
else:
    print(N + (M - 2 * N) // 4)

Submission status: Wrong Answer

Solution code:
n , m = map(int, raw_input().split())


tmp = (n * 2) + m
ans = tmp / 4 

print ans

Submission status: Wrong Answer

Solution code:
n , m = map(int, raw_input().split())

m -= 2 * n
ans = n
if m > 0:
        ans += m / 4

print ans

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=0
if N<M:
    ans=N+((M-(N*2))//4)
else:
    ans=M/2
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=0
if N<M:
    ans=N+((M-(N*2))//4)
else:
    ans=(M/2)+((N-(M/2))//3)
print(ans)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
ans=0
if N<M:
    ans=N+((M-(N*2))//4)
else:
    ans=(M/2)+((N-(M/2))//2)
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)


def possible(N, M, k):
    if N >= k:
        return M >= 2*k
    else:
        M -= 2*(k-N)
        return M >= 2*k

def main():
    N, M = map(int, input().split())

    # cc -> S はできるが S -> cc はできない

    # [lo, hi)
    # lo では必ず可能、hiでは必ず不可能
    hi = M // 2
    lo = M // 4 + 1
    while hi - lo > 1:
        mid = (hi + lo) // 2
        if possible(N, M, mid):
            lo = mid
        else:
            hi = mid

    print(lo)

if __name__ == "__main__": main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    N, M = map(int, input().split())

    nc = 2*N + M
    print(nc // 4)

if __name__ == "__main__": main()

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(" ")))

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

    print(N)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(" ")))

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

    print(N)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(" ")))

if M < 2:
    print(0)
elif 2*N >= M:
    print(N)
else:
    
    while(2*N < M-3):
        N += 1
        M -= 2

    print(N)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(" ")))

if 2*N >= M:
    print(N)
else:
    
    while(2*N < M-3):
        N += 1
        M -= 2

    print(N)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split(" ")))

if 2*N >= M:
    print(N)
else:
    
    while(2*N < M-4):
        N += 1
        M -= 2

    print(N)

Submission status: Wrong Answer

Solution code:
def solve(s, c):
    ans = 0
    if s*2 > c:
        c-=2*s
        ans = s
        if c >= 4:
            ans += c//4
    else:
        ans = c//2 
    return ans
        
    
S, C= map(int, input().split())
print(solve(S, C))

Submission status: Wrong Answer

Solution code:
def solve(s, c):
    ans = 0
    if s > 2*c:
        c-=2*s
        ans = s
        if c >= 4:
            ans += c//4
    else:
        ans = c//2 
    return ans
        
    
S, C= map(int, input().split())
print(solve(S, C))

Submission status: Wrong Answer

Solution code:
N , M = [int(i) for i in input().split()]

scc = 0
if N <= (M/2):
    scc = N
    M -= N * 2
else:
    scc = M // 2
    M -= scc

if M > 4:
    scc += M // 4

print(scc)

Submission status: Wrong Answer

Solution code:
N , M = [int(i) for i in input().split()]

scc = 0
if N <= (M/2):
    scc = N
    M -= N * 2
else:
    scc = M // 2
    M -= scc

scc += M // 4

print(scc)

Submission status: Wrong Answer

Solution code:
N , M = [int(i) for i in input().split()]

scc = 0

for i in range(N):
    N -= 1
    M -= 2

    if N <= 0 or M <= 0:
        N += 1
        M += 2
        break

    scc += 1

scc += M // 4

print(scc)

Submission status: Wrong Answer

Solution code:
N , M = [int(i) for i in input().split()]

scc = 0

for i in range(N):
    N -= 1
    M -= 2

    if N < 0 or M < 0:
        break

    scc += 1

scc += M // 4

print(scc)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ans = 0

if s <= 2*c: 
    c -= 2*s
    ans = s
else: 
    ans = c//2

if c >= 4:
    ans += c //4

print (ans)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ans = 0

if s<=2*c:
    c -= 2*s
    ans += s + c//4
else:
    ans += s

print (ans)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ans = 0

if s<2*c:
    c -= 2*s
    ans += s + c//4
else:
    ans += s

print (ans)

Submission status: Wrong Answer

Solution code:
s, c = map(int, input().split())
ans = 0

while (s>0 and c>0):
    s -= 1
    c -= 2
    ans += 1

while (c>=4):
    c -= 4
    ans += 1

print (ans)

Submission status: Wrong Answer

Solution code:
N, M = [int(x) for x in input().split()]

comp = min(N, M/2)
if comp == N:
	ans = comp + int((M - 2 * comp) / 4)
else:
	ans = comp

print(ans)

Submission status: Wrong Answer

Solution code:
s_num, c_num = map(int, input().split())
if s_num * 2 >= c_num:
    print(s_num)
else:
    ans = s_num
    c_num -= s_num * 2
    ans += c_num // 4
    print(ans)

Submission status: Wrong Answer

Solution code:
s_num, c_num = map(int, input().split())
if s_num * 2 > c_num:
    print(s_num)
else:
    ans = s_num
    c_num -= s_num * 2
    ans += c_num // 4
    print(ans)

Submission status: Wrong Answer

Solution code:
s_num, c_num = map(int, input().split())
print(s_num, c_num)
if s_num * 2 > c_num:
    print(s_num)
else:
    ans = s_num
    c_num -= s_num * 2
    ans += c_num // 4
    print(ans)

Submission status: Wrong Answer

Solution code:
S ,c  = map(int, input().split())
# 2cでSになる

X = 0
if c > S*2:
    X += S
    c -= 2*S
    X += int(c/3)
    print(X)
else:
    print(int(c/2))

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    inp = [int(i) for i in input().split()]
    N = inp[0]
    M = inp[1]
    if N >= 2*M:
        print(M//2)
    else:
        print(N+(M-2*N)//4)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    inp = [int(i) for i in input().split()]
    N = inp[0]
    M = inp[1]
    if N >= 2*M:
        print(M/2)
    else:
        print(N+(M-2*N)//4)

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    inp = [int(i) for i in input().split()]
    N = inp[0]
    M = inp[1]
    if N >= 2*M:
        print(M/2)
    else:
        print(N+int((M-2*N)/4))

Submission status: Wrong Answer

Solution code:
n,m=map(int,raw_input().split())
s=0
if m>=2*n:
    s+=n
else:
    s=0

s+=(m-2*n)/4
print s

Submission status: Wrong Answer

Solution code:
N, M = map(int, (input().split()))
if M >= 2 * N:
    c = M // 2
else:
    c = N
    M -= 2 * N
    c += M // 4
print(c)

Submission status: Wrong Answer

Solution code:
N, M = map(int, (input().split()))
if N > 2 * M:
    c = M // 2
else:
    c = N
    M -= 2 * N
    c += M // 4
print(c)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
print(n+(m-(2*n))//4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
# sys.setrecursionlimit(10000)


def main():
    # 入力処理
    N, M = map(int, input().split())

    # アルゴリズム本体
    if N >= (2 * M):
        K = int(M / 2)
    else:
        K = N + int((M - 2 * N) / 4)

    # 出力
    print(K)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
# sys.setrecursionlimit(10000)


def main():
    # 入力処理
    N, M = map(int, input().split())

    # アルゴリズム本体
    K = int(M / 2)

    # 出力
    print(K)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
# sys.setrecursionlimit(10000)


def main():
    # 入力処理
    N, M = map(int, input().split())

    # アルゴリズム本体
    K = N + int((M - 2 * N) / 4)

    # 出力
    print(K)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
# sys.setrecursionlimit(10000)


def main():
    # 入力処理
    N, M = map(int, input().split())

    # アルゴリズム本体
    if N >= 2 * M:
        K = int(M / 2)
    else:
        K = N + int((M - 2 * N) / 4)

    # 出力
    print(K)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n,m=map(int,raw_input().split())

if m<=2*n:
    print n+(m-2*n)/4
else:
    print m/2

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

n,m=map(int,raw_input().split())

if n<=2*m:
    print n+(m-2*n)/4
else:
    print m/2

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())
print N + (M - (2 * N)) / 4

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())
c = N * 2 + M
print c / 4

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
if 2*N >= M:
    print(M / 2)
else:
    print(N + (M - 2*N) // 4)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))
if(N > M // 2):
    print(M // 2)
else:
    print(N + (M - 2 * N) // 3)

Submission status: Wrong Answer

Solution code:
n,m = [int(x) for x in raw_input().split()]
s = m - n
print str(int(s // 4 + n))

Submission status: Wrong Answer

Solution code:
N,M=[int(x) for x in input().split()]
if N >= 2*M:
    Scc = M//2
elif N < 2*M and (M - 2*N >=4):
    Scc = N + (M-2*N)//4
else:
    Scc = N

print(Scc)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())# N=Sの数 M=cの数
if N>M:#Sがcよりも多い場合
    print(N)
else:#cがSよりも多い場合
    print(N+(M-2*N)//4)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())# N=Sの数 M=cの数

S1c2 = N
c4 = (M-S1c2*2)//4

print(S1c2+c4)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().split()]
check = lambda a: ((M - 2 * a) // 2 + N) >= a
left, right = 0, M + 1
while right - left > 1:
    mid = (left + right) // 2
    if check(mid):
        left = mid
    else:
        right = mid
print(left)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

numbers=input().rstrip().split(" ")

num=0
s=int(numbers[0])
c=int(numbers[1])

if s<=2*c:
    num+=s
    c=c-2*s
    s=0
    num=num+c//4
        
else:
    num+=c//2

print(num)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

numbers=input().rstrip().split(" ")

num=0
s=int(numbers[0])
c=int(numbers[1])

if s<=2*c:
    num+=s
    c-=2*s
    num+=c//4
        
elif s>2*c:
    num=c//2

print(num)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

numbers=input().rstrip().split(" ")

num=0
s=int(numbers[0])
c=int(numbers[1])

if s<=2*c:
    num+=s
    c-=2*s
    s=0
    num+=c//4
        
elif s>2*c:
    num=c//2

print(num)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def main():
    s, c = map(int, input().split())

    result = s - (c / 2)

    if result < 0:
        r = result * -2
        r = int(r / 4)
        print(s + r)
    else:
        print(s - result)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())

if (M-2*N)>0:
    print(N+(M-2*N)//4)
else:
    print(N)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
num_c = N*2 + M
num_Scc = num_c//4
print(num_Scc)

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())

if M < 2:
  print 0
elif M - 2*N < 0:
  print N
else:
  print N + int((M - 2*N)/4)

Submission status: Wrong Answer

Solution code:
N, M = map(int, raw_input().split())

if M - 2*N < 0:
  print N
else:
  print N + int((M - 2*N)/4)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-


def main():
    n, m = map(int, input().split())
    c_num = n * 2

    if m - c_num < 0:
        result = n
    else:
        result = n + ((m - c_num) / 4)
    print(int(result))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split());print(min(m/2,n+(m-2*n)/4))

Submission status: Wrong Answer

Solution code:
import math
N,M=map(int,raw_input().split())
if M<=2*N:
    print N
else:
    print N+int(math.floor((M-2*N)/4))

Submission status: Wrong Answer

Solution code:
s,c = map(int, raw_input().split())
 
scc = 0
if s*2 <= c:
  scc = s
  c -= s*2
else:
  scc = c/2
print  scc + c/4

Submission status: Wrong Answer

Solution code:
s,c = map(int, raw_input().split())

scc = 0
if s*2 <= c:
  scc = s
  c -= s*2
print scc + c/4

Submission status: Wrong Answer

Solution code:
data = input().split()
N = int(data[0])
M = int(data[1])

sum = 0
if N<= int(M/2):
    sum+=N
    sum+=int((M-2*N)/4)
else:
    sum+=M/2

print(sum)

Submission status: Wrong Answer

Solution code:
s, c = [int(e) for e in input().split()]


def main(s, c):
    if c < 2:
        return 0
    
    ret = s
    c -= s * 2
    
    ret += c // 4

    return ret


ans = main(s, c)
print(ans)