public int getmax(int[] X, int[] Y, int limit)
	{
		int maxCount = 0;
		for (int width = 1; width * width <= limit + 1; width++) {
			int height = (int) Math.ceil(1.0 * limit / width);
			int count = 0;
			for (int i = 0; i < X.length; i++) {
				int x = Math.min(X[i], Y[i]);
				int y = Math.max(X[i], Y[i]);
				if (width <= x && height <= y) {
					count++;
				}
			}
			maxCount = Math.max(count, maxCount);
		}
		if (maxCount == 0) {
			return -1;
		}
		return maxCount;
	}