{"problem":{"name":"Distinct Boxes","description":{"content":"Snuke has $R$ red balls and $B$ blue balls. He distributes them into $K$ boxes, so that no box is empty and no two boxes are identical. Compute the maximum possible value of $K$. Formally speaking, le","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"wtf19_d"},"statements":[{"statement_type":"Markdown","content":"Snuke has $R$ red balls and $B$ blue balls. He distributes them into $K$ boxes, so that no box is empty and no two boxes are identical. Compute the maximum possible value of $K$.\nFormally speaking, let's number the boxes $1$ through $K$. If Box $i$ contains $r_i$ red balls and $b_i$ blue balls, the following conditions must be satisfied:\n\n*   For each $i$ ($1 \\leq i \\leq K$), $r_i > 0$ or $b_i > 0$.\n*   For each $i, j$ ($1 \\leq i < j \\leq K$), $r_i \\neq r_j$ or $b_i \\neq b_j$.\n*   $\\sum r_i = R$ and $\\sum b_i = B$ (no balls can be left outside the boxes).\n\n## Constraints\n\n*   $1 \\leq R, B \\leq 10^{9}$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$R$ $B$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"wtf19_d","tags":[],"sample_group":[["8 3","5\n\nThe following picture shows one possible way to achieve $K = 5$:\n![image](https://img.atcoder.jp/wtf19/9ea9530037df204a84029678052ab593.png)"]],"created_at":"2026-03-03 11:01:13"}}