{"problem":{"name":"Quadruple","description":{"content":"Given are integers $N$ and $K$. How many quadruples of integers $(a,b,c,d)$ satisfy both of the following conditions? *   $1 \\leq a,b,c,d \\leq N$ *   $a+b-c-d=K$","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc107_b"},"statements":[{"statement_type":"Markdown","content":"Given are integers $N$ and $K$. How many quadruples of integers $(a,b,c,d)$ satisfy both of the following conditions?\n\n*   $1 \\leq a,b,c,d \\leq N$\n*   $a+b-c-d=K$\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^5$\n*   $-2(N-1) \\leq K \\leq 2(N-1)$\n*   All numbers in input are integers.\n\n## Input\n\nInput is given from standard input in the following format:\n\n$N$ $K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc107_b","tags":[],"sample_group":[["2 1","4\n\nFour quadruples below satisfy the conditions:\n\n*   $(a,b,c,d)=(2,1,1,1)$\n*   $(a,b,c,d)=(1,2,1,1)$\n*   $(a,b,c,d)=(2,2,2,1)$\n*   $(a,b,c,d)=(2,2,1,2)$"],["2525 -425","10314607400"]],"created_at":"2026-03-03 11:01:13"}}