{"raw_statement":[{"iden":"statement","content":"You are given an integer array $a_1, \\\\dots, a_n$ and an integer array $b_1, \\\\dots, b_n$.\n\nYou have to calculate the array $c_1, \\\\dots, c_n$ defined as follows:\n\n$$c_k = \\max\\limits_{\\gcd(i,j) = k} |a_i - b_j|\\text{.}$$\n\nThe first line of input contains a single integer $n$ ($1 <= n <= 10^5$).\n\nThe second line of input contains $n$ integers $a_1, \\\\dots, a_n$ ($1 <= a_i <= 10^9$).\n\nThe third line of input contains $n$ integers $b_1, \\\\dots, b_n$ ($1 <= b_i <= 10^9$).\n\nOutput $n$ integers $c_1, \\\\dots, c_n$.\n\n"},{"iden":"input","content":"The first line of input contains a single integer $n$ ($1 <= n <= 10^5$).The second line of input contains $n$ integers $a_1, \\\\dots, a_n$ ($1 <= a_i <= 10^9$).The third line of input contains $n$ integers $b_1, \\\\dots, b_n$ ($1 <= b_i <= 10^9$)."},{"iden":"output","content":"Output $n$ integers $c_1, \\\\dots, c_n$."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $, and let $ A = (a_1, \\dots, a_n) $, $ B = (b_1, \\dots, b_n) $ be sequences of integers.  \nDefine $ C = (c_1, \\dots, c_n) $, where for each $ k \\in \\{1, \\dots, n\\} $:  \n\n**Objective**  \n$$\nc_k = \\max_{\\substack{1 \\le i,j \\le n \\\\ \\gcd(i,j) = k}} |a_i - b_j|\n$$","simple_statement":"Given two arrays a and b of length n, for each k from 1 to n, find the maximum absolute difference |a_i - b_j| among all pairs (i,j) where gcd(i,j) = k.","has_page_source":false}