{"problem":{"name":"Tree Degree Subset Sum","description":{"content":"Given is a tree with $N$ vertices. The vertices are numbered $1$ through $N$, and the $i$\\-th edge connects Vertex $A_i$ and Vertex $B_i$. Find the number of pairs of integers $(x,y)$ that satisfy the","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":6000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc125_f"},"statements":[{"statement_type":"Markdown","content":"Given is a tree with $N$ vertices. The vertices are numbered $1$ through $N$, and the $i$\\-th edge connects Vertex $A_i$ and Vertex $B_i$.\nFind the number of pairs of integers $(x,y)$ that satisfy the following conditions.\n\n*   $0 \\leq x \\leq N$.\n    \n*   There is a way to choose exactly $x$ vertices from the tree so that the sum of their degrees equals $y$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i < B_i \\leq N$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$A_2$ $B_2$\n$\\vdots$\n$A_{N-1}$ $B_{N-1}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc125_f","tags":[],"sample_group":[["3\n1 2\n2 3","6\n\nThe following six pairs $(x,y)$ satisfy the conditions.\n\n*   $x=0,y=0$\n*   $x=1,y=1$\n*   $x=1,y=2$\n*   $x=2,y=2$\n*   $x=2,y=3$\n*   $x=3,y=4$\n\n$x=2,y=3$, for example, satisfies the condition because choosing Vertex $1$ and Vertex $2$ achieves the total degree of $3$."],["5\n1 2\n2 3\n2 4\n4 5","16"],["10\n2 9\n8 10\n2 10\n4 6\n5 6\n1 8\n2 7\n3 6\n6 8","65"]],"created_at":"2026-03-03 11:01:14"}}