import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.NoSuchElementException; public class Main{ public static void main(String[] args) { new Main().run(); } class DJSet { int n; int[] upper,left,right; public DJSet(int n) { this.n=n; upper=new int[n]; left=new int[n]; right=new int[n]; Arrays.fill(upper, -1); for (int i=0;ib) return; while (right(a)1) { int m=(ok+ng)/2; if (a[m] Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }