If you use perimeter = 2(22/7)*radius <= horlics*100 formula then the resedual floating point will cause error and might cause some deviation in the number of toffee in final calculation in big input so instead use perimeter = 44*radius <= horlics*700.
import java.util.*; class TestClass { public static void main(String args[] ) throws Exception { Scanner s = new Scanner(System.in); int day = s.nextInt(); int toffee = 0; for(int i = 0; i<day; i++){ long radius = s.nextLong(); long horlics = s.nextLong(); long distC = 44*radius; long distH = 700*horlics; if(distC <= distH){ toffee++; } } System.out.println(toffee); } }