@@ -0,0 +1,1328 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0A/**%0A*   Solution to https://www.hackerrank.com/challenges/candies%0A*/%0Apublic class Solution %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A%0A        long children = read(in);%0A%0A        long%5B%5D ratings = new long%5B(int)children%5D;%0A        long%5B%5D candies = new long%5B(int)children%5D;%0A%0A        for (int i = 0; i %3C children; i++) %7B%0A            ratings%5Bi%5D = read(in);%0A            candies%5Bi%5D = 1;%0A        %7D%0A%0A        long total = children; //one per kid%0A%0A        for (int i = 0; i %3C candies.length; i++) %7B%0A            //kid on the right%0A            if (i %3C candies.length - 1 &&%0A                ratings%5Bi%5D %3E ratings%5Bi + 1%5D && candies%5Bi%5D %3C= candies%5Bi + 1%5D)%0A            %7B%0A                candies%5Bi%5D++;%0A                total++;%0A                i = Math.max(i - 2, 0);%0A            %7D%0A%0A            //kid on the left%0A            if (i %3E 0 &&%0A                ratings%5Bi%5D %3E ratings%5Bi - 1%5D && candies%5Bi%5D %3C= candies%5Bi - 1%5D)%0A            %7B%0A                candies%5Bi%5D++;%0A                total++;%0A                i = Math.max(i - 2, 0);%0A            %7D%0A        %7D%0A%0A        System.out.println(total);%0A    %7D%0A%0A    private static long read(Scanner in) %7B%0A        return Long.parseLong(in.nextLine().trim());%0A    %7D%0A%7D%0A

Create candies.java