package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/divisible-sum-pairs
 */
public class DivisibleSumPairs {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int a[] = new int[n];
        for (int a_i = 0; a_i < n; a_i++) {
            a[a_i] = in.nextInt();
        }
    }
}

@@ -143,16 +143,342 @@
 Pairs %7B%0A
+    private static int divisibleSumParis(int%5B%5D a, int k) %7B%0A        int count = 0;%0A        for (int i = 0; i %3C a.length; i++) %7B%0A            for (int j = i + 1; j %3C a.length; j++) %7B%0A                if ((a%5Bi%5D + a%5Bj%5D) %25 k == 0) %7B%0A                    count++;%0A                %7D%0A            %7D%0A        %7D%0A        return count;%0A    %7D%0A%0A
     publ
@@ -734,20 +734,73 @@
 ;%0A        %7D%0A
+        System.out.println(divisibleSumParis(a, k));%0A
     %7D%0A%7D%0A

Solve Divisible Sum Pairs