@@ -0,0 +1,1493 @@
+import java.util.HashSet;%0Aimport java.util.Scanner;%0Aimport java.util.Set;%0A%0A/**%0A * Created by szewczm1 on 9/16/2015.%0A */%0Apublic class SolutionTaskOne %7B%0A    public static void main(String%5B%5D param) %7B%0A        Scanner s = new Scanner(System.in);%0A        int N = s.nextInt();%0A        if (N %3C 0) %7B%0A            throw new IllegalArgumentException();%0A        %7D%0A        // eat white spaces%0A        s.nextLine();%0A        int%5B%5D%5B%5D tab = new int%5BN%5D%5B%5D;%0A        for (int i = 0; i %3C N; i++) %7B%0A            final String l = s.nextLine();%0A            String%5B%5D ints = l.split(%22%5C%5Cs+%22);%0A            tab%5Bi%5D = new int%5Bints.length%5D;%0A            for (int j = 0; j %3C ints.length; j++) %7B%0A                tab%5Bi%5D%5Bj%5D = Integer.parseInt(ints%5Bj%5D);%0A            %7D%0A        %7D%0A%0A        int k = s.nextInt();%0A%0A        for (int i = 0; i %3C N; i++) %7B%0A            for (int j = 0; j %3C tab%5Bi%5D.length; j++) %7B%0A                if (hasDuplicate(tab, i, j, k, N)) %7B%0A                    System.out.print(%22YES%22);%0A                    return;%0A                %7D%0A            %7D%0A        %7D%0A%0A        System.out.print(%22NO%22);%0A    %7D%0A%0A    private static boolean hasDuplicate(final int%5B%5D%5B%5D tab, final int i, final int j, final int k, final int n) %7B%0A        final Set%3CInteger%3E s = new HashSet%3C%3E();%0A        for (int a = i; a %3C i + k && a %3C n; a++) %7B%0A            for (int b = j; b %3C j + k && b %3C tab%5Bi%5D.length; b++) %7B%0A                if (!s.add(tab%5Ba%5D%5Bb%5D)) %7B%0A                    return true;%0A                %7D%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

Create SolutionTaskOne.java