package ycoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class CircleLatticePoint { public static void main(String... string) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tmp = br.readLine().split(" "); int rMin = Integer.parseInt(tmp[0]); int rMax = Integer.parseInt(tmp[1]); ArrayList latticePointList = new ArrayList<>(); CircleLatticePoint clp = new CircleLatticePoint(); for(int r = rMin; r <= rMax; r++) { latticePointList.add(clp.getLatticePoint(r)); } latticePointList.stream() .sorted((a,b) -> b - a); int maxLatticePoint = latticePointList.get(0); System.out.println(maxLatticePoint); } public int getLatticePoint(int r) { int result = 0; for(int x = -1 * r; x <= r; x++) { for(int y = -1 * r; y <= r; y++) { if(r == x*x + y*y) { result++; } } } return result; } }