{"problem":{"name":"Sum of Three Integers","description":{"content":"You are given two integers $K$ and $S$.   Three variable $X, Y$ and $Z$ takes integer values satisfying $0≤X,Y,Z≤K$.   How many different assignments of values to $X, Y$ and $Z$ are there such that $X","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc051_b"},"statements":[{"statement_type":"Markdown","content":"You are given two integers $K$ and $S$.  \nThree variable $X, Y$ and $Z$ takes integer values satisfying $0≤X,Y,Z≤K$.  \nHow many different assignments of values to $X, Y$ and $Z$ are there such that $X + Y + Z = S$?\n\n## Constraints\n\n*   $2≤K≤2500$\n*   $0≤S≤3K$\n*   $K$ and $S$ are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$K$ $S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc051_b","tags":[],"sample_group":[["2 2","6\n\nThere are six triples of $X, Y$ and $Z$ that satisfy the condition:\n\n*   $X = 0, Y = 0, Z = 2$\n*   $X = 0, Y = 2, Z = 0$\n*   $X = 2, Y = 0, Z = 0$\n*   $X = 0, Y = 1, Z = 1$\n*   $X = 1, Y = 0, Z = 1$\n*   $X = 1, Y = 1, Z = 0$"],["5 15","1\n\nThe maximum value of $X + Y + Z$ is $15$, achieved by one triple of $X, Y$ and $Z$."]],"created_at":"2026-03-03 11:01:14"}}