{"problem":{"name":"Sum of Min of Xor","description":{"content":"Given are sequences of $N$ integers each: $(A_1,A_2,\\cdots,A_N)$ and $(B_1,B_2,\\cdots,B_N)$. Find $\\sum_{1 \\leq i < j \\leq N} \\min(A_i \\oplus A_j, B_i \\oplus B_j)$, where $\\oplus$ denotes the bitwise ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":5000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc127_d"},"statements":[{"statement_type":"Markdown","content":"Given are sequences of $N$ integers each: $(A_1,A_2,\\cdots,A_N)$ and $(B_1,B_2,\\cdots,B_N)$.\nFind $\\sum_{1 \\leq i < j \\leq N} \\min(A_i \\oplus A_j, B_i \\oplus B_j)$, where $\\oplus$ denotes the bitwise XOR.\n\n## Constraints\n\n*   $1 \\leq N \\leq 250000$\n*   $0 \\leq A_i,B_i < 2^{18}$\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$ $A_2$ $\\cdots$ $A_N$\n$B_1$ $B_2$ $\\cdots$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc127_d","tags":[],"sample_group":[["3\n1 2 3\n4 5 6","4\n\n*   $\\min(1 \\oplus 2, 4 \\oplus 5)=\\min(3,1)=1$\n*   $\\min(1 \\oplus 3, 4 \\oplus 6)=\\min(2,2)=2$\n*   $\\min(2 \\oplus 3, 5 \\oplus 6)=\\min(1,3)=1$\n\nThus, the answer is $1+2+1=4$."],["4\n1 2 3 4\n1 2 3 4","24"],["10\n195247 210567 149398 9678 23694 46151 187762 17915 176476 249828\n68649 128425 249346 62366 194119 117620 26327 161384 207 57656","4019496"]],"created_at":"2026-03-03 11:01:14"}}