{"raw_statement":[{"iden":"problem statement","content":"Given is a sequence $A = [a_0, a_1, a_2, \\dots, a_{N-1}]$ that is a permutation of $0, 1, 2, \\dots, N - 1$.  \nFor each $k = 0, 1, 2, \\dots, N - 1$, find the inversion number of the sequence $B = [b_0, b_1, b_2, \\dots, b_{N-1}]$ defined as $b_i = a_{i+k \\bmod N}$.\nWhat is inversion number? The inversion number of a sequence $A = [a_0, a_1, a_2, \\dots, a_{N-1}]$ is the number of pairs of indices $(i, j)$ such that $i < j$ and $a_i > a_j$."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $2 ≤ N ≤ 3 \\times 10^5$\n*   $a_0, a_1, a_2, \\dots, a_{N-1}$ is a permutation of $0, 1, 2, \\dots, N - 1$."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$a_0$ $a_1$ $a_2$ $\\cdots$ $a_{N-1}$"},{"iden":"sample input 1","content":"4\n0 1 2 3"},{"iden":"sample output 1","content":"0\n3\n4\n3\n\nWe have $A = [0, 1, 2, 3]$.\nFor $k = 0$, the inversion number of $B = [0, 1, 2, 3]$ is $0$.  \nFor $k = 1$, the inversion number of $B = [1, 2, 3, 0]$ is $3$.  \nFor $k = 2$, the inversion number of $B = [2, 3, 0, 1]$ is $4$.  \nFor $k = 3$, the inversion number of $B = [3, 0, 1, 2]$ is $3$."},{"iden":"sample input 2","content":"10\n0 3 1 5 4 2 9 6 8 7"},{"iden":"sample output 2","content":"9\n18\n21\n28\n27\n28\n33\n24\n21\n14"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}