@@ -0,0 +1,2052 @@
+//https://www.hackerrank.com/challenges/xor-and-sum%0Aimport java.io.*;%0Aimport java.util.*;%0A%0Apublic class Solution %7B%0A    %0A    final private static int MAX_I = 314159;%0A    final private static int MOD = 1000000007;%0A    %0A    public static void main(String%5B%5D args) throws IOException %7B%0A        %0A        //INPUT%0A        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A        byte%5B%5D A = toByteArray(br.readLine().toCharArray());%0A        byte%5B%5D B = toByteArray(br.readLine().toCharArray());%0A        br.close();%0A        br = null;%0A        %0A        reverse(A);%0A        reverse(B);%0A        %0A        //SOLVE%0A        long sum = 0L;%0A        A = extend(A, B.length);%0A        B = extend(B, A.length);%0A        final int len = A.length;%0A        %0A        int i;%0A        long pow = 1L;%0A        int oneCount = 0;%0A        %0A        for(i = 0; i %3C len; ++i)%7B%0A            oneCount += B%5Bi%5D;%0A            int multiplier = (A%5Bi%5D == 0) ? oneCount : MAX_I - oneCount + 1;%0A            sum = (sum + pow*multiplier) %25 MOD;%0A            pow = (pow %3C%3C 1L) %25 MOD;%0A        %7D%0A        %0A        while (i %3C MAX_I)%7B%0A            ++i;%0A            sum = (sum + pow*oneCount) %25 MOD;%0A            pow = (pow %3C%3C 1L) %25 MOD;%0A        %7D%0A        %0A        for(i = 0; i %3C len; ++i)%7B%0A            sum = (sum + pow*oneCount) %25 MOD;%0A            pow = (pow %3C%3C 1L) %25 MOD;%0A            oneCount -= B%5Bi%5D;%0A        %7D%0A        %0A        //OUTPUT%0A        System.out.print(sum);%0A    %7D%0A    %0A    private static byte%5B%5D toByteArray(final char%5B%5D arr)%7B%0A        final int n = arr.length;%0A        final byte%5B%5D ret = new byte%5Bn%5D;%0A        for(int i = 0; i %3C n; ++i)%7B%0A            ret%5Bi%5D = (byte)(arr%5Bi%5D - '0');%0A        %7D%0A        return ret;%0A    %7D%0A    %0A    private static void reverse(final byte%5B%5D arr)%7B%0A        for(int i = 0, j = arr.length - 1; i %3C j; ++i, --j)%7B%0A            final byte c = arr%5Bi%5D;%0A            arr%5Bi%5D = arr%5Bj%5D;%0A            arr%5Bj%5D = c;%0A        %7D%0A    %7D%0A    %0A    private static byte%5B%5D extend(final byte%5B%5D arr, final int n)%7B%0A        return (arr.length %3E= n) ? arr : Arrays.copyOf(arr, n);%0A    %7D%0A%7D%0A

Create xor-and-sum.java