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 6

-----Sample Output-----
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
[{"code": "n, m = [int(x) for x in input().split()]\nans = min(n, m // 2)\nans += (m - ans * 2) // 4\nprint(ans)", "passed": true, "time": 1.98, "memory": 14164.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nans=0\nif 2*N<=M:\n  ans+=N\n  M-=2*N\nelse:\n  ans+=(M//2)\n  M-=(M//2)*2\nans+=(M//4)\nprint(ans)", "passed": true, "time": 0.19, "memory": 14300.0, "status": "done"}, {"code": "def main():\n    n, m = map(int, input().split())\n\n    if m - 2 * n >= 0:\n        m -= 2 * n\n        ans = n\n        n = 0\n\n        if (m - 2 * n) % 4 == 0:\n            tmp = (m - 2 * n) // 4\n        else:\n            tmp = (m - 2 * n) // 4 + 1\n\n        ans += (m - 2 * tmp) // 2\n\n    else:\n        ans = m // 2\n\n    print(ans)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.15, "memory": 14064.0, "status": "done"}, {"code": "s, c = map(int, input().split())\nc = c//2\n\nif s == c:\n    print(s)\nelif s > c:\n    print(c)\nelif s < c:\n    t = c - s\n    print(s + t//2)", "passed": true, "time": 0.15, "memory": 14288.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\n\nif N <= M/2:\n    ans = N + (M - 2*N)//4\nelse:\n    ans = M//2\nprint(ans)\n", "passed": true, "time": 0.16, "memory": 14128.0, "status": "done"}, {"code": "n, m = map(int, input().split())\n\nif n >= (m // 2):\n  print(m // 2)\nelse:\n  total = n * 2 + m\n  print(total // 4)", "passed": true, "time": 0.18, "memory": 14132.0, "status": "done"}, {"code": "n,m = map(int,input().split())\n\nans = 0\nif m-n*2>0:\n    ans += n\n    tmp = m-n*2\n    \n    ans += tmp//4\nelse:\n    ans += m//2\nprint(ans)", "passed": true, "time": 0.15, "memory": 14336.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nif n<m:\n    print(n+(m-2*n)//4)\nelse:\n    print(m//2)", "passed": true, "time": 1.9, "memory": 14196.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nif N >= M // 2:\n    ans = M//2\nelse:\n    ans = N + (M-2*N)//4\nprint(ans)", "passed": true, "time": 0.2, "memory": 14172.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nif 0 <= 2*n-m:\n    num = m//2\nelse:\n    num = n\n    num += (m-2*n)//4\nprint(num)", "passed": true, "time": 0.17, "memory": 14240.0, "status": "done"}, {"code": "#!/usr/bin/env python\n\nn, m = list(map(int, input().split()))\n\ncc = m//2\nans = min(n, cc) \nres = cc-min(n, cc) \nif res > 0:\n    ans += res//2\nprint(ans)\n", "passed": true, "time": 0.19, "memory": 14200.0, "status": "done"}, {"code": "import math\nN,M = (int(T) for T in input().split())\nif M-2*N>0:\n    Convert = int(math.floor((M-2*N)/4))\n    N += Convert\n    M -= 2*Convert\n    print(N)\nelse:\n    print(M//2)", "passed": true, "time": 0.14, "memory": 14336.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nprint(M//2 if 2*N > M else N + (M-2*N)//4)", "passed": true, "time": 0.16, "memory": 14076.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nprint(min(n,m//2)+(m//2-min(n,m//2))//2)", "passed": true, "time": 0.19, "memory": 14140.0, "status": "done"}, {"code": "# C - Scc Puzzle\ndef main():\n    n, m = map(int, input().split())\n\n\n    if m-n*2 >= 0:\n        print(n+((m-n*2)//4))\n    else:\n        print(m//2)\n  \n        \ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.17, "memory": 14196.0, "status": "done"}, {"code": "N, M = map(int, input().split())\nif 2*N < M:\n    extra = (M - 2*N) // 4\n    ans = N + extra\nelse:\n    ans = M // 2\nprint(ans)", "passed": true, "time": 0.14, "memory": 14048.0, "status": "done"}, {"code": "N,M = (int(T) for T in input().split())\nif 2*N<M:\n    print(N+(M-2*N)//4)\nelse:\n    print(M//2)", "passed": true, "time": 0.2, "memory": 14288.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nM//=2\nprint(min(M,(N+M)//2))", "passed": true, "time": 0.14, "memory": 14232.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nif m<2:\n    print((0))\n    return\nif n>m//2:\n    print((m//2))\n    return\nc=n%(m//2)\nd=m-2*c\nc+=d//4\nprint(c)\n", "passed": true, "time": 0.14, "memory": 14168.0, "status": "done"}, {"code": "s, c = map(int, input().split())\n\nif 2 * s <= c:\n    ans = s\n    c = c - 2 * s\nelse:\n    ans = c // 2\n    c = 0\nif c >= 4:\n    ans += c // 4\nprint(ans)", "passed": true, "time": 0.14, "memory": 14116.0, "status": "done"}, {"code": "n, m = [int(i) for i in input().split()]\n\nif 2*n >= m:\n    print(m // 2)\nelse:\n    print(n + (m - 2 * n) // 4)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "N, M = map(int, input().split())\n\nif 2 * N >= M:\n    print(M // 2)\nelse:\n    print(N + (M - 2 * N) // 4)", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nres = min(n, m // 2) + (m - min(n, m // 2) * 2) // 4\nprint(res)\n", "passed": true, "time": 0.15, "memory": 14236.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\ntotal = 2 * N + M\nans = total // 4\nif ans*2 > M:\n  ans = M//2\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14112.0, "status": "done"}, {"code": "import sys\nN,M = map(int,input().split())\nif not ( 1 <= N <= 10**12 and 1 <= M <= 10**12 ): return\n\ncount_SCC=0\nif M > 2*N : #M\u304c\u3042\u307e\u308b\n    M = M - 2*N\n    count_SCC = N + M//4\nelif M < 2*N : #N\u304c\u3042\u307e\u308b\n    count_SCC = M//2\nprint(count_SCC)", "passed": true, "time": 0.14, "memory": 14104.0, "status": "done"}, {"code": "n,m = [int(x) for x in input().split()]\nres = 0\nif 2 * n >= m:\n  res = m // 2\nelse:\n  res = n\n  m -= 2 * n\n  res += m // 4\n\nprint(res)", "passed": true, "time": 0.15, "memory": 14160.0, "status": "done"}, {"code": "N,M = [int(a) for a in input().split()]\n\na1 = min(N,M//2)\na2 = 0\nif M//2 > N:\n  a2 = (M - N*2)//4\n  \na3 = a1+a2\nprint(a3)", "passed": true, "time": 0.14, "memory": 14208.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\n\nif 2 * n >= m:\n    print(m // 2)\nelse:\n    print(n + (m-(2*n))//4)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nif 2*n>=m:\n  print(m//2)\nelse:\n  ans=n\n  ans+=(m-2*n)//4\n  print(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nans = min(n, m // 2)\nm -= ans * 2\nans += max(0, m // 4)\nprint(ans)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N,M=map(int,input().split())\n \nif N>=M//2:\n  print(M//2)\nelse:\n  print(N+(M-2*N)//4)", "passed": true, "time": 0.15, "memory": 14244.0, "status": "done"}, {"code": "n,m=list(map(int,input().split()))\nif n*2>=m:\n    ans=m//2\nelse:\n    ans=n\n    m-=n*2\n    ans+=m//4\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "S, C = list(map(int, input().split()))\nans = 0\n\n# \u521d\u671f\u306eS\u3067\u53ef\u80fd\u306a\u9650\u308aSCC\u3092\u4f5c\u308b\nif S*2 <= C:\n    C = C - S*2\n    ans += S\n    ans += C // 4\nelse:\n    ans += C // 2\n\nprint((int(ans)))\n", "passed": true, "time": 1.53, "memory": 14132.0, "status": "done"}, {"code": "import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n    N, M = list(map(int, readline().split()))\n\n    if N >= M // 2:\n        ans = M // 2\n    else:\n        ans = N\n        L = M - 2 * N\n        ans += L // 4\n\n    print(ans)\n    return\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.22, "memory": 14192.0, "status": "done"}, {"code": "s,c=map(int,input().split())\nif 2*s<=c: print((s+c//2)//2)\nelse: print(c//2)", "passed": true, "time": 0.22, "memory": 14140.0, "status": "done"}, {"code": "N, M = [int(i) for i in input().split()]\nif 2 * N >= M:\n    print((M // 2))\nelse:\n    print((N + (M - N - N) // 4))\n", "passed": true, "time": 0.18, "memory": 14072.0, "status": "done"}, {"code": "import sys;input = lambda : sys.stdin.readline()\nn,m = list(map(int,input().split()))\nif m-2*n>=0:\n    print((n+(m-2*n)//4))\nelse:\n    print((m//2))\n", "passed": true, "time": 0.23, "memory": 14192.0, "status": "done"}, {"code": "s,c=map(int,input().split())\np=s*2\nif p <= c:\n  print(s + (c-p)//4)\nelse:\n  print(c//2)", "passed": true, "time": 0.22, "memory": 14104.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nif n*2>=m:\n    print(m//2)\nelse:\n    print(n+(m-2*n)//4)", "passed": true, "time": 0.2, "memory": 14248.0, "status": "done"}, {"code": "n, m = map(int, input().split())\n\nc = m - n * 2\nif c > 0:\n    print(n + c // 4)\nelse:\n    print(m // 2)", "passed": true, "time": 0.15, "memory": 14204.0, "status": "done"}, {"code": "a,b=map(int, input().split())\n\nif a*2 <= b:\n    c = (b-a*2)//4\n    print(a+c)\nif a*2 > b:\n    print(b//2)", "passed": true, "time": 0.24, "memory": 14132.0, "status": "done"}, {"code": "N, M = list(map(int ,input().split()))\n\n# N + x : M - 2x = 1 : 2\n# M - 2x = 2N + 2x\n# x = (M - 2N) / 4\n\nif N * 2 >= M:\n  print((int(M / 2)))\nelse:\n  x = (M - 2 * N) / 4\n  N += int(x)\n  M -= 2 * int(x)\n  print(N)\n  \n  \n", "passed": true, "time": 0.23, "memory": 14296.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nif 2*N>M:\n    print((M//2))\nelse:\n    print(((2*N+M)//4))\n", "passed": true, "time": 0.15, "memory": 14172.0, "status": "done"}, {"code": "import sys\nn,m = list(map(int,input().split()))\nif m < 2:\n  print((0))\n  return\nif(1 < m < n) or 2*n > m >= n:\n  print((m//2))\n  return\nm -= 2*n\nprint((n+(m//4)))\n", "passed": true, "time": 0.24, "memory": 14072.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nif n*2 <= m:\n  m += n*2\n  print(m//4)\nelse:\n  print(m//2)", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "import sys\nimport math\n\nN, M = list(map(int, input().split()))\n\ncount = min(M//2, N)\nM -= count*2\nprint(count + M//4)", "passed": true, "time": 0.24, "memory": 14232.0, "status": "done"}, {"code": "import sys\nn,m = map(int,input().split())\nif m < 2:\n  print(0)\n  return\nif 1 < m < n:\n  print(m//2)\n  return\nif 2*n > m >= n:\n  print(m//2)\n  return\nm -= 2*n\nprint(n+(m//4))", "passed": true, "time": 0.24, "memory": 14036.0, "status": "done"}, {"code": "s, c = map(int,input().split())\n\ncnt = 0\nif 2*s <= c:\n    cnt += s\n    c -= 2*s\nelse:\n    cnt += c // 2\n    c = 0\n\ncnt += c//4\nprint(cnt)", "passed": true, "time": 0.15, "memory": 14096.0, "status": "done"}, {"code": "S, C = map(int, input().split())\n\nans = min(S, C // 2)\nS -= ans\nC -= ans * 2\nif C >= 4:\n    ans += C // 4\nprint(ans)", "passed": true, "time": 0.15, "memory": 14356.0, "status": "done"}, {"code": "n,m = map(int, input().split())\nans = 0\n\nif m >= 2 and n > 0:\n  ans += min(n, m // 2)\n  m -= 2*ans\n\nif m > 0:\n  ans += m // 4\nprint(ans)", "passed": true, "time": 0.15, "memory": 14084.0, "status": "done"}, {"code": "n,m = list(map(int,input().split()))\nif m//2 >=n:\n    print((n+(m//2-n)//2))\nelse:\n    print((m//2))\n", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nif N*2 >= M:\n  print((M // 2))\n  return\nans = N + (M - N*2) // 4\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "n,m = map(int, input().split())\n\nif m - 2*n <0:\n    print(m//2)\nelse:\n    ans = n\n    m -= 2*n\n    ans += m//4\n    print(ans)", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "n,m = list(map(int,input().split()))\n\nif(2*n>=m):\n\tprint((m//2))\nelse:\n\tremaining = m- n*2\n\tans = remaining//4 + n\n\tprint(ans)\n", "passed": true, "time": 0.15, "memory": 14088.0, "status": "done"}, {"code": "N, M= map(int, input().split())\n\nif N >= M // 2:\n    print(M // 2)\n\nelse:\n    m = M - N * 2\n    s = m // 4\n    print(N + s)", "passed": true, "time": 0.14, "memory": 14352.0, "status": "done"}, {"code": "n,m = map(int, input().split())\n\nans = 0\nif n*2 <= m:\n  ans += n\n  m -= n*2\nelse:\n  ans += m//2\n  print(ans)\n  return\n  \nif 4 <= m: ans += m//4\nprint(ans)", "passed": true, "time": 0.14, "memory": 14272.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nif 2*n >= m:\n    print(m // 2)\nelse:\n    print(n+((m-2*n) // 4))", "passed": true, "time": 0.14, "memory": 14284.0, "status": "done"}, {"code": "N,M = map(int,input().rstrip().split(\" \"))\nk = N * 2 + M\nprint(min(k // 4,M//2))", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "n,m=map(int,input().split())\n\nif 2*n<m:\n    ans=n+(m-(2*n))//4\nelse:\n    ans=m//2\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\nA = 0\nif 2 * N <= M:\n    A += N\n    M -= 2 * N\n    print((A + M // 4))\nelse:\n    print((M // 2))\n", "passed": true, "time": 0.16, "memory": 14144.0, "status": "done"}, {"code": "s, c = list(map(int, input().split()))\n\nif (2 * s == c):\n    ans = s\n\nelif (2 * s > c):\n    ans = c // 2\n\nelse:\n    ans = s\n    tar = c - 2 * s\n\n    ans += tar // 4\n\n\nprint((int(ans)))\n", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "N,M=map(int,input().split())\n\nif N >= 2*M:\n  print(M//2)\n  return\n  \ndef f(x):\n  return max(min(N+x, (M-2*x)//2),0)\n  \ndelta = [-3,-2,-1,0,1,2,3]\nx = (M-2*N)//4\n\nans = 0\nfor i in range(7):\n  x_ = max(0,x+delta[i])\n  ans = max(ans,f(x_))\n\nprint(ans)", "passed": true, "time": 0.25, "memory": 14272.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\n\nans = 0\nif n < m:\n    if 2*n <= m:\n        m = m -2*n\n        ans += n\n    \n    ans += m//4\nelse:\n    ans += m//2\n\nprint(ans)\n\n", "passed": true, "time": 0.18, "memory": 14080.0, "status": "done"}, {"code": "S, C = [int(n) for n in input().split(\" \")]\n\nif 2 * S >= C:\n  print(min([S, int(C/2)]))\nelse:\n  print(S + int((C - 2 * S) / 4))", "passed": true, "time": 0.14, "memory": 14064.0, "status": "done"}, {"code": "N, M = map(int, input().split())\n\nn = N\nm = M // 2\n\nans = 0\nif n >= m:\n  ans += m\nelse:\n  ans += n\n  m -= n\n  ans += m // 2\n  \nprint(ans)", "passed": true, "time": 0.15, "memory": 14236.0, "status": "done"}, {"code": "s,c=map(int,input().split())\n\nif c>=s*2:\n  ans=s+(c-s*2)//4\n  \nelse:\n  ans=c//2\n  \nprint(ans)", "passed": true, "time": 0.14, "memory": 14316.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nres = 0\nif n > m // 2:\n    res = m // 2\n    print(res)\nelse:\n    res = n\n    n -= res\n    m -= res * 2\n    # \u3053\u3053\u3067n\u306f0\n    res += m // 4\n    print(res)\n", "passed": true, "time": 0.15, "memory": 14052.0, "status": "done"}, {"code": "#n = int(input())\nn, m = list(map(int, input().split()))\n#l = list(map(int,input().split()))\n#l = [list(map(int,input().split())) for i in range(n)]\n\nif n >= m//2:\n    ans = m//2\nelse:\n    m -= n*2\n    ans = n + m//4\n\nprint(ans)\n", "passed": true, "time": 0.24, "memory": 14236.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nans = 0\n\nif m < n * 2:\n    ans = m//2\nelse:\n    ans = n + (m-n*2)//4\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nif m >= 2*n:\n    rem = m - 2*n\n    print((n+rem//4))\nelse:\n    print((m//2))\n", "passed": true, "time": 0.14, "memory": 14376.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nans = 0\nif 2*n >= m:\n  print(m//2)\nelse:\n  ans += n\n  m -= 2*n\n  ans += m//4\n  print(ans)", "passed": true, "time": 0.22, "memory": 14104.0, "status": "done"}, {"code": "s, c = map(int, input().split())\nprint((s + (c - s * 2) // 4, c // 2)[s * 2 >= c])", "passed": true, "time": 0.19, "memory": 14068.0, "status": "done"}, {"code": "N,M = list(map(int,input().split()))\nif 2*N >= M:\n    ans = M//2\nelse:\n    ans = N\n    M = M - 2*N\n    ans += M//4\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "n,m=map(int, input().split())\nans=0\nif n>=m//2:\n    ans=m//2\nelse:\n    ans=n\n    m-=n*2\n    ans+=m//4\nprint(ans)", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nm = (m//2) * 2\nif n > m//2:\n    print(m//2)\nelse:\n    print(n+(m-n*2)//4)", "passed": true, "time": 0.14, "memory": 14360.0, "status": "done"}, {"code": "n,m = map(int, input().split())\n\nif 2*n <= m: print(n + (m-2*n)//4)\nelse: print(m//2)", "passed": true, "time": 0.14, "memory": 14280.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nprint(min(N,M//2)+max(M-N*2,0)//4)", "passed": true, "time": 0.14, "memory": 14256.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nans = 0\n\nif 2*N >= M:\n  ans = M//2\nelse:\n  ans += N\n  C = M-2*N\n  ans += C//4\n  \nprint(ans)", "passed": true, "time": 0.14, "memory": 14184.0, "status": "done"}, {"code": "n,m = map(int,input().split())\nans=0\nif m >= 2 and n >= 1:\n    if m//2 >= n:\n        ans+=n\n        m = m - n*2\n        ans+= m//4\n    else:\n        ans+= m//2\nprint(ans)", "passed": true, "time": 0.14, "memory": 14096.0, "status": "done"}, {"code": "N,M=list(map(int,input().split()))\nif 2*N>=M :\n  print((M//2))\n  return\nprint((N+(M-2*N)//4))\n", "passed": true, "time": 0.14, "memory": 14180.0, "status": "done"}, {"code": "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Wed Sep 30 00:56:12 2020\n\n@author: liang\n\"\"\"\n\nN, M = map(int, input().split())\n\nif N*2 >= M:\n    print(M//2)\nelse:\n    print( N + (M-2*N)//4)", "passed": true, "time": 0.14, "memory": 14044.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\n\nif n * 2 < m:\n  print(n + (m - n * 2) // 4)\nelse:\n  print(m // 2)", "passed": true, "time": 0.14, "memory": 14220.0, "status": "done"}, {"code": "#\n# abc055 c\n#\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n    def assertIO(self, input, output):\n        stdout, stdin = sys.stdout, sys.stdin\n        sys.stdout, sys.stdin = StringIO(), StringIO(input)\n        resolve()\n        sys.stdout.seek(0)\n        out = sys.stdout.read()[:-1]\n        sys.stdout, sys.stdin = stdout, stdin\n        self.assertEqual(out, output)\n\n    def test_\u5165\u529b\u4f8b_1(self):\n        input = \"\"\"1 6\"\"\"\n        output = \"\"\"2\"\"\"\n        self.assertIO(input, output)\n\n    def test_\u5165\u529b\u4f8b_2(self):\n        input = \"\"\"12345 678901\"\"\"\n        output = \"\"\"175897\"\"\"\n        self.assertIO(input, output)\n\n\ndef resolve():\n    N, M = list(map(int, input().split()))\n\n    if M >= 2*N:\n        print((N+(M-2*N)//4))\n    else:\n        print((M//2))\n\n\ndef __starting_point():\n    # unittest.main()\n    resolve()\n\n__starting_point()", "passed": true, "time": 0.2, "memory": 14500.0, "status": "done"}, {"code": "#!/usr/bin/env python\n\nn, m = list(map(int, input().split()))\n\nans = 0 \ncc = m//2\nif n >= cc: \n    ans = cc\nelse:\n    ans = (n+cc)//2\nprint(ans)\n", "passed": true, "time": 0.14, "memory": 14260.0, "status": "done"}, {"code": "def main():\n    n, m = list(map(int, input().split()))\n    ans = 0\n    if m >= 2*n:\n        ans += n\n        m -= 2*n\n        n = 0\n    else:\n        ans += m // 2\n        m -= ans * 2\n    ans += m // 4\n    print(ans)\n\n\ndef __starting_point():\n    main()\n\n__starting_point()", "passed": true, "time": 0.14, "memory": 14056.0, "status": "done"}, {"code": "n, m = map(int, input().split())\nif n * 2 >= m:\n  print(m // 2)\n  return\nres = n\nm -= (2 * n)\nres += (m // 4)\nprint(res)", "passed": true, "time": 0.15, "memory": 14192.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nif N <= M // 2:\n    print(N + (M - 2 * N) // 4)\nelse:\n    print(M // 2)", "passed": true, "time": 0.22, "memory": 14208.0, "status": "done"}, {"code": "N,M=map(int,input().split())\nans=0\nif M>=2*N:\n    ans+=N\nelse:\n    ans+=M//2\n    print(ans)\n    return\n\nM-=2*N\nans+=M//4\nprint(ans)", "passed": true, "time": 0.23, "memory": 14196.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nprint(min(M//2,(2*N+M)//4))", "passed": true, "time": 0.14, "memory": 14204.0, "status": "done"}, {"code": "n,m=map(int,input().split())\nprint(min(n,m//2)+(m//2-min(n,m//2))//2)", "passed": true, "time": 0.22, "memory": 14280.0, "status": "done"}, {"code": "N, M = list(map(int, input().split()))\n\nif N * 2 > M:\n    print((M // 2))\nelif N * 2 == M:\n    print(N)\nelse:\n    count = N\n    M -= 2 * N\n    count += (M // 4)\n    print(count)\n", "passed": true, "time": 0.14, "memory": 14292.0, "status": "done"}, {"code": "s, c = list(map(int, input().split()))\ni = min(s, c//2)\nm = i\ns -= i\nc -= i*2\nif s == 0:\n    m += c//4\n# print(s,c)\nprint(m)\n", "passed": true, "time": 0.14, "memory": 14380.0, "status": "done"}, {"code": "N,M=map(int,input().split())\n#S=N,C=M\nprint(min(((2*N)+M)//4,M//2))", "passed": true, "time": 0.14, "memory": 14264.0, "status": "done"}, {"code": "N,M = map(int,input().split())\nif N*2 > M:\n    print(M//2)\nelse:\n    M -= N*2\n    print(N+M//4)", "passed": true, "time": 0.22, "memory": 14296.0, "status": "done"}, {"code": "import sys\n\nN, M=list(map(int,input().split()))\nMh=M//2\n\nif N>Mh:\n  print(Mh)\n  return\nelse:\n  rem=M-2*N\n  print((rem//4+N))\n", "passed": true, "time": 0.14, "memory": 14140.0, "status": "done"}, {"code": "n, m = list(map(int, input().split()))\nif 2 * n >= m:\n    print((m // 2))\nelse:\n    print((n + (m-(2*n))//4))\n", "passed": true, "time": 0.14, "memory": 14268.0, "status": "done"}, {"code": "N, M = map(int, input().split())\n\nif N < M:\n    print(N + (M - 2 * N) // 4)\nelse:\n    print(M // 2)", "passed": true, "time": 0.14, "memory": 14084.0, "status": "done"}, {"code": "s, c = map(int, input().split())\nans = 0\nans += min(s,c//2)\nres = c-min(s,c//2)*2\nans += res//4\nprint(ans)", "passed": true, "time": 0.14, "memory": 14300.0, "status": "done"}, {"code": "N, M = map(int, input().split())\n\nans = 0\nif(M//2 >= N):\n    ans += N\n    M = M - N*2    \n    ans += M//4\n    \nelse:\n    ans += M//2\n\nprint(ans)", "passed": true, "time": 0.14, "memory": 14132.0, "status": "done"}]