{"problem":{"name":"Square Constraints","description":{"content":"Given is an integer $N$. How many permutations $(P_0,P_1,\\cdots,P_{2N-1})$ of $(0,1,\\cdots,2N-1)$ satisfy the following condition? *   For each $i$ $(0 \\leq i \\leq 2N-1)$, $N^2 \\leq i^2+P_i^2 \\leq (2","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":4000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc036_f"},"statements":[{"statement_type":"Markdown","content":"Given is an integer $N$. How many permutations $(P_0,P_1,\\cdots,P_{2N-1})$ of $(0,1,\\cdots,2N-1)$ satisfy the following condition?\n\n*   For each $i$ $(0 \\leq i \\leq 2N-1)$, $N^2 \\leq i^2+P_i^2 \\leq (2N)^2$ holds.\n\nSince the number can be enormous, compute it modulo $M$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 250$\n*   $2 \\leq M \\leq 10^9$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc036_f","tags":[],"sample_group":[["2 998244353","4\n\nFour permutations satisfy the condition:\n\n*   $(2,3,0,1)$\n*   $(2,3,1,0)$\n*   $(3,2,0,1)$\n*   $(3,2,1,0)$"],["10 998244353","53999264"],["200 998244353","112633322"]],"created_at":"2026-03-03 11:01:14"}}