AtCoder Beginner Contest 055
翻译中…
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.
翻译中…
样例
Input #1
1 6
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
Input #2
12345 678901
Output #2
175897
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。