2	public class Main {  class IOManager {   BufferedReader reader;   PrintWriter writer;   StringTokenizer tokenizer;   IOManager() {    reader = new BufferedReader(new InputStreamReader(System.in));    writer = new PrintWriter(new BufferedOutputStream(System.out));   }   IOManager(String file) throws FileNotFoundException {    reader = new BufferedReader(new FileReader(file));    writer = new PrintWriter(new BufferedOutputStream(System.out));   }   String next() throws IOException {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     String line = reader.readLine();     if (line == null)      throw new IOException("No lines left.");     tokenizer = new StringTokenizer(line);    }    return tokenizer.nextToken();   }   public Integer nextInt() throws IOException {    return Integer.parseInt(next());   }   public Long nextLong() throws IOException {    return Long.parseLong(next());   }   public Double nextDouble() throws IOException {    return Double.parseDouble(next());   }   public void writeSpace(Object obj) {    writer.print(obj.toString() + " ");   }   public void writeLine(Object obj) {    writer.println(obj.toString());   }   public void writeDouble(Double x, int n) {    String format = "%." + n + "f";    writer.printf(format, x);   }   public void write(Object obj) {    writer.print(obj.toString());   }   public void close() {    writer.close();   }  }  class Pair implements Comparable {   public long u, v;   public Pair(long u, long v) {    this.u = u;    this.v = v;   }   @Override   public int compareTo(Object o) {    Pair that = (Pair) o;    if (Long.compare(u, that.u) != 0)     return Long.compare(u, that.u);    return Long.compare(v, that.v);   }  }  class Graph {   public int n, m;   public List<Integer>[] adj;   public Graph(int n, int m) {    this.n = n;    this.m = m;    adj = new List[n + 1];    for (int i = 0; i <= n; ++i) {     adj[i] = new ArrayList<>();    }   }   public void add(int u, int v) {    adj[u].add(v);   }   public void add2Ways(int u, int v) {    add(u, v);    add(v, u);   }   public void dfs(int i, boolean fr[]) {    fr[i] = false;    for (int j: adj[i]) {     if (fr[j]) {      dfs(j, fr);     }    }   }   public boolean isConnected() {    boolean fr[] = new boolean[n + 1];    Arrays.fill(fr, true);    dfs(1, fr);    for (int i = 2; i <= n; ++i) {     if (fr[i])      return false;    }    return true;   }   public boolean hasEuclideanPath() {    if (!isConnected())     return false;    int cnt = 0;    for (int i = 1; i <= n; ++i) {     if (adj[i].size() % 2 == 1)      cnt++;    }    return cnt <= 2;   }   public boolean dfsHamiltonian(int i, boolean[] fr, int reached) {    fr[i] = false;    reached++;    if (reached == n)     return true;    for (int j: adj[i]) {     if (fr[j]) {      if (dfsHamiltonian(j, fr, reached))       return true;     }    }    fr[i] = true;    return false;   }   public boolean hasHamiltonianPathFrom(int st) {    boolean fr[] = new boolean[n + 1];    Arrays.fill(fr, true);    return dfsHamiltonian(st, fr, 0);   }  }    class Tree extends Graph {   public Tree(int n, int m) {    super(n, m);   }   public int getHeight(int i) {    int res = 0;    for (Integer j: adj[i]) {     res = Math.max(res, getHeight(j) + 1);    }    return res;   }  }  class FenwickTree {   int n;   int tree[];   public FenwickTree() {   }   public FenwickTree(int maxn) {    n = maxn;    tree = new int[maxn + 10];   }   public void add(int i, int x) {    while (i <= n) {     tree[i] += x;     i += i & (-i);    }   }   public void add(int i) {    add(i, 1);   }   public int get(int i) {    int res = 0;    while (i > 0) {     res += tree[i];     i -= i & (-i);    }    return res;   }  }  IOManager ioManager;  Main() {   ioManager = new IOManager();  }  Main(String file) throws FileNotFoundException {   ioManager = new IOManager(file);  }  long n, s;  int m, a[], sum[];  long pow[];  long f[][];  void doi(long n) {   m = 0;   while (n > 0) {    a[m++] = (int) (n % 10L);    n /= 10L;   }  }  int getsum(long n) {   int res = 0;   while (n > 0) {    res += (int) (n % 10L);    n /= 10L;   }   return res;  }  void solve() throws IOException {   n = ioManager.nextLong();   s = ioManager.nextLong();   a = new int[100];   pow = new long[100];   pow[0] = 1;   for (int i = 1; i < 100; ++i) {    pow[i] = pow[i - 1] * 10L;   }   doi(n);   sum = new int[m + 1];   sum[m] = 0;   for (int i = m - 1; i >= 0; --i)    sum[i] = sum[i + 1] + a[i];    long first = -1;   for (long i = s + 1; i <= n; ++i) {    if (i - getsum(i) >= s) {     first = i;     break;    }   }   if (first == -1) {    ioManager.writeLine(0);    return;   }   ioManager.writeLine(n - first + 1);  }  void close() {   ioManager.close();  }  public static void main(String args[]) throws IOException {   Main solver;   if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {    solver = new Main("input.txt");   } else {    solver = new Main();   }   solver.solve();   solver.close();  } }
6	public class MainC {  private FastScanner in;  private PrintWriter out;  private int N;  private Dist[] dists;  private int countDists;  private int[][] minLeft;  private int[] minOrder;  private int minOrderCount = 10000000;  public void solve() throws IOException {   int xb = in.nextInt();   int yb = in.nextInt();   N = in.nextInt();   int[] x, y;   boolean isOdd;   if (N % 2 == 0) {    x = new int[N];    y = new int[N];    isOdd = false;   }   else {    x = new int[N + 1];    y = new int[N + 1];    isOdd = true;   }   for (int i = 0; i < N; i++) {    x[i] = in.nextInt() - xb;    y[i] = in.nextInt() - yb;   }   if (N % 2 == 1) {    N++;    x[N - 1] = 0;    y[N - 1] = 0;   }   countDists = N * (N - 1) / 2;   dists = new Dist[countDists];   int c = 0;   int commonSum = 0;   for (int i = 0; i < N; i++) {    for (int j = i + 1; j < N; j++) {     dists[c] = new Dist();     dists[c].from = i;     dists[c].to = j;     dists[c].dist = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j])         * (y[i] - y[j]);     dists[c].dist = Math.min(dists[c].dist, x[i] * x[i] + y[i]         * y[i] + x[j] * x[j] + y[j] * y[j]);     c++;    }    commonSum += x[i] * x[i] + y[i] * y[i];   }   Arrays.sort(dists);   minLeft = new int[countDists][N + 1];   for (int i = 0; i < countDists; i++) {    int sum = 0;    for (int j = 1; j <= N; j++) {     if (i + j - 1 < countDists) {      sum = sum + dists[i + j - 1].dist;      minLeft[i][j] = sum;     }     else {      minLeft[i][j] = 100000000;     }    }   }   order(0, new int[N], 0, 0);   out.println(minOrderCount + commonSum);   for (int i = 1; i <= N / 2; i++) {    int first = -1;    int second = -1;    for (int j = 0; j < N; j++) {     if (minOrder[j] == i) {      if (first == -1) {       first = j;      }      else {       second = j;      }     }    }    if (isOdd && (first == N - 1 || second == N - 1)) {     first++;     second++;     out.print("0 " + (first + second - N) + " ");    }    else if (x[first] * x[first] + y[first] * y[first] + x[second]        * x[second] + y[second] * y[second] < (x[first] - x[second])        * (x[first] - x[second])        + (y[first] - y[second])        * (y[first] - y[second])) {     first++;     second++;     out.print("0 " + first + " 0 " + second + " ");    }    else {     first++;     second++;     out.print("0 " + first + " " + second + " ");    }   }   out.println("0");  }  private void order(int countOrdered, int[] order, int startsFrom, int sum) {   if (countOrdered == N) {    if (sum < minOrderCount) {     minOrder = Arrays.copyOf(order, N);     minOrderCount = sum;    }    return;   }   while (startsFrom < countDists) {    if (order[dists[startsFrom].from] == 0        && order[dists[startsFrom].to] == 0) {     if (minLeft[startsFrom][(N - countOrdered) / 2] + sum >= minOrderCount) {      break;     }     order[dists[startsFrom].from] = countOrdered / 2 + 1;     order[dists[startsFrom].to] = countOrdered / 2 + 1;     order(countOrdered + 2, order, startsFrom + 1, sum         + dists[startsFrom].dist);     order[dists[startsFrom].from] = 0;     order[dists[startsFrom].to] = 0;    }    startsFrom++;   }  }  private class Dist implements Comparable<Dist> {   int from;   int to;   int dist;   @Override   public int compareTo(Dist o) {    if (dist < o.dist) {     return -1;    }    if (dist == o.dist) {     return 0;    }    return 1;   }  }  public void run() {   try {    in = new FastScanner(System.in);    out = new PrintWriter(System.out);    solve();    out.close();   }   catch (IOException e) {    e.printStackTrace();   }  }  class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] arg) {   new MainC().run();  } }
1	public class Main { public static void main(String[] args) throws IOException {  try {  if (new File("input.txt").exists()) {   System.setIn(new FileInputStream("input.txt"));  }  } catch (SecurityException e) {  }   new Main().run(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  boolean[] erat = new boolean [1000 + 1]; int[] primes = new int [1000 + 1]; int pNum = 0;  void run() throws IOException {   for (int i = 2; i <= 1000; i++) {  if (!erat[i]) {   primes[pNum++] = i;   for (int j = i * i; j <= 1000; j += i)   erat[j] = true;  }  }   int[] cnt = new int [1000 + 1];  cnt[2] = 0;   for (int i = 3; i <= 1000; i++) {  cnt[i] = cnt[i - 1];  if (!erat[i]) {   int r = i - 1;   for (int j = 1; j < pNum; j++) {   if (r == primes[j - 1] + primes[j]) {    cnt[i]++;    break;   }   }  }  }  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int n = nextInt();  int k = nextInt();   out.println(k <= cnt[n] ? "YES" : "NO");   out.close(); }  String nextToken() throws IOException {  while (!st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }   return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
0	public class Main {   static final double EPS = 1E-6;  double a, v, l, d, w, u;   public void run() {   a = cin.nextDouble();   v = cin.nextDouble();   l = cin.nextDouble();   d = cin.nextDouble();   w = cin.nextDouble();   w = Math.min(w, v);   double s1 = v * v / (2 * a);   double s2 = w * w / (2 * a);   double s3 = s1 - s2;     double cost = 0;   if (d < s2) {    cost += Math.sqrt(2 * d / a);    w = cost * a;   } else if (d < s1 + s3) {    u = Math.sqrt(d / a + w * w / (2 * a * a)) * a;    cost = u / a + (u - w) / a;   } else {    cost += v / a;    cost += (v - w) / a;    cost += (d - s3 - s1) / v;   }   d = l - d;   s3 = (v * v - w * w) / (2 * a);   if (d < s3) {    cost += (-w + Math.sqrt(w * w + 2 * a * d)) / a;   } else {    cost += (v - w) / a;    cost += (d - s3) / v;   }   out.println(cost);  }  public static void main(String[] args) throws IOException {   Main sloved = new Main();   sloved.run();   sloved.out.close();  }  Scanner cin = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out); }
1	public class Main {  StreamTokenizer in;   PrintWriter out;  public static void main(String[] args) throws IOException {   new Main().run();  }  int ni() throws IOException {   in.nextToken(); return (int)in.nval;  }  void run() throws IOException {     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(new OutputStreamWriter(System.out));     int cprime = 0;   int[] prime = new int[1000];   for(int i = 2; i < 1001; i++) {    boolean f = false;    for(int j = 2; j*j <= i; j++)     if(i % j == 0) {      f = true; break;     }    if(!f) prime[cprime++] = i;   }   int n = ni(), k = ni();   int last = 0;   int count = 0;   for(int i = 0; i < cprime && prime[i] <= n; i++) {    for(int j = 0; j < cprime - 1; j++)     if(prime[j] + prime[j + 1] + 1 == prime[i]) {      count++; break;     }     else if(prime[j] + prime[j + 1] + 1 > prime[i]) break;   }   if(count >= k) out.print("YES");   else out.print("NO");   out.flush();  } }
1	public class TwoSets {  static ArrayList<Integer> g[]; static boolean visited[]; static int ans[],p[],orig[]; static int n,a,b;  @SuppressWarnings("unchecked") public static void main(String args[] ) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter w = new PrintWriter(System.out);     StringTokenizer st1 = new StringTokenizer(br.readLine());  n = ip(st1.nextToken());  a = ip(st1.nextToken());  b = ip(st1.nextToken());    g = new ArrayList[n];  visited = new boolean[n];  ans = new int[n];  p = new int[n];  orig = new int[n];    StringTokenizer st2 = new StringTokenizer(br.readLine());  for(int i=0;i<n;i++){   p[i] = ip(st2.nextToken());   orig[i] = p[i];   g[i] = new ArrayList<Integer>();  }    Arrays.sort(p);    boolean impossible = false;    for(int i=0;i<n;i++){   int i1 = Arrays.binarySearch(p, a-p[i]);   int i2 = Arrays.binarySearch(p, b-p[i]);   if(i1 < 0 || i1 >= n) i1 = -1;   if(i2 < 0 || i2 >= n) i2 = -1;     if(i1 == -1 && i2 != -1)    g[i].add(i2);     else if(i1 != -1 && i2 == -1)    g[i].add(i1);     else if(i1 != -1 && i2 != -1){    g[i].add(i1);   g[i].add(i2);   }   else{    impossible = true;   break;   }  }    if(impossible){   System.out.println("NO");   return;  }            LinkedList<Integer> q = new LinkedList();  for(int i=0;i<n;i++){     if(visited[i] == false){      ArrayList<Integer> curq = new ArrayList<Integer>();        curq.add(i);   q.add(i);   visited[i] = true;     while(!q.isEmpty()){    int curr = q.remove();    int s = g[curr].size();    for(int j=0;j<s;j++){    if(!visited[g[curr].get(j)]){     visited[g[curr].get(j)] = true;     curq.add(g[curr].get(j));     q.add(g[curr].get(j));    }    }   }     boolean found = true;      int s = curq.size();   int temp[] = new int[s];   for(int j=0;j<s;j++)    temp[j] = p[curq.get(j)];   Arrays.sort(temp);      int anss = -1;      for(int j=0;j<s;j++){    int i3 = Arrays.binarySearch(temp, a - temp[j]);    if(i3 < 0 || i3 >= n){     found = false;     break;    }    }       if(!found){    found = true;        for(int j=0;j<s;j++){    int i3 = Arrays.binarySearch(temp, b - temp[j]);     if(i3 < 0 || i3 >= n){     found = false;     break;     }    }       if(found)    anss = 1;    else{    impossible = true;    break;    }          }   else    anss = 0;      for(int j=0;j<s;j++)    ans[curq.get(j)] = anss;     }       }    if(!impossible){   w.println("YES");   for(int i=0;i<n;i++){   int i1 = Arrays.binarySearch(p, orig[i]);   if(ans[i1] == -1) ans[i1] = 1;   w.print(ans[i1] + " ");   }   w.println();  }  else   w.println("NO");    w.close();  }  public static int ip(String s){  return Integer.parseInt(s); } }
5	public class A {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  class Pointd implements Comparable<Pointd>{   int x, in;   @Override   public int compareTo(Pointd o) {    if(x > o.x) return 1;    if(x < o.x) return -1;    if(in < o.in) return -1;    if(in > o.in) return 1;    return 0;   }   public Pointd(int x, int in) {    super();    this.x = x;    this.in = in;   }  }   void solve() throws IOException {   int n = readInt();   Pointd[] a = new Pointd[n];   for(int i = 0; i < n; i++){    a[i] = new Pointd(readInt(), i);   }   Arrays.sort(a);     int count = 0;   for(int i = 0; i < n; i++){    if(a[i].x != a[a[i].in].x) count++;   }   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }    void init() throws FileNotFoundException {   if (ONLINE_JUDGE) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   } else {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  int[] readArr(int n) throws IOException {   int[] res = new int[n];   for (int i = 0; i < n; i++) {    res[i] = readInt();   }   return res;  }  long[] readArrL(int n) throws IOException {   long[] res = new long[n];   for (int i = 0; i < n; i++) {    res[i] = readLong();   }   return res;  }  public static void main(String[] args) {   new A().run();  }  public void run() {   try {    long t1 = System.currentTimeMillis();    init();    solve();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time = " + (t2 - t1));   } catch (Exception e) {    e.printStackTrace(System.err);    System.exit(-1);   }  } }
6	public class Main {  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  private void solution() throws IOException {  int sx = in.nextInt();  int sy = in.nextInt();  int n = in.nextInt();  int[] x = new int[n];  int[] y = new int[n];  for (int i = 0; i < n; ++i) {  x[i] = in.nextInt();  y[i] = in.nextInt();  }  int[] dp = new int[1 << n];  int[] prev = new int[1 << n];  Arrays.fill(dp, Integer.MAX_VALUE / 2);  dp[0] = 0;  prev[0] = -1;  for (int mask = 0; mask < (1 << n); ++mask) {  if (dp[mask] != Integer.MAX_VALUE / 2) {   for (int next = 0; next < n; ++next) {   if (((mask >> next) & 1) == 0) {    int nmask = mask | (1 << next);    int val = dp[mask] + 2 * getDist(sx, sy, x[next], y[next]);    if (dp[nmask] > val) {    dp[nmask] = val;    prev[nmask] = mask;    }    for (int next2 = next + 1; next2 < n; ++next2) {    if (((nmask >> next2) & 1) == 0) {     int nnmask = nmask | (1 << next2);     int nval = dp[mask] + getDist(sx, sy, x[next], y[next])        + getDist(x[next], y[next], x[next2], y[next2])       + getDist(x[next2], y[next2], sx, sy);     if (dp[nnmask] > nval) {     dp[nnmask] = nval;     prev[nnmask] = mask;     }    }    }    break;   }   }  }  }  List<Integer> res = new ArrayList<Integer>();  res.add(0);  int mask = (1 << n) - 1;  while (mask > 0) {  for (int i = 0; i < n; ++i) {   if (((prev[mask] >> i) & 1) == 0 && ((mask >> i) & 1) == 1) {   res.add(i + 1);   }  }  res.add(0);  mask = prev[mask];  }  Collections.reverse(res);  out.println(dp[(1 << n) - 1]);  for (int i = 0; i < res.size(); ++i) {  if (i != 0) {   out.print(" ");  }  out.print(res.get(i));  }  out.println();  out.flush(); }  private int getDist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); }  private class Scanner {  private StringTokenizer tokenizer;  private BufferedReader reader;  public Scanner(Reader in) {  reader = new BufferedReader(in);  tokenizer = new StringTokenizer("");  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String tmp = reader.readLine();   if (tmp == null)   return false;   tokenizer = new StringTokenizer(tmp);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  } }  public static void main(String[] args) throws IOException {  new Main().solution(); } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   qsort(b);     int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   void qsort(int[] a)  {   List<Integer> as = new ArrayList<Integer>();   for(int x : a) as.add(x);   Collections.shuffle(as);   int j = 0;   for(int x : as) a[j++] = x;   sort(a);  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   String next() throws IOException  {   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());   return st.nextToken();  }   int nextInt() throws IOException  {   return Integer.parseInt(next());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   BufferedReader input;  PrintWriter out;  StringTokenizer st;  int test;   void init() throws IOException  {   if(TEST) input = new BufferedReader(new FileReader(file + ".in"));   else input = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedOutputStream(System.out));  }   public static void main(String[] args) throws IOException  {   new Thread(null, new A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
1	public class B {  void solve() throws IOException {   in = new InputReader("__std");   out = new OutputWriter("__std");   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   int ma = 0;   int mb = 1;   if (a < b) {    int t = a; a = b; b = t;    t = ma; ma = mb; mb = t;   }   final int[] p = new int[n];   Integer id[] = new Integer[n];   Map<Integer, Integer> pos = new HashMap<Integer, Integer>();   for (int i = 0; i < n; ++i) {    p[i] = in.readInt();    id[i] = i;    pos.put(p[i], i);   }   Arrays.sort(id, new Comparator<Integer>() {    public int compare(Integer i, Integer j) {     return p[i] - p[j];    }   });   int[] mask = new int[n];   Arrays.fill(mask, -1);   boolean flag = true;   for (int i = 0; i < n && flag; ++i) {    if (mask[id[i]] == -1) {     if (p[id[i]] < a) {      if (pos.containsKey(a - p[id[i]])) {       int j = pos.get(a - p[id[i]]);       if (mask[j] != mb) {        mask[id[i]] = mask[j] = ma;        continue;       }      }      if (p[id[i]] < b && pos.containsKey(b - p[id[i]])) {       int j = pos.get(b - p[id[i]]);       if (mask[j] != ma) {        mask[id[i]] = mask[j] = mb;        continue;       }      }     }     flag = false;    }   }   if (flag) {    out.println("YES");    for (int m : mask) {     out.print(m + " ");    }   } else {    out.println("NO");   }   exit();  }  void exit() {     out.close();   System.exit(0);  }  InputReader in;  OutputWriter out;    public static void main(String[] args) throws IOException {   new B().solve();  }  class InputReader {   private InputStream stream;   private byte[] buffer = new byte[1024];   private int pos, len;   private int cur;   private StringBuilder sb = new StringBuilder(32);   InputReader(String name) throws IOException {    if (name.equals("__std")) {     stream = System.in;    } else {     stream = new FileInputStream(name);    }    cur = read();   }   private int read() throws IOException {    if (len == -1) {     throw new EOFException();    }    if (pos >= len) {     pos = 0;     len = stream.read(buffer);     if (len == -1) return -1;    }    return buffer[pos++];   }   char readChar() throws IOException {    if (cur == -1) {     throw new EOFException();    }    char res = (char) cur;    cur = read();    return res;   }   int readInt() throws IOException {    if (cur == -1) {     throw new EOFException();    }    while (whitespace()) {     cur = read();    }    if (cur == -1) {     throw new EOFException();    }    int sign = 1;    if (cur == '-') {     sign = -1;     cur = read();    }    int res = 0;    while (!whitespace()) {     if (cur < '0' || cur > '9') {      throw new NumberFormatException();     }     res *= 10;     res += cur - '0';     cur = read();    }    return res * sign;   }   long readLong() throws IOException {    if (cur == -1) {     throw new EOFException();    }    return Long.parseLong(readToken());   }   double readDouble() throws IOException {    if (cur == -1) {     throw new EOFException();    }    return Double.parseDouble(readToken());   }   String readLine() throws IOException {    if (cur == -1) {     throw new EOFException();    }    sb.setLength(0);    while (cur != -1 && cur != '\r' && cur != '\n') {     sb.append((char) cur);     cur = read();    }    if (cur == '\r') {     cur = read();    }    if (cur == '\n') {     cur = read();    }    return sb.toString();   }   String readToken() throws IOException {    if (cur == -1) {     throw new EOFException();    }    while (whitespace()) {     cur = read();    }    if (cur == -1) {     throw new EOFException();    }    sb.setLength(0);    while (!whitespace()) {     sb.append((char) cur);     cur = read();    }    return sb.toString();   }   boolean whitespace() {    return cur == ' ' || cur == '\t' || cur == '\r' || cur == '\n' || cur == -1;   }   boolean eof() {    return cur == -1;   }  }  class OutputWriter {   private PrintWriter writer;   OutputWriter(String name) throws IOException {    if (name.equals("__std")) {     writer = new PrintWriter(System.out);    } else {     writer = new PrintWriter(name);    }   }   void print(String format, Object ... args) {    writer.print(new Formatter(Locale.US).format(format, args));   }   void println(String format, Object ... args) {    writer.println(new Formatter(Locale.US).format(format, args));   }   void print(Object value) {    writer.print(value);   }   void println(Object value) {    writer.println(value);   }   void println() {    writer.println();   }   void close() {    writer.close();   }  } }
2	public class Main {  boolean[] b;  int[] r;  ArrayList<ArrayList<Integer>> q;  public void dfs(int u, int p) {   for (int i = 0; i < q.get(u).size(); i++) {    int v = q.get(u).get(i);    if (v != p) {     r[v] = r[u] + 1;     if (b[u]) {      b[v] = b[u];     }     dfs(v, u);    }   }  }  public void solve() throws IOException {   long n = nextLong();   long s = nextLong();   long t = 0;   if(s + 200 < n){    t = n - s - 200;   }   for(long i = s; i <= Math.min(s + 200,n); i++){    long p = 0;    long u = i;    while (u > 0){     p += u % 10;     u /= 10;    }    if(i - p >= s){     t++;    }   }   out.print(t);  }  BufferedReader br;  StringTokenizer sc;  PrintWriter out;  public String nextToken() throws IOException {   while (sc == null || !sc.hasMoreTokens()) {    try {     sc = new StringTokenizer(br.readLine());    } catch (Exception e) {     return null;    }   }   return sc.nextToken();  }  public Integer nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public Long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static void main(String[] args) throws IOException {   try {    Locale.setDefault(Locale.US);   } catch (Exception e) {   }   new Main().run();  }  public void run() {   try {    br = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);     solve();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  } }
4	public class CompressionAndExpansion {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int T = in.nextInt();   for (int t = 0; t < T; t++) {    int N = in.nextInt();    List<Integer> list = new ArrayList<>();    for (int i = 0; i < N; i++) {     int n = in.nextInt();     if (n == 1) {      list.add(n);     } else {      for (int j = list.size() - 1; j >= 0; j--) {       if (list.get(j) == n - 1) {        list.set(j, n);        break;       }       list.remove(j);      }     }     for (int j = 0; j < list.size(); j++) {      System.out.print(list.get(j) + (j == list.size() - 1 ? "\n" : "."));     }    }   }  } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni(), m = ni(), K = ni();  int[] a = na(n);  a = radixSort(a);   if(K >= m){  out.println(0);  return;  }  int p = 1;  for(int i = n-1;i >= 0;i--){  K += a[i]-1;  if(K >= m){   out.println(p);   return;  }  p++;  }  out.println(-1); }  public static int[] radixSort(int[] f) {  int[] to = new int[f.length];  {  int[] b = new int[65537];  for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;  for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];  for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];  int[] d = f; f = to;to = d;  }  {  int[] b = new int[65537];  for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;  for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];  for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];  int[] d = f; f = to;to = d;  }  return f; }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new A().run(); }  private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
2	public class Main {  private final static int Max = (int) (1e5 + 10); private static long n,s;  public static void main(String[] args) {  InitData();  GetAns(); }  private static void InitData() {  Scanner cin = new Scanner(System.in);  n=cin.nextLong();  s=cin.nextLong(); }; private static void GetAns() {  long i;  long ans=0;  for(i=s;i<=n;i++){    long k=i-sum(i);  if(k>=s){   if(i%10==9){   break;   }   ans++;  }  }  if(n>=s){  System.out.println(ans-i+n+1);  }else{  System.out.println(0);  } }; private static long sum(long ans){  long sum=0;  while(ans>0){  sum+=(ans%10);  ans/=10;  }  return sum; } }
2	public class Main {  private static Reader in;  private static PrintWriter out;  public static void main(String args[]) throws IOException {   in = new Reader();   out = new PrintWriter(System.out);   long n = in.nextLong();   long s = in.nextLong();   long low = 0, mid = 0, high = n;   while (low <= high) {    mid = (low + high) / 2;    if (func(mid, s)) {     high = mid - 1;    }    else {     low = mid + 1;    }   }   out.println(n - low + 1);   out.close();  }  private static boolean func(long num, long s) {   long sum = 0, temp = num;   while (temp > 0) {    sum += (temp) % 10;    temp /= 10;   }   return ((num - sum) >= s);  }  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;   public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String next() throws IOException {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == ' ' || c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public String nextLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
1	public class B {  private void solve() throws IOException {   int n = nextInt();   int k = nextInt();     int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = nextInt();     int[] f = new int[100000 + 2];     int min = Integer.MAX_VALUE;   int cur = 0;   int start = 0;   int from = -1, to = -1;     for (int i = 0; i < n; i++) {    f[a[i]]++;    if (f[a[i]] == 1) cur++;    if (cur == k) {     while (f[a[start]] > 1) {      f[a[start]]--;      start++;     }     if (i - start + 1 < min) {      min = i - start + 1;      from = start;      to = i;     }    }   }   pl(from == -1 ? "-1 -1" : ((1 + from) + " " + (1 + to)));  }  public static void main(String[] args) {   new B().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  BigInteger nextBigInteger() throws IOException {   return new BigInteger(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  void p(Object... objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.flush();    writer.print(objects[i]);    writer.flush();   }  }  void pl(Object... objects) {   p(objects);   writer.flush();   writer.println();   writer.flush();  }  int cc;  void pf() {   writer.printf("Case #%d: ", ++cc);   writer.flush();  } }
4	public class Main { public static void main (String[] args) throws Exception {  final long mod=(long) (1e9+7);  final long mod1=(long) 998244353;  Reader s=new Reader();  PrintWriter pt=new PrintWriter(System.out);    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int T=s.nextInt();   while(T-->0)  {   int n=s.nextInt();   int arr[]=new int[n];   int brr[]=new int[n];   int e=-1;   for(int i=0;i<n;i++) {   arr[i]=s.nextInt();   if(e==-1) {    brr[e+1]=arr[i];    e++;   }   else {    if(arr[i]==1) {    e++;    brr[e]=arr[i];    }    else {    int j=e;    for(j=e;j>=0;j--) {     if((arr[i]-1)==brr[j])     break;    }    e=j;    brr[e]=arr[i];    }   }   pt.print(brr[0]);   for(int j=1;j<=e;j++) {    pt.print("."+brr[j]);   }   pt.println();   }                  }          pt.close(); }  static boolean allOne(String str) {  for(int i=0;i<str.length();i++) {  if(str.charAt(i)=='0')   return false;  }  return true; }    static boolean isPartition(int arr[], int n) {  int sum = 0;  int i, j;      for (i = 0; i < n; i++)   sum += arr[i];    if (sum % 2 != 0)   return false;    boolean part[][]=new boolean[sum/2+1][n+1];      for (i = 0; i <= n; i++)   part[0][i] = true;      for (i = 1; i <= sum / 2; i++)   part[i][0] = false;      for (i = 1; i <= sum / 2; i++) {   for (j = 1; j <= n; j++) {    part[i][j] = part[i][j - 1];    if (i >= arr[j - 1])     part[i][j] = part[i][j]         || part[i - arr[j - 1]][j - 1];   }  }  return part[sum / 2][n]; }  static int setBit(int S, int j) { return S | 1 << j; }  static int clearBit(int S, int j) { return S & ~(1 << j); }  static int toggleBit(int S, int j) { return S ^ 1 << j; }  static boolean isOn(int S, int j) { return (S & 1 << j) != 0; }  static int turnOnLastZero(int S) { return S | S + 1; }  static int turnOnLastConsecutiveZeroes(int S) { return S | S - 1; }  static int turnOffLastBit(int S) { return S & S - 1; }  static int turnOffLastConsecutiveBits(int S) { return S & S + 1; }  static int lowBit(int S) { return S & -S; }  static int setAll(int N) { return (1 << N) - 1; }  static int modulo(int S, int N) { return (S & N - 1); }   static boolean isPowerOfTwo(int S) { return (S & S - 1) == 0; }  static boolean isWithin(long x, long y, long d, long k) {  return x*k*x*k + y*k*y*k <= d*d; }  static long modFact(long n,    long p)  {  if (n >= p)   return 0;    long result = 1;  for (int i = 1; i <= n; i++)   result = (result * i) % p;    return result;  }  static int sum(int[] arr, int n) {  int inc[]=new int[n+1];  int dec[]=new int[n+1];  inc[0] = arr[0];  dec[0] = arr[0];   for (int i = 1; i < n; i++) {   for (int j = 0; j < i; j++) {    if (arr[j] > arr[i]) {     dec[i] = max(dec[i], inc[j] + arr[i]);    }    else if (arr[i] > arr[j]) {     inc[i] = max(inc[i], dec[j] + arr[i]);    }   }  }  return max(inc[n - 1], dec[n - 1]); } static long nc2(long a) {  return a*(a-1)/2; } public static int numberOfprimeFactors(int n)  {     HashSet<Integer> hs = new HashSet<Integer>();   while (n%2==0)   {    hs.add(2);    n /= 2;   }         for (int i = 3; i <= Math.sqrt(n); i+= 2)   {        while (n%i == 0)    {     hs.add(i);     n /= i;    }   }         if (n > 2)    hs.add(n);   return hs.size();  }  static long gcd(long a, long b)  {   if (b == 0)   return a;   return gcd(b, a % b);  }     static void reverse(int arr[],int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static void reverse(long arr[],int start, int end)  {  long temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }  static boolean isPrime(int n)  {      if (n <= 1) return false;   if (n <= 3) return true;          if (n % 2 == 0 || n % 3 == 0) return false;     for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)    return false;     return true;  }  static int p2(int n) {  int k=0;  while(n>1) {  if(n%2!=0)   return k;  n/=2;  k++;  }  return k; } static boolean isp2(int n) {  while(n>1) {  if(n%2==1)   return false;  n/=2;  }  return true; } static int binarySearch(int arr[], int first, int last, int key){   int mid = (first + last)/2;   while( first <= last ){    if ( arr[mid] < key ){    first = mid + 1;     }else if ( arr[mid] == key ){    return mid;    }else{     last = mid - 1;    }    mid = (first + last)/2;   }   return -1;  }  static void print(int a[][]) {  for(int i=0;i<a.length;i++)  {  for(int j=0;j<a[0].length;j++)   System.out.print(a[i][j]+" ");  System.out.println();  } } static int max (int x, int y) {  return (x > y)? x : y; }  static int search(Pair[] p, Pair pair) {  int l=0, r=p.length;  while (l <= r) {    int m = l + (r - l) / 2;   if (p[m].compareTo(pair)==0)     return m;    if (p[m].compareTo(pair)<0)     l = m + 1;    else    r = m - 1;  }  return -1; } static void pa(int a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void pa(long a[]) {  for(int i=0;i<a.length;i++)  System.out.print(a[i]+" ");  System.out.println();   } static void reverseArray(int arr[],    int start, int end)  {  int temp;     while (start < end)  {   temp = arr[start];   arr[start] = arr[end];   arr[end] = temp;   start++;   end--;  }  }   static boolean isPalindrome(String s) {  int l=s.length();  for(int i=0;i<l/2;i++)  {  if(s.charAt(i)!=s.charAt(l-i-1))   return false;  }  return true; } static long nc2(long n, long m) {  return (n*(n-1)/2)%m; } static long c(long a) {  return a*(a+1)/2; } static int next(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] < target) {     start = mid + 1;    }         else {     ans = mid;     end = mid - 1;    }   }   return ans;  }   static int prev(long[] arr, long target)  {   int start = 0, end = arr.length - 1;     int ans = -1;   while (start <= end) {    int mid = (start + end) / 2;             if (arr[mid] > target) {     end = mid - 1;    }         else {     ans = mid;     start = mid + 1;    }   }   return ans;  }  static long power(long x, long y, long p)  {   long res = 1;   x = x % p;         while (y > 0)   {    if (y % 2 == 1)     res = (res * x) % p;    y = y >> 1;    x = (x * x) % p;   }   return res;  }  static long modInverse(long n, long p)  {   return power(n, p-2, p);  }  static long nCrModP(long n, long r,          long p)  {   if(r>n)   return 0;  if (r == 0)    return 1;   long[] fac = new long[(int) (n+1)];   fac[0] = 1;   for (int i = 1 ;i <= n; i++)    fac[i] = fac[i-1] * i % p;   return (fac[(int) n]* modInverse(fac[(int) r], p)     % p * modInverse(fac[(int) (n-r)], p)          % p) % p;  }  static String reverse(String str) {  return new StringBuffer(str).reverse().toString(); }   static long fastpow(long x, long y, long m)  {   if (y == 0)    return 1;      long p = fastpow(x, y / 2, m) % m;   p = (p * p) % m;     if (y % 2 == 0)    return p;   else    return (x * p) % m;  }   static boolean isPerfectSquare(long l) {  return Math.pow((long)Math.sqrt(l),2)==l; }   static void merge(long[] arr, int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       long L[] = new long [n1];   long R[] = new long [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(int arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static void merge(int arr[], int l, int m, int r)  {      int n1 = m - l + 1;   int n2 = r - m;       int L[] = new int [n1];   int R[] = new int [n2];       for (int i=0; i<n1; ++i)    L[i] = arr[l + i];   for (int j=0; j<n2; ++j)    R[j] = arr[m + 1+ j];           int i = 0, j = 0;       int k = l;   while (i < n1 && j < n2)   {    if (L[i] <= R[j])    {     arr[k] = L[i];     i++;    }    else    {     arr[k] = R[j];     j++;    }    k++;   }       while (i < n1)   {    arr[k] = L[i];    i++;    k++;   }       while (j < n2)   {    arr[k] = R[j];    j++;    k++;   }  }      static void sort(long arr[], int l, int r)  {   if (l < r)   {        int m = (l+r)/2;         sort(arr, l, m);    sort(arr , m+1, r);         merge(arr, l, m, r);   }  }  static class Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a,int b){    this.a=a;     this.b=b;   }    public int compareTo(Pair p){    if(a>p.a)     return 1;    if(a==p.a)     return (b-p.b);    return -1;   }  } static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[128];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  } }
5	public class Solution implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer st;  String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  void solve() throws Exception {  int n = nextInt();  Integer[] a = new Integer[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Integer[] b = a.clone();  Arrays.sort(b);  int d = 0;  for (int i = 0; i < n; i++) {  if (!a[i].equals(b[i])) d++;  }  out.println(d > 2? "NO" : "YES"); }  public void run() {  try {  Locale.setDefault(Locale.UK);  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.close();  } }  public static void main(String[] args) {   (new Solution()).run(); } }
6	public class Main {  public static void main(String[] args) {   try(Scanner in = new Scanner(System.in)) {    int bx = in.nextInt();    int by = in.nextInt();    int n = in.nextInt();    int[][] xy = new int[n][2];    int[] res = new int[1 << n];    int[] last = new int[1 << n];    for (int i = 0; i < n; i++) {     xy[i] = new int[]{in.nextInt(), in.nextInt()};    }    int[] ds = new int[n];    for (int i = 0; i < ds.length; i++) {     ds[i] = time(xy[i][0], xy[i][1], bx, by);    }    int[][] d = new int[n][n];    for (int i = 0; i < d.length; i++) {     for (int j = 0; j < d.length; j++) {      d[i][j] = time(xy[i][0], xy[i][1], xy[j][0], xy[j][1]);     }    }    Arrays.fill(res, Integer.MAX_VALUE);    res[0] = 0;    for (int i = 0; i < (1 << n); i++) {     for (int j = 0; j < n; j++) {      if ((i & mask(j)) != 0) {       if (res[i - mask(j)] + 2*ds[j] < res[i]) {        res[i] = res[i - mask(j)] + 2*ds[j];        last[i] = i - mask(j);       }       for (int k = j + 1; k < n; k++) {        if ((i & mask(k)) != 0) {         if (res[i - mask(k) - mask(j)] + ds[j] + ds[k] + d[j][k] < res[i]) {          res[i] = res[i - mask(k) - mask(j)] + ds[j] + ds[k] + d[j][k];          last[i] = i - mask(j) - mask(k);         }        }       }       break;      }     }    }    int cur = (1 << n) - 1;    System.out.println(res[cur]);    int k = cur;    while (k != 0) {     System.out.print("0 ");     int diff = k - last[k];     for (int i = 0; i < n && diff != 0; i++) {      if (((diff >> i) & 1) != 0) {       System.out.print((i + 1) + " ");       diff -= (1 << i);      }     }     k = last[k];    }    System.out.println("0");   }  }  static int mask(int i) {   return 1 << i;  }  static int time(int x, int y, int x1, int y1) {   return (x - x1)*(x - x1) + (y - y1)*(y - y1);  } }
5	public class Main {  static int n;  static long TotalTime;  static Problem[] problems;  static StringBuilder sb;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   sb = new StringBuilder();   n = sc.nextInt();   TotalTime = sc.nextLong();   problems = new Problem[n];   for (int i = 0; i < n; i++) {    problems[i] = new Problem (sc.nextInt(), sc.nextLong(), i);   }   Arrays.sort(problems);   long num = -1;   long high = n;   long low = 0;   int iter = 0;   while (high - low > 1) {    num = (high + low) / 2;    if (test(num, false)) {     low = num;    }    else {     high = num;    }   }   if (test(high, false))    num = high;   else    num = low;   test(num, true);   System.out.print(sb);  }  public static boolean test (long num, boolean print) {   int count = 0;   long sum = 0L;   if (print) sb.append(num + "\n" + num + "\n");   for (int i = 0; i < n && count < num; i++) {    if (problems[i].a >= num) {     count++;     sum += problems[i].t;     if (print) sb.append((problems[i].index + 1) + " ");    }   }   return (count == num) && (sum <= TotalTime);  }  public static class Problem implements Comparable<Problem> {   int a;   long t;   int index;     public int compareTo(Problem o) {   return Long.compare(t, o.t);   }   public Problem (int a, long t, int index) {    this.a = a;    this.t = t;    this.index = index;   }  }   public static class FastScanner {   BufferedReader br;   StringTokenizer st;   public FastScanner(Reader in) {    br = new BufferedReader(in);   }   public FastScanner() {    this(new InputStreamReader(System.in));   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String readNextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   int[] readIntArray(int n) {    int[] a = new int[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextInt();    }    return a;   }   long[] readLongArray(int n) {    long[] a = new long[n];    for (int idx = 0; idx < n; idx++) {     a[idx] = nextLong();    }    return a;   }  } }
2	public class Main {   public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  long n = scanner.nextLong();  long s = scanner.nextLong();  long l = 0, r = n + 1;  while(r - l > 1) {  long mid = (l + r) / 2;  long k = mid, sum = 0;  while(k != 0) {   sum += k % 10;   k /= 10;  }  if(mid - sum >= s) r = mid; else l = mid;  }  System.out.print(n - r + 1); } }
3	public class BuildIn {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   solve(in, out);   out.close();  }  public static void solve(InputReader in, PrintWriter out) throws IOException  {  int n = in.nextInt();  int[] list = new int[n];  for(int i = 0; i < n; i++)  {   list[i]=in.nextInt();  }    int count = 0;  for(int i = 0; i < n-1; i++)  {   for(int j = i+1; j < n; j++)   {   if(list[j]<list[i])   {    count++;   }   }  }    boolean sta = true;  if(count%2==1) sta = false;    int m = in.nextInt();  for(int i = 0; i <m; i++)  {   int a = in.nextInt();   int b = in.nextInt();   if((b-a)%4==2) sta = !sta;   if((b-a)%4==1) sta = !sta;     if(sta) out.println("even");   else out.println("odd");  } }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;    public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }       public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }    public int nextInt() {    return Integer.parseInt(next());   }      public long nextLong() {    return Long.parseLong(next());   }   } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskD solver = new TaskD();  solver.solve(1, in, out);  out.close(); } } class TaskD {  public void solve(int testNumber, InputReader jin, OutputWriter jout) {   int n = jin.int32();   int a = jin.int32();   int b = jin.int32();    Set<Integer> present = new HashSet<Integer>();   int[] arr = new int[n];   int[] sarr = new int[n];   for(int i = 0; i < n; i++) {    sarr[i] = arr[i] = jin.int32();    present.add(arr[i]);   }   boolean rev = b < a;   if(b < a) {b ^= a; a ^= b; b ^= a; }   Arrays.sort(sarr);   Set<Integer> set1 = new HashSet<Integer>();   Set<Integer> set2 = new HashSet<Integer>();   for(int i = 0; i < n; i++) {    if(set1.contains(sarr)) continue;    if(set2.contains(sarr)) continue;    int comp1 = b - sarr[i];    if(present.contains(comp1)) {     set2.add(sarr[i]);     set2.add(comp1);     present.remove(comp1);    } else {     int comp2 = a - sarr[i];     if(present.contains(comp2)) {      set1.add(sarr[i]);      set1.add(comp2);      present.remove(comp2);     } else {      jout.println("NO");      return;     }    }   }   jout.println("YES");   for(int i = 0; i < n; i++) {    if(i != 0) jout.print(' ');    if(rev) jout.print(set2.contains(arr[i])? 0 : 1);    else jout.print(set1.contains(arr[i])? 0 : 1);   }  } } class InputReader {  private static final int bufferMaxLength = 1024;  private InputStream in;  private byte[] buffer;  private int currentBufferSize;  private int currentBufferTop;  private static final String tokenizers = " \t\r\f\n";   public InputReader(InputStream stream) {   this.in = stream;   buffer = new byte[bufferMaxLength];   currentBufferSize = 0;   currentBufferTop = 0;  }   private boolean refill() {   try {    this.currentBufferSize = this.in.read(this.buffer);    this.currentBufferTop = 0;   } catch(Exception e) {}   return this.currentBufferSize > 0;  }     private Byte readChar() {   if(currentBufferTop < currentBufferSize) {    return this.buffer[this.currentBufferTop++];   } else {    if(!this.refill()) {     return null;    } else {     return readChar();    }   }  }  public String token() {   StringBuffer tok = new StringBuffer();   Byte first;   while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));   if(first == null) return null;   tok.append((char)first.byteValue());   while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {    tok.append((char)first.byteValue());   }   return tok.toString();  }   public Integer int32() throws NumberFormatException {   String tok = token();   return tok == null? null : Integer.parseInt(tok);  }  } class OutputWriter {  private final int bufferMaxOut = 1024;  private PrintWriter out;  private StringBuilder output;  private boolean forceFlush = false;  public OutputWriter(OutputStream outStream) {   out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outStream)));   output = new StringBuilder(2 * bufferMaxOut);  }  public OutputWriter(Writer writer) {   forceFlush = true;   out = new PrintWriter(writer);   output = new StringBuilder(2 * bufferMaxOut);  }  private void autoFlush() {   if(forceFlush || output.length() >= bufferMaxOut) {    flush();   }  }  public void print(Object... tokens) {   for(int i = 0; i < tokens.length; i++) {    if(i != 0) output.append(' ');    output.append(tokens[i]);   }   autoFlush();  }  public void println(Object... tokens) {   print(tokens);   output.append('\n');   autoFlush();  }  public void flush() {   out.print(output);   output.setLength(0);  }  public void close() {   flush();   out.close();  } }
3	public class D {   String INPUT = "4\n" +     "1 2 4 3\n" +     "4\n" +     "1 1\n" +     "1 4\n" +     "1 4\n" +     "2 3";   void solve()   {     final int n = i();     final int[] a = ia(n);     int count = 0 ;     for(int i = 0 ; i<n-1 ; i++)     {       for(int j = i+1; j<n ; j++)       {         if(a[j]<a[i])         {           count++;         }       }     }     final int q = i();     for(int i = 0 ; i<q ; i++)     {       final int l = i(), r=i();       final int mid = (r-l+1)/2;       if(mid%2==0)       {         out.println(count%2==0?"even":"odd");       }       else       {         count++;         out.println(count%2==0?"even":"odd");       }     }    }     void run() throws Exception{     is = oj ? System.in: new ByteArrayInputStream(INPUT.getBytes());         out = new PrintWriter(System.out);     int t = 1;     while(t-->0) solve();     out.flush();   }   public static void main(String[] args)throws Exception {     new D().run();   }   InputStream is;   PrintWriter out;   private byte[] inbuf = new byte[1024];   public int lenbuf = 0, ptrbuf = 0;   private int readByte()   {     if(lenbuf == -1)throw new InputMismatchException();     if(ptrbuf >= lenbuf){       ptrbuf = 0;       try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }       if(lenbuf <= 0)return -1;     }     return inbuf[ptrbuf++];   }   private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }   private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }   private double d() { return Double.parseDouble(s()); }   private char c() { return (char)skip(); }   private String s()   {     int b = skip();     StringBuilder sb = new StringBuilder();     while(!(isSpaceChar(b))){       sb.appendCodePoint(b);       b = readByte();     }     return sb.toString();   }   private char[] sa(int n)   {     char[] buf = new char[n];     int b = skip(), p = 0;     while(p < n && !(isSpaceChar(b))){       buf[p++] = (char)b;       b = readByte();     }     return n == p ? buf : Arrays.copyOf(buf, p);   }   private char[][] nm(int n, int m)   {     char[][] map = new char[n][];     for(int i = 0;i < n;i++)map[i] = sa(m);     return map;   }   private int[] ia(int n)   {     int[] a = new int[n];     for(int i = 0;i < n;i++)a[i] = i();     return a;   }   private int i()   {     int num = 0, b;     boolean minus = false;     while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));     if(b == '-'){       minus = true;       b = readByte();     }     while(true){       if(b >= '0' && b <= '9'){         num = num * 10 + (b - '0');       }else{         return minus ? -num : num;       }       b = readByte();     }   }   private long l()   {     long num = 0;     int b;     boolean minus = false;     while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));     if(b == '-'){       minus = true;       b = readByte();     }     while(true){       if(b >= '0' && b <= '9'){         num = num * 10 + (b - '0');       }else{         return minus ? -num : num;       }       b = readByte();     }   }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;   private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class Mainn {  public static class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader() {  reader = new BufferedReader(new InputStreamReader(System.in), 32768);  tokenizer = null;  }  public InputReader(InputStream stream) {  reader = new BufferedReader(new InputStreamReader(System.in), 32768);  tokenizer = null;  }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   tokenizer = new StringTokenizer(reader.readLine());   } catch (IOException e) {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public char nextChar() {  return next().charAt(0);  }  public int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public int[] nextIntArr(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = this.nextInt();  }  return arr;  }  public Integer[] nextIntegerArr(int n) {  Integer[] arr = new Integer[n];  for (int i = 0; i < n; i++) {   arr[i] = new Integer(this.nextInt());  }  return arr;  }  public int[][] next2DIntArr(int n, int m) {  int[][] arr = new int[n][m];  for (int i = 0; i < n; i++) {   for (int j = 0; j < m; j++) {   arr[i][j] = this.nextInt();   }  }  return arr;  }  public int[] nextSortedIntArr(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = this.nextInt();  }  Arrays.sort(arr);  return arr;  }  public long[] nextLongArr(int n) {  long[] arr = new long[n];  for (int i = 0; i < n; i++) {   arr[i] = this.nextLong();  }  return arr;  }  public char[] nextCharArr(int n) {  char[] arr = new char[n];  for (int i = 0; i < n; i++) {   arr[i] = this.nextChar();  }  return arr;  } }  public static InputReader scn = new InputReader(); public static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {        int n = scn.nextInt(), inv = 0;  int[] arr = scn.nextIntArr(n);  for(int i = 0; i < n; i++) {  for(int j = i + 1; j < n; j++) {   if(arr[i] > arr[j]) {   inv++;   }  }  }   int ans = inv % 2;   int m = scn.nextInt();  while(m-- > 0) {  int l = scn.nextInt(), r = scn.nextInt();    int change = ((r - l + 1) / 2) % 2;    if(change == 1) {   ans = 1 - ans;  }    if(ans == 0) {   out.println("even");  } else {   out.println("odd");  }  }   out.close(); } }
4	public class Main {  static int MOD = 1000000007;              void solve() throws IOException {   int T = ri();   for (int Ti = 0; Ti < T; Ti++) {    int n = ri();    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = ri();    Deque<int[]> stack = new ArrayDeque<>();    stack.addLast(new int[]{1});    pw.println("1");    for (int i = 1; i < n; i++) {     if (a[i] == 1) {      int[] prev = stack.peekLast();      int[] curr = new int[prev.length+1];      System.arraycopy(prev, 0, curr, 0, prev.length);      curr[curr.length-1] = 1;      printArr(curr);      stack.addLast(curr);      continue;     }     while (!stack.isEmpty()) {      int[] prev = stack.removeLast();      if (a[i] == prev[prev.length-1] + 1) {       prev[prev.length-1]++;       printArr(prev);       stack.addLast(prev);       break;      } else {       continue;      }     }    }   }  }     void printArr(int[] a) {   pw.print(a[0]);   for (int j = 1; j < a.length; j++) pw.print("." + a[j]);   pw.println();  }    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   Main m = new Main();   m.solve();   m.close();  }  void close() throws IOException {   pw.flush();   pw.close();   br.close();  }  int ri() throws IOException {   return Integer.parseInt(br.readLine().trim());  }  long rl() throws IOException {   return Long.parseLong(br.readLine().trim());  }  int[] ril(int n) throws IOException {   int[] nums = new int[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    int x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  long[] rll(int n) throws IOException {   long[] nums = new long[n];   int c = 0;   for (int i = 0; i < n; i++) {    int sign = 1;    c = br.read();    long x = 0;    if (c == '-') {     sign = -1;     c = br.read();    }    while (c >= '0' && c <= '9') {     x = x * 10 + c - '0';     c = br.read();    }    nums[i] = x * sign;   }   while (c != '\n' && c != -1) c = br.read();   return nums;  }  int[] rkil() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return ril(x);  }  long[] rkll() throws IOException {   int sign = 1;   int c = br.read();   int x = 0;   if (c == '-') {    sign = -1;    c = br.read();   }   while (c >= '0' && c <= '9') {    x = x * 10 + c - '0';    c = br.read();   }   return rll(x);  }  char[] rs() throws IOException {   return br.readLine().toCharArray();  }  void sort(int[] A) {   Random r = new Random();   for (int i = A.length-1; i > 0; i--) {    int j = r.nextInt(i+1);    int temp = A[i];    A[i] = A[j];    A[j] = temp;   }   Arrays.sort(A);  }  void printDouble(double d) {   pw.printf("%.16f", d);  } }
1	public class Main {    private PrintWriter out;  private Map<Integer, Integer> map;   private int arr[], ans[];  int n, a, b;   class DSU {   private int[] p, size;     public DSU(int n) {    p = new int[n];    size = new int[n];       for (int i=0; i<n; i++) {     p[i] = i;     size[i] = 1;    }   }     public int find(int i) {    if (p[i] == i) {     return i;    }    return p[i] = find(p[i]);   }     public void union (int a, int b) {    a = find(a); b = find(b);    if (size[a] > size[b]) {     p[b] = a;     size[a] += size[b];    } else {     p[a] = b;     size[b] += size[a];    }   }  }   private void solve() throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new OutputStreamWriter(System.out));   StringTokenizer st = new StringTokenizer(in.readLine());     n = Integer.valueOf(st.nextToken());   a = Integer.valueOf(st.nextToken());   b = Integer.valueOf(st.nextToken());   map = new HashMap<Integer, Integer>(n);     String line = in.readLine();   StringTokenizer st1 = new StringTokenizer(line);     arr = new int[n];   ans = new int[n];   DSU dsu = new DSU(n);     for (int i=0; i<n; i++) {    arr[i] = Integer.valueOf(st1.nextToken());    map.put(arr[i], i);   }   in.close();     for (int i=0; i<n; i++) {    boolean f = false;    if (map.get(a - arr[i]) != null) {     f = true;     dsu.union(i, map.get(a - arr[i]));    }       if (map.get(b - arr[i]) != null) {     f = true;     dsu.union(i, map.get(b - arr[i]));    }       if (!f) {     out.println("NO");     out.flush();     return;    }   }     for (int i=0; i<n; i++) {    int p = dsu.find(i);    if (map.get(a - arr[i]) == null) {     ans[p] = 1;    } else if (map.get(b - arr[i]) == null) {     ans[p] = 0;    }   }     for (int i=0; i<n; i++) {    int p = dsu.find(i);    if (ans[p] == 0 && map.get(a - arr[i]) == null) {     out.println("NO");     out.flush();     return;    }        if (ans[p] == 1 && map.get(b - arr[i]) == null) {     out.println("NO");     out.flush();     return;    }   }     out.println("YES");   for (int i=0; i<n; i++) {    out.print(ans[dsu.find(i)] + " ");   }       out.flush();   out.close();  }  public static void main(String[] args) throws Exception {   new Main().solve();  } }
1	public class Main { BufferedReader in; PrintWriter out; StringTokenizer st;    void solve() throws IOException {  int n=ni();  int k=ni();  boolean[] t = new boolean[n+1];  for(int i=2;i<=n;i++){  t[i]=false;  }  int p=2;   while(true){  int pointer=2;  while(pointer*p<=n){  t[pointer*p]=true;  pointer++;  }  boolean flag=false;  for(int i=p+1;i<=n;i++){  if(!t[i]){p=i;flag=true;break;}  }  if(!flag)break;  }  List<Integer> lst=new ArrayList<Integer>();  int countN=0;  for(int i=1;i<=n;i++){  if(!t[i]){lst.add(i);countN++; }  }  int count=0;   String resulPO="NO";  for(int i=2;i<countN;i++){    boolean result=false;  for(int j=0;j<i;j++){   if(lst.get(j)+lst.get(j+1)+1==lst.get(i)){   result=true;      break;   }  }  if(result)count++;  }  if(count>=k)resulPO="YES";  else resulPO="NO";  out.print(resulPO);   }  public Main() throws IOException {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  in.close();  out.close(); }  String ns() throws IOException {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int ni() throws IOException {  return Integer.valueOf(ns()); }  long nl() throws IOException {  return Long.valueOf(ns()); }  double nd() throws IOException {  return Double.valueOf(ns()); }  public static void main(String[] args) throws IOException {  new Main(); } }
0	public class d {  double a, v, l, d, w;  private void solve() throws Exception {  a = nextInt(); v = nextInt(); l = nextInt(); d = nextInt(); w = nextInt();  double ans;  if (w >= v){  ans = fromSign(0, l);  }  else{  double tToW = w / a;  double dToW = tToW * tToW * a / 2.;  if (dToW > d){   double curT = Math.sqrt(d * 2. / a);   ans = curT;   double curV = a * curT;   ans += fromSign(curV, l - d);  }  else{   double tToMax = v / a;   double dToMax = tToMax * tToMax * a / 2.;   double tFromMax = (v - w) / a;   double dFromMax = tFromMax * v - tFromMax * tFromMax * a / 2.;   if (dToMax + dFromMax <= d){   ans = tToMax + tFromMax + (d - dToMax - dFromMax) / v;   }   else{   double lo = w, hi = v;   for (int i = 0; i < 1000; ++i){    double mi = (lo + hi) / 2.;    double tTo = mi / a;    double dTo = tTo * tTo * a / 2.;    double tFrom = (mi - w) / a;    double dFrom = tFrom * mi - tFrom * tFrom * a / 2.;    if (dTo + dFrom <= d)    lo = mi;    else    hi = mi;   }   ans = lo / a + (lo - w) / a;   }   ans += fromSign(w, l - d);  }  }  out.printf("%.8f", ans); }  private double fromSign(double curV, double d) {  double tToMax = (v - curV) / a;  double dToMax = tToMax * curV + tToMax * tToMax * a / 2.;  if (dToMax <= d){  return tToMax + (d - dToMax) / v;  }  else{  double lo = 0, hi = tToMax;  for (int i = 0; i < 1000; ++i){   double mi = (lo + hi) / 2.;   double curD = mi * curV + mi * mi * a / 2.;   if (curD <= d)   lo = mi;   else   hi = mi;  }  return lo;  } }  public void run() {  try {  solve();  } catch (Exception e) {  NOO(e);  } finally {  out.close();  } }  PrintWriter out; BufferedReader in; StringTokenizer St;  void NOO(Exception e) {  e.printStackTrace();  System.exit(1); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  String nextToken() {  while (!St.hasMoreTokens()) {  try {   String line = in.readLine();   St = new StringTokenizer(line);  } catch (Exception e) {   NOO(e);  }  }  return St.nextToken(); }  private d(String name) {  try {  in = new BufferedReader(new FileReader(name + ".in"));  St = new StringTokenizer("");  out = new PrintWriter(new FileWriter(name + ".out"));  } catch (Exception e) {  NOO(e);  } }  private d() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  St = new StringTokenizer("");  out = new PrintWriter(System.out);  } catch (Exception e) {  NOO(e);  } }  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new d().run(); } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int ar[] = in.nextIntArray(n);    long dp[][] = new long[n][n];    long ct = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (ar[i] > ar[j]) {       dp[i][j]++;       ct++;      }     }    }    for (int i = n - 2; i >= 0; i--) {     for (int j = i + 1; j < n; j++) {      dp[i][j] += dp[i + 1][j];     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt() - 1;     int r = in.nextInt() - 1;     long val = (r - l + 1);     long estimated = (val * (val - 1)) / 2;     long change = estimated - dp[l][r];         ct = ct - dp[l][r];     dp[l][r] = change;     ct += dp[l][r];     if (ct % 2 == 0) {      out.println("even");     } else {      out.println("odd");     }         }    }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {        if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }   public int nextInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }   public boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, FastScanner in, FastPrinter out) {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   int[] b = a.clone();   ArrayUtils.sort(b);   int count = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i]) {     ++count;    }   }   out.println(count <= 2 ? "YES" : "NO"); } } class FastScanner extends BufferedReader {  boolean isEOF;  public FastScanner(InputStream is) {   super(new InputStreamReader(is));  }  public int read() {   try {    int ret = super.read();    if (isEOF && ret < 0) {     throw new InputMismatchException();    }    isEOF = ret == -1;    return ret;   } catch (IOException e) {    throw new InputMismatchException();   }  }  static boolean isWhiteSpace(int c) {   return c >= -1 && c <= 32;  }  public int nextInt() {   int c = read();   while (isWhiteSpace(c)) {    c = read();   }   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int ret = 0;   while (!isWhiteSpace(c)) {    if (c < '0' || c > '9') {     throw new NumberFormatException("digit expected " + (char) c       + " found");    }    ret = ret * 10 + c - '0';    c = read();   }   return ret * sgn;  }  } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  } class ArrayUtils {  public static void sort(int[] a) {   Random rand = new Random(System.nanoTime());   for (int i = 0; i < a.length; i++) {    int j = rand.nextInt(i + 1);    int t = a[i];    a[i] = a[j];    a[j] = t;   }   Arrays.sort(a);  }   }
3	public class Solution {  public static void main(String[] args) throws Exception {   MyReader reader = new MyReader(System.in);   MyWriter writer = new MyWriter(System.out);   new Solution().run(reader, writer);   writer.close();  }  private void run(MyReader reader, MyWriter writer) throws IOException, InterruptedException {   int n = reader.nextInt();   int[] a = reader.nextIntArray(n);   boolean b = false;   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     if (a[i] > a[j]) {      b = !b;     }    }   }   int m = reader.nextInt();   for (int i = 0; i < m; i++) {    int l = reader.nextInt();    int r = reader.nextInt();    int d = r - l + 1;    if (d * (d - 1) / 2 % 2 == 1) {     b = !b;    }    writer.println(b ? "odd" : "even");   }  }   static class MyReader {    final BufferedInputStream in;    final int bufSize = 1 << 16;    final byte buf[] = new byte[bufSize];    int i = bufSize;    int k = bufSize;    boolean end = false;    final StringBuilder str = new StringBuilder();    MyReader(InputStream in) {     this.in = new BufferedInputStream(in, bufSize);    }    int nextInt() throws IOException {     return (int) nextLong();    }    int[] nextIntArray(int n) throws IOException {     int[] m = new int[n];     for (int i = 0; i < n; i++) {      m[i] = nextInt();     }     return m;    }    int[][] nextIntMatrix(int n, int m) throws IOException {     int[][] a = new int[n][0];     for (int j = 0; j < n; j++) {      a[j] = nextIntArray(m);     }     return a;    }    long nextLong() throws IOException {     int c;     long x = 0;     boolean sign = true;     while ((c = nextChar()) <= 32) ;     if (c == '-') {      sign = false;      c = nextChar();     }     if (c == '+') {      c = nextChar();     }     while (c >= '0') {      x = x * 10 + (c - '0');      c = nextChar();     }     return sign ? x : -x;    }    long[] nextLongArray(int n) throws IOException {     long[] m = new long[n];     for (int i = 0; i < n; i++) {      m[i] = nextLong();     }     return m;    }    int nextChar() throws IOException {     if (i == k) {      k = in.read(buf, 0, bufSize);      i = 0;     }     return i >= k ? -1 : buf[i++];    }    String nextString() throws IOException {     if (end) {      return null;     }     str.setLength(0);     int c;     while ((c = nextChar()) <= 32 && c != -1) ;     if (c == -1) {      end = true;      return null;     }     while (c > 32) {      str.append((char) c);      c = nextChar();     }     return str.toString();    }    String nextLine() throws IOException {     if (end) {      return null;     }     str.setLength(0);     int c = nextChar();     while (c != '\n' && c != '\r' && c != -1) {      str.append((char) c);      c = nextChar();     }     if (c == -1) {      end = true;      if (str.length() == 0) {       return null;      }     }     if (c == '\r') {      nextChar();     }     return str.toString();    }    char[] nextCharArray() throws IOException {     return nextString().toCharArray();    }    char[][] nextCharMatrix(int n) throws IOException {     char[][] a = new char[n][0];     for (int i = 0; i < n; i++) {      a[i] = nextCharArray();     }     return a;    }   }   static class MyWriter {    final BufferedOutputStream out;    final int bufSize = 1 << 16;    final byte buf[] = new byte[bufSize];    int i = 0;    final byte c[] = new byte[30];    static final String newLine = System.getProperty("line.separator");    MyWriter(OutputStream out) {     this.out = new BufferedOutputStream(out, bufSize);    }    void print(long x) throws IOException {     int j = 0;     if (i + 30 >= bufSize) {      flush();     }     if (x < 0) {      buf[i++] = (byte) ('-');      x = -x;     }     while (j == 0 || x != 0) {      c[j++] = (byte) (x % 10 + '0');      x /= 10;     }     while (j-- > 0)      buf[i++] = c[j];    }    void print(int[] m) throws IOException {     for (int a : m) {      print(a);      print(' ');     }    }    void print(long[] m) throws IOException {     for (long a : m) {      print(a);      print(' ');     }    }    void print(String s) throws IOException {     for (int i = 0; i < s.length(); i++) {      print(s.charAt(i));     }    }    void print(char x) throws IOException {     if (i == bufSize) {      flush();     }     buf[i++] = (byte) x;    }    void print(char[] m) throws IOException {     for (char c : m) {      print(c);     }    }    void println(String s) throws IOException {     print(s);     println();    }    void println() throws IOException {     print(newLine);    }    void flush() throws IOException {     out.write(buf, 0, i);     out.flush();     i = 0;    }    void close() throws IOException {     flush();     out.close();    }   }  }
5	public class Codeforces_2012_08_31_A {  public static void main(String[] args) throws IOException {     StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   PrintWriter out = new PrintWriter(System.out);   in.nextToken();   int n = (int) in.nval;   int[] a = new int[n];   for (int i=0; i<n; i++) {    in.nextToken();    a[i] = (int) in.nval;   }   int[] b = Arrays.copyOf(a, n);   Arrays.sort(a);   int k = 0;   for (int i=0; i<n; i++) {    if (a[i] != b[i]) k++;   }   if (k==0 || k==2)    out.println("YES");   else    out.println("NO");   out.flush();   out.close();  } }
4	public class B{ public static void main(String[] args) {  FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int t = fs.nextInt();  for(int tt=0;tt<t;tt++)  {  int n = fs.nextInt();  int[] arr = fs.readArray(n);  List<String> ans = new ArrayList();  List<Integer> temp = new ArrayList();  temp.add(arr[0]);  ans.add(""+arr[0]);  for(int i=1;i<n;i++)  {   int ch = arr[i];   if(ch == 1)   {   temp.add(1);   StringBuilder sb = new StringBuilder();   for(int j=0;j<temp.size();j++)   {    sb.append(temp.get(j));    if(j != temp.size()-1)    {    sb.append('.');    }   }   ans.add(sb.toString());   }   else   {   int j = temp.size()-1;   while(j>=0)   {    if(ch - temp.get(j) == 1)    {    temp.set(j,ch);    break;    }    else    {    j--;    }   }   int extra = temp.size()-1;   while(extra>j)   {    temp.remove(temp.size()-1);    extra--;   }   StringBuilder sb = new StringBuilder();   for(int jj=0;jj<temp.size();jj++)   {    sb.append(temp.get(jj));    if(jj != temp.size()-1)    {    sb.append('.');    }   }   ans.add(sb.toString());   }   }  for(String str:ans)  {   out.println(str);  }  }  out.close(); } static class FastScanner {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st=new StringTokenizer("");  String next() {  while (!st.hasMoreTokens())   try {   st=new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  return st.nextToken();  }   int nextInt() {  return Integer.parseInt(next());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } } public static int[] sort(int[] arr) {  List<Integer> temp = new ArrayList();  for(int i:arr)temp.add(i);  Collections.sort(temp);  int start = 0;  for(int i:temp)arr[start++]=i;  return arr; } }
3	public class D { public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);   int inv = 0;  int n = sc.nextInt();  int[] arr = new int[n];  for (int i = 0; i < arr.length; i++)  arr[i] = sc.nextInt();   for (int i = 0; i < arr.length; i++)  for (int j = i+1; j < arr.length; j++)   if(arr[i] > arr[j])   inv++;     boolean odd = (inv%2)!=0;  int q = sc.nextInt();  for (int i = 0; i < q; i++)  {  int l = sc.nextInt();  int r = sc.nextInt();  int sz = r-l+1;  int tot = (sz*(sz-1))/2;  if(tot%2 != 0)   odd = !odd;  if(odd)   pw.println("odd");  else   pw.println("even");  }   pw.flush();  pw.close(); } static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s)  {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String s) throws FileNotFoundException  {  br = new BufferedReader(new FileReader(new File((s))));  }  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException  {  return Integer.parseInt(next());  }  public long nextLong() throws IOException  {  return Long.parseLong(next());  }  public String nextLine() throws IOException  {  return br.readLine();  }  public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-')  {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else   {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException  {  return br.ready();  } } }
2	public class a {  public static void main(String args[])throws IOException{  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  OutputStream out=new BufferedOutputStream(System.out);  String s[]=br.readLine().trim().split("\\ ");  BigInteger a1=new BigInteger(s[0]);  BigInteger a=new BigInteger(s[0]);  String q=a.toString();  String q1=q.substring(q.length()-1, q.length());  a=a.subtract(new BigInteger(q1));   BigInteger c=new BigInteger("1");  BigInteger b=new BigInteger(s[1]);  int z=check(a,a.toString(),b);  if(z==1)  {  out.write("0".getBytes());  out.flush();    return;  }  while(a.compareTo(c)>0)  {  BigInteger d=a;  if(d.subtract(c).compareTo(new BigInteger("9"))==-1)  {   break;  }  else  {   BigInteger mid=a;   mid=mid.add(c);   mid=mid.divide(new BigInteger("2"));     if(check(mid,mid.toString(),b)==1)   {   c=mid;   c=c.add(new BigInteger("1"));   }   else   {   a=mid;         }     }    }  q=a.toString();  q1=q.substring(q.length()-1, q.length());  a=a.subtract(new BigInteger(q1));  BigInteger ans=a1.subtract(a);  ans=ans.add(new BigInteger("1"));  out.write(ans.toString().getBytes());      out.flush(); }   static int check(BigInteger a,String s,BigInteger b)  {  int l=s.length();  long z=0;  for(int i=0;i<l;i++)  {   z+=Long.parseLong(s.substring(i,i+1));  }  BigInteger c=a.subtract(new BigInteger(Long.toString(z)));    return -1*c.compareTo(b);  } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   Arrays.sort(a);   if (k >= m) {    out.println(0);    return;   }   for (int i = 1; i <= n; i++) {    int sockets = k - 1;    for (int j = 0; j < i; j++)     sockets += a[n - j - 1];    sockets -= i - 1;    if (sockets >= m) {     out.println(i);     return;    }   }   out.println(-1);  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }  public int nextInt() {   return Integer.parseInt(next());  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int N = in.nextInt(), i, a[] = new int[N];    int rev[] = new int[N];    for (i = 0; i < N; i++) {     a[i] = in.nextInt();     rev[N - i - 1] = a[i];    }    long[][] inverse = inversions(a, N);    long[][] revInverse = inversions(rev, N);    int q = in.nextInt();    long inversions = inverse[0][N - 1] % 2;    while (q-- > 0) {     int left = in.nextInt() - 1, right = in.nextInt() - 1;     int length = right - left + 1;     length = length * (length - 1) / 2;     if (length % 2 == 1) {      inversions = 1 - inversions;     }     if (inversions % 2 == 0) {      out.printLine("even");     } else {      out.printLine("odd");     }    }      }   public long[][] inversions(int a[], int N) {    int x[][] = new int[N][N];    int i, j;    for (i = 0; i < N; i++) {     for (j = i + 1; j < N; j++) {      if (a[i] > a[j]) {       x[i][j] = 1;      }     }    }    int colSum[][] = new int[N][N];    for (i = 0; i < N; i++) {     colSum[0][i] = x[0][i];     for (j = 1; j < N; j++) {      colSum[j][i] = colSum[j - 1][i] + x[j][i];     }    }    long inverse[][] = new long[N][N];    for (int length = 2; length <= N; length++) {     j = length - 1;     i = 0;     while (j < N) {      inverse[i][j] = inverse[i][j - 1] + colSum[i + length - 1][j];      if (i > 0) {       inverse[i][j] -= colSum[i - 1][j];      }      i++;      j++;     }    }    return inverse;   }  }  static class InputReader {   BufferedReader in;   StringTokenizer tokenizer = null;   public InputReader(InputStream inputStream) {    in = new BufferedReader(new InputStreamReader(inputStream));   }   public String next() {    try {     while (tokenizer == null || !tokenizer.hasMoreTokens()) {      tokenizer = new StringTokenizer(in.readLine());     }     return tokenizer.nextToken();    } catch (IOException e) {     return null;    }   }   public int nextInt() {    return Integer.parseInt(next());   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0)      writer.print(' ');     writer.print(objects[i]);    }   }   public void printLine(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }  } }
0	public class A {  static long l, r, A, B, C;  static long GCD(long a, long b) {   if (b == 0)    return a;   return GCD(b, a % b);  }  static boolean gcd(long a, long b) {   return GCD(a, b) == 1;  }  static boolean found(long a, long b, long c) {   if (b <= a || c <= b)    return false;   if (a > r || b > r || c > r)    return false;   if (gcd(a, b) && gcd(b, c) && !gcd(a, c)) {    A = a;    B = b;    C = c;    return true;   }   if (found(a + 1, b + 1, c + 1))    return true;   if (found(a + 1, b, c + 1))    return true;   if (found(a + 1, b + 1, c))    return true;   if (found(a, b, c + 1))    return true;   if (found(a, b + 1, c + 1))    return true;   if (found(a, b + 1, c))    return true;   return found(a + 1, b, c);  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   l = sc.nextLong();   r = sc.nextLong();   if (found(l, l + 1, l + 2))    System.out.println(A + " " + B + " " + C);   else    System.out.println(-1);  } }
1	public class B {    public static void main(String[] args) throws Exception {   Parserdoubt2333 s = new Parserdoubt2333(System.in);     int n = s.nextInt();   int k = s.nextInt();   int a[] = new int[n];   for (int i = 0; i < a.length; i++) {    a[i] = s.nextInt();      }     TreeMap<Integer, Integer> tree = new TreeMap<Integer,Integer>();     int left = 0;   int right = 0;     for (right = 0; right < a.length; right++) {    if(tree.containsKey(a[right]))     tree.put(a[right], tree.get(a[right]) + 1);    else     tree.put(a[right],1);    if(tree.size() == k)     break;   }     if(tree.size() < k){    System.out.println("-1 -1");    return ;   }   for (left = 0; left < a.length; left++) {    int val = tree.get(a[left]);    val--;    if(val > 0)     tree.put(a[left],val);    if(val == 0)     break;      }   left++;   right++;   System.out.println(left + " "+right);  } }  class Parserdoubt2333 {  final private int BUFFER_SIZE = 1 << 18;   private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parserdoubt2333(InputStream in)  {  din = new DataInputStream(in);  buffer = new byte[BUFFER_SIZE];  bufferPointer = bytesRead = 0;  }  public String nextString() throws Exception  {   StringBuffer sb=new StringBuffer("");   byte c = read();   while (c <= ' ') c = read();   do   {    sb.append((char)c);    c=read();   }while(c>' ');   return sb.toString();  }  public char nextChar() throws Exception  {   byte c=read();   while(c<=' ') c= read();   return (char)c;  }  public int nextInt() throws Exception  {  int ret = 0;  byte c = read();  while (c <= ' ') c = read();  boolean neg = c == '-';  if (neg) c = read();  do  {   ret = ret * 10 + c - '0';   c = read();  } while (c > ' ');  if (neg) return -ret;  return ret;  }  public long nextLong() throws Exception  {  long ret = 0;  byte c = read();  while (c <= ' ') c = read();  boolean neg = c == '-';  if (neg) c = read();  do  {   ret = ret * 10 + c - '0';   c = read();  } while (c > ' ');  if (neg) return -ret;  return ret;  }  private void fillBuffer() throws Exception  {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1) buffer[0] = -1;  }   private byte read() throws Exception  {  if (bufferPointer == bytesRead) fillBuffer();  return buffer[bufferPointer++];  } }
6	public class C8 {  public static long mod = 1000000007; public static long INF = (1L << 60); static FastScanner2 in = new FastScanner2(); static OutputWriter out = new OutputWriter(System.out); static int n; static int x,y; static int[] xx; static int[] yy; static int[] dist; static int[][] g; static int[] dp; public static int square(int x) {  return abs(x*x); } static class Pair {  int x,y;  Pair(int x,int y)  {  this.x=x;  this.y=y;  } } public static void main(String[] args)  {  x=in.nextInt();  y=in.nextInt();  n=in.nextInt();  xx=new int[n];  yy=new int[n];  dp=new int[1<<n];  for(int i=0;i<n;i++)  {  xx[i]=in.nextInt();  yy[i]=in.nextInt();  }  dist=new int[n];  g=new int[n][n];  for(int i=0;i<n;i++)  {  dist[i]=square(abs(xx[i]-x))+square(abs(yy[i]-y));  }  for(int i=0;i<n;i++)  {  for(int j=0;j<n;j++)  {   g[i][j]=square(abs(xx[i]-xx[j]))+square(yy[i]-yy[j]);     }  }  Arrays.fill(dp, Integer.MAX_VALUE/2);  dp[0]=0;  for(int i=0;i<(1<<n);i++)  {    for(int j=0;j<n;j++)  {   if((i&(1<<j))>0)    continue;   dp[i|(1<<j)]=min(dp[i|(1<<j)], dp[i]+2*dist[j]);   for(int k=j+1;k<n;k++)   {   if((i&(1<<k))>0)    continue;   dp[i|(1<<j)|(1<<k)]=min(dp[i|(1<<j)|(1<<k)], dp[i]+dist[j]+dist[k]+g[j][k]);   }   break;  }  }  out.println(dp[(1<<n)-1]);  Stack<Integer> stack=new Stack<>();  stack.push(0);  int i=(1<<n)-1;  while(i>0)  {  boolean tocontinue=false;  for(int a=0;a<n;a++)  {   if((i&(1<<a))==0)   continue;   if(dp[i]==(dp[i^(1<<a)]+2*dist[a]))   {   stack.push(a+1);   stack.push(0);   i-=(1<<a);   tocontinue=true;   }   if(tocontinue)   continue;   for(int b=a+1;b<n;b++)   {   if((i & (1<<b)) == 0) continue;   if(dp[i]==(dp[i^(1<<a)^(1<<b)]+dist[a]+dist[b]+g[a][b]))   {    i-=(1<<a);    i-=(1<<b);    stack.push(a+1);    stack.push(b+1);    stack.push(0);    tocontinue=true;   }   if(tocontinue)    break;   }   if(tocontinue)   break;  }    }  for(int ii : stack)  out.print(ii+" ");  out.close();  }  public static long pow(long x, long n, long mod)  {  long res = 1;  for (long p = x; n > 0; n >>= 1, p = (p * p) % mod)  {  if ((n & 1) != 0)   {   res = (res * p % mod);  }  }  return res; }  public static long gcd(long n1, long n2) {  long r;  while (n2 != 0)  {  r = n1 % n2;  n1 = n2;  n2 = r;  }  return n1; }  public static long lcm(long n1, long n2)  {  long answer = (n1 * n2) / (gcd(n1, n2));  return answer; }  static class FastScanner2  {  private byte[] buf = new byte[1024];  private int curChar;  private int snumChars;  public int read()  {  if (snumChars == -1)   throw new InputMismatchException();  if (curChar >= snumChars)   {   curChar = 0;   try   {   snumChars = System.in.read(buf);   } catch (IOException e)   {   throw new InputMismatchException();   }   if (snumChars <= 0)   return -1;  }  return buf[curChar++];  }  public String nextLine()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isEndOfLine(c));  return res.toString();  }  public String nextString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));  return res.toString();  }  public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }   while (!isSpaceChar(c));  return res * sgn;  }  public int nextInt()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }   while (!isSpaceChar(c));  return res * sgn;  }  public int[] nextIntArray(int n)  {  int[] arr = new int[n];  for (int i = 0; i < n; i++)   {   arr[i] = nextInt();  }  return arr;  }  public long[] nextLongArray(int n)  {  long[] arr = new long[n];  for (int i = 0; i < n; i++)   {   arr[i] = nextLong();  }  return arr;  }  private boolean isSpaceChar(int c)  {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private boolean isEndOfLine(int c)  {  return c == '\n' || c == '\r' || c == -1;  } }  static class InputReader  {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream inputstream)  {  reader = new BufferedReader(new InputStreamReader(inputstream));  tokenizer = null;  }  public String nextLine()  {  String fullLine = null;  while (tokenizer == null || !tokenizer.hasMoreTokens())  {   try   {   fullLine = reader.readLine();   } catch (IOException e)   {   throw new RuntimeException(e);   }   return fullLine;  }  return fullLine;  }  public String next()  {  while (tokenizer == null || !tokenizer.hasMoreTokens())   {   try   {   tokenizer = new StringTokenizer(reader.readLine());   } catch (IOException e)   {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public long nextLong()  {  return Long.parseLong(next());  }  public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)   {   a[i] = nextInt();  }  return a;  }  public long[] nextLongArray(int n)  {  long a[] = new long[n];  for (int i = 0; i < n; i++)   {   a[i] = nextLong();  }  return a;  }  public int nextInt()  {  return Integer.parseInt(next());  } }  static class OutputWriter  {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream)  {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer)  {  this.writer = new PrintWriter(writer);  }  public void print(Object... objects)  {  for (int i = 0; i < objects.length; i++)   {   if (i != 0)   writer.print(' ');   writer.print(objects[i]);  }  }  public void println(Object... objects)  {  print(objects);  writer.println();  }  public void close()  {  writer.close();  }  public void flush()  {  writer.flush();  } } }
1	public class B {  static class Scanner {  BufferedReader rd;  StringTokenizer tk;  public Scanner() throws IOException  {  rd=new BufferedReader(new InputStreamReader(System.in));  tk=new StringTokenizer(rd.readLine());  }  public String next() throws IOException  {  while(!tk.hasMoreTokens())   tk=new StringTokenizer(rd.readLine());  return tk.nextToken();  }  public int nextInt() throws NumberFormatException, IOException  {  return Integer.valueOf(this.next());  } }  static int N,K; static int[] array=new int[100010];  public static void main(String args[]) throws IOException{  Scanner sc=new Scanner();  N=sc.nextInt();  K=sc.nextInt();  for(int i=0;i<N;i++)  array[i]=sc.nextInt();  TreeMap<Integer,Integer> map=new TreeMap<Integer,Integer>();  boolean flag=false;  for(int i=0;i<N;i++){  if (!map.containsKey(array[i])){   map.put(array[i], i);   if (map.size()==K){   flag=true;   break;   }  }  else   map.put(array[i], i);  }  if (!flag)  System.out.println("-1 -1");  else{  Set<Integer> s=map.keySet();  int l=Integer.MAX_VALUE;  int r=Integer.MIN_VALUE;  for(int k: s){   int tmp=map.get(k);   l=Math.min(l, tmp);   r=Math.max(r, tmp);  }  System.out.println((l+1)+" "+(r+1));  } } }
0	public class A275 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);     long a=sc.nextLong();   long b=sc.nextLong();     if(b-a<2){    System.out.println(-1);   }else if(b-a==2 && a%2==1){    System.out.println(-1);   }else if(b-a==2 && a%2==0){    System.out.println(a+" "+(a+1)+" "+(a+2));   }else{    if(a%2==0){     System.out.println(a+" "+(a+1)+" "+(a+2));    }else{     System.out.println((a+1)+" "+(a+2)+" "+(a+3));    }   }  } }
0	public class Main implements Runnable {  static Throwable sError;  public static void main(String[] args) throws Throwable {   Thread t = new Thread(new Main());   t.start();   t.join();   if (sError != null)    throw sError;  }  PrintWriter pw;  BufferedReader in;  StringTokenizer st;  void initStreams() throws FileNotFoundException,    UnsupportedEncodingException {   pw = new PrintWriter(System.out);   if (System.getProperty("ONLINE_JUDGE") == null) {    System.setIn(new FileInputStream("1"));   }   in = new BufferedReader(new InputStreamReader(System.in, "ISO-8859-9"));  }  String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextString());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  }  public void run() {   try {    initStreams();    double a = nextDouble(), vmax = nextDouble(), l = nextDouble(), d = nextDouble(), w = nextDouble();    if (vmax <= w) {     double v = Math.sqrt(2 * a * l);     if (v <= vmax) {      out(v / a);     } else {      double s = vmax * vmax / (2 * a);      double t = (l - s) / vmax;      out(vmax / a + t);     }    } else {     double v = Math.sqrt(a * d + w * w / 2);     double t1 = 0;     if (w <= Math.sqrt(2 * a * d)) {      if (v <= vmax) {       t1 = v / a + (v - w) / a;      } else {       double s = d - vmax * vmax / (2 * a) - (vmax * vmax - w * w) / (2 * a);       t1 = s / vmax + vmax / a + (vmax - w) / a;      }      } else {      t1 = Math.sqrt(2 * d / a);      w = a * t1;     }     v = Math.sqrt(2 * a * (l - d) + w * w);     double t2 = 0;     if (v <= vmax) {      t2 = (v - w) / a;     } else {      double s = l - d - (vmax * vmax - w * w) / (2 * a);      t2 = (vmax - w) / a + s / vmax;     }     out(t1 + t2);    }   } catch (Throwable e) {    sError = e;   } finally {    pw.flush();    pw.close();   }  }  private void out(double t) {   pw.println(t);  } }
1	public class A implements Runnable { public static void main(String[] args) {  new A().run(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  boolean eof;  String buf;  public FastScanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  nextToken();  }  public FastScanner(InputStream stream) {  br = new BufferedReader(new InputStreamReader(stream));  nextToken();  }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   eof = true;   break;   }  }  String ret = buf;  buf = eof ? "-1" : st.nextToken();  return ret;  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  void close() {  try {   br.close();  } catch (Exception e) {   }  }  boolean isEOF() {  return eof;  } }  FastScanner sc; PrintWriter out;  public void run() {  Locale.setDefault(Locale.US);  try {  sc = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  sc.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return sc.nextInt(); }  String nextToken() {  return sc.nextToken(); }  long nextLong() {  return sc.nextLong(); }  double nextDouble() {  return sc.nextDouble(); }  boolean isPrime(int x) {  for (int i = 2; i * i <= x; i++) {  if (x % i == 0) {   return false;  }  }  return true; }  void solve() {  int n = nextInt();  int k = nextInt();  ArrayList<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= n; i++) {  if (isPrime(i)) {   primes.add(i);  }  }  int ans = 0;  for (int i = 0; i < primes.size(); i++) {  for (int j = 0; j < i - 1; j++) {   if (primes.get(j) + primes.get(j + 1) + 1 == primes.get(i)    .intValue()) {   ans++;   break;   }  }  }  if (ans >= k) {  out.println("YES");  } else {  out.println("NO");  } } }
0	public class Main { public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  BigInteger l = new BigInteger(scanner.next());  BigInteger r = new BigInteger(scanner.next());  if(r.subtract(l).intValue() < 2) {  System.out.println(-1);  return;  }  BigInteger a = l.abs(),b,c;   BigInteger toothless = r.subtract(BigInteger.valueOf(1));  while(a.compareTo(toothless) == -1) {  b = l.add(BigInteger.valueOf(1));  while(b.compareTo(r) == -1) {   c = l.add(BigInteger.valueOf(2));   while(c.compareTo(r) == -1 || c.compareTo(r) == 0) {   if(gcd(a,b) == 1 && gcd(b,c) == 1 && gcd(a,c) != 1) {    System.out.println(a + " " + b + " " + c);    return;   }      c = c.add(BigInteger.valueOf(1));   }   b = b.add(BigInteger.valueOf(1));  }  a = a.add(BigInteger.valueOf(1));  }  System.out.println(-1); } private static int gcd(BigInteger a, BigInteger b) {  return a.gcd(b).intValue(); } }
2	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long S = nl();  long d = 1000000000000000000L;  out.println(dfs(d, n, S)); }  long dfs(long d, long n, long S) {  if(d == 0)return 0L;  long ret = 0;  for(int i = 0;i <= n/d;i++){  if(S <= 0){   ret += Math.min(n-i*d+1, d);  }else if(S < d){   ret += dfs(d/10, i == n/d ? n%d : d-1, S);  }  S -= d-1;  }  return ret; }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new C().run(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
5	public class ProblemA {  InputReader in; PrintWriter out;  void solve() {   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   Arrays.sort(a);   int d = k;   int cur = n - 1;   int ans = 0;   while (d < m && cur >= 0) {    d += a[cur] - 1;    cur--;    ans++;   }   if (d >= m)    out.println(ans);   else    out.println("-1");  }   ProblemA(){   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   try {    if (oj) {     in = new InputReader(System.in);     out = new PrintWriter(System.out);    }    else {     Writer w = new FileWriter("output.txt");     in = new InputReader(new FileReader("input.txt"));     out = new PrintWriter(w);    }   } catch(Exception e) {    throw new RuntimeException(e);   }   solve();   out.close();  }  public static void main(String[] args){   new ProblemA();  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }   public InputReader(FileReader fr) {   reader = new BufferedReader(fr);   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } }
1	public class A {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int N = s.nextInt();   int K = s.nextInt();   int[] primes = getPrimesFast(N);   Set<Integer> ints = new HashSet<Integer>();   for(int i=0;i<primes.length;i++) {    ints.add(primes[i]);   }   for(int i=1;i<primes.length;i++) {    ints.remove(primes[i] + primes[i-1]+1);   }   boolean res = primes.length - ints.size() >= K;   System.out.print(res?"YES":"NO");    }  public static int[] getPrimesFast(int n) {  if (n <= 1) {  return new int[0];  }  boolean[] b = new boolean[n + 1];  int m = n - 1;  for (int i = 2; i * i <= n; i++) {  if (!b[i]) {   for (int j = i + i; j <= n; j += i) {   if (!b[j]) {    m--;    b[j] = true;   }   }  }  }  int[] primes = new int[m];  int j = 0;  for (int i = 2; i <= n; i++) {  if (!b[i]) {   primes[j++] = i;  }  }  return primes; } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB { public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt(),k=in.nextInt();   int a[]=new int[n];   int i;   for(i=0;i<n;i++)    a[i]=in.nextInt();   HashSet<Integer> hs=new HashSet<Integer>();   boolean status=false;   int index=-1;   for(i=0;i<n;i++)   {       hs.add(a[i]);    if(hs.size()==k)    {     index=i;     status=true;     break;    }   }   if(!status)   {    out.println(-1+" "+ -1);    return;   }   HashSet<Integer> hash=new HashSet<Integer>();   for(i=index;i>=0;i--)   {    hash.add(a[i]);    if(hash.size()==k)    {     break;    }   }   out.println((i+1)+" "+(index+1));  } } class InputReader {  BufferedReader in;  StringTokenizer tokenizer=null;  public InputReader(InputStream inputStream)  {   in=new BufferedReader(new InputStreamReader(inputStream));  }  public String next()  {   try{    while (tokenizer==null||!tokenizer.hasMoreTokens())    {     tokenizer=new StringTokenizer(in.readLine());    }    return tokenizer.nextToken();   }   catch (IOException e)   {    return null;   }  }  public int nextInt()  {   return Integer.parseInt(next());  } }
6	public class C { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int x = ni(), y = ni();  int n = ni();  int[][] co = new int[n][];  for(int i = 0;i < n;i++){  co[i] = new int[]{ni()-x, ni()-y};  }   int[] c1 = new int[n];  int[][] c2 = new int[n][n];  for(int i = 0;i < n;i++){  c1[i] = (co[i][0]*co[i][0]+co[i][1]*co[i][1])*2;  }  for(int i = 0;i < n;i++){  for(int j = i+1;j < n;j++){   c2[i][j] = c2[j][i] = (co[i][0]*co[i][0]+co[i][1]*co[i][1])+(co[j][0]*co[j][0]+co[j][1]*co[j][1])+(co[j][0]-co[i][0])*(co[j][0]-co[i][0])+(co[j][1]-co[i][1])*(co[j][1]-co[i][1]);  }  }   int[] dp = new int[1<<n];  int[] prev = new int[1<<n];  prev[0] = -1;  for(int i = 1;i < 1<<n;i++){  int a = Integer.numberOfTrailingZeros(i);  dp[i] = c1[a] + dp[i^1<<a];  prev[i] = 1<<a;  for(int j = a+1;j < n;j++){   if(i<<31-j<0){   int v = dp[i^1<<a^1<<j] + c2[a][j];   if(v < dp[i]){    dp[i] = v;    prev[i] = 1<<a^1<<j;   }   }  }  }  out.println(dp[(1<<n)-1]);  int cur = (1<<n)-1;  out.print("0");  while(true){  int targ;  if(prev[cur] == -1){   targ = cur;  }else{   targ = prev[cur];   cur ^= prev[cur];  }  int a = Integer.numberOfTrailingZeros(targ);  int b = Integer.numberOfTrailingZeros(targ&targ-1);  if(targ == 1<<a){   out.print(" " + (a+1));  }else{   out.print(" " + (a+1));   out.print(" " + (b+1));  }  out.print(" 0");  if(cur == 0)break;  }  out.println(); }  void run() throws Exception {        is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception {  new C().run(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   qsort(b);     int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   void qsort(int[] a)  {   List<Integer> as = new ArrayList<Integer>();   for(int x : a) as.add(x);   Collections.shuffle(as);   for(int i = 0; i < a.length; i++) a[i] = as.get(i);   sort(a);  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   String next() throws IOException  {   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());   return st.nextToken();  }   int nextInt() throws IOException  {   return Integer.parseInt(next());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   BufferedReader input;  PrintWriter out;  StringTokenizer st;  int test;   void init() throws IOException  {   if(TEST) input = new BufferedReader(new FileReader(file + ".in"));   else input = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedOutputStream(System.out));  }   public static void main(String[] args) throws IOException  {   new Thread(null, new A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
2	public class ReallyBigNumbers817c {  static long sd(String s) {   long c = 0;   for (int i = 0; i < s.length(); i++) {    c += s.charAt(i);   }   return c - s.length() * 0x30;  }  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(in.readLine());   long n = Long.parseLong(st.nextToken());   long s = Long.parseLong(st.nextToken());   long i = (s / 10 + 1) * 10;   if (n < 10 || n - sd(n + "") < s) {    System.out.println(0);    return;   }   while (!(i - sd(""+i) >= s)) {    i += 10;   }   System.out.println(n - i + 1);  } }
2	public class Codeforces {  private static boolean greater(long mid, long s) {   int sum = 0;   long num = mid;   while (num != 0) {    sum += (num % 10);    num /= 10;   }   return mid - sum >= s;  }  static class pair {   int first;   int second;   pair(int f, int s) {    first = f;    second = s;   }   pair() {   }  }  public static void main(String[] args) throws Exception {     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   long n, s;   String arr[] = br.readLine().split(" ");   n = Long.parseLong(arr[0]);   s = Long.parseLong(arr[1]);   long l = 1;   long h = n;   while (l < h) {    long mid = (l + h) / 2;    if (greater(mid, s)) {     h = mid;    } else {     l = mid + 1;    }   }   System.out.println(greater(h, s) ? n - h + 1 : 0);  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    String[] response = {"even", "odd"};    int n = in.nextInt();    int[] arr = in.nextIntArray(0, n);    int swaps = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (arr[i] > arr[j]) swaps = (swaps + 1) % 2;     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt(), r = in.nextInt(), combinaisons = ((r - l) * (r - l + 1)) / 2;     if (combinaisons % 2 == 1) {      swaps ^= 1;     }     out.println(response[swaps]);    }   }  }  static class InputReader {   private StringTokenizer tokenizer;   private BufferedReader reader;   public InputReader(InputStream inputStream) {    reader = new BufferedReader(new InputStreamReader(inputStream));   }   private void fillTokenizer() {    if (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (Exception e) {      throw new RuntimeException(e);     }    }   }   public String next() {    fillTokenizer();    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] nextIntArray(int offset, int length) {    int[] arr = new int[offset + length];    for (int i = offset; i < offset + length; i++) {     arr[i] = nextInt();    }    return arr;   }  } }
2	public class C {  static StringTokenizer st; static BufferedReader br; static PrintWriter pw; public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  long n = nextLong();  long s = nextLong();  long ans = 0;  if (s+200 <= n)  ans += n - (s+200) + 1;  for (long i = s; i < s+200; i++) {  if (i <= n && i-sumDigits(i) >= s) {   ans++;  }  }  System.out.println(ans);  pw.close(); } private static long sumDigits(long n) {  long sum = 0;  while (n > 0) {  sum += n % 10;  n /= 10;  }  return sum; } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
2	public class C {  public static void main(String[] args) throws InterruptedException{  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  long n = scan.nextLong(), s = scan.nextLong();  long lo = 1, hi = n+1;  for(int bs = 0; bs < 100; bs++) {  long mid = (lo+hi)>>1;  long mid2 = mid;  long c = 0;  while(mid > 0) {   c += mid%10;   mid /= 10;  }  if(mid2-c < s) lo = mid2;  else hi = mid2;  }  out.println(n-lo);  out.close(); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(br.readLine());  } catch (Exception e){e.printStackTrace();}  }  public String next() {  if (st.hasMoreTokens()) return st.nextToken();  try {st = new StringTokenizer(br.readLine());}  catch (Exception e) {e.printStackTrace();}  return st.nextToken();  }  public int nextInt() {return Integer.parseInt(next());}  public long nextLong() {return Long.parseLong(next());}  public double nextDouble() {return Double.parseDouble(next());}  public String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } } }
0	public class D5 {  static int a, v, l, d; static double w;  static double afterMark( int s, double w) {  if (2 * s * a > v * v - w * w) {   return (v - w) * 1.0 / a + (s - (v * v - w * w) * 1.0 / (2 * a)) / v;  } else {   double megav = Math.sqrt((2 * a * s + w * w) * 1.0);  return (megav - w) / a;  } }  public static void main(String args[]) throws IOException {  boolean online = System.getProperty("ONLINE_JUDGE") != null;  Scanner in = online ? new Scanner(System.in) : new Scanner(new FileReader("input.txt"));  PrintWriter out = online ? new PrintWriter(System.out) : new PrintWriter(new FileWriter("output.txt"));    a = in.nextInt();  v = in.nextInt();  l = in.nextInt();  d = in.nextInt();  w = (double) in.nextInt();   double t,t1,t2;  if (v > w) {         if (2 * d * a > 2 * v * v - w * w) {   t1 = (2 * v - w) * 1.0 / a + (d - (2 * v * v - w * w) * 1.0 / (2 * a)) / v;   } else if (2 * d * a > w * w) {   double topv = Math.sqrt(d * a + w * w * 1.0 / 2);   t1 = (2 * topv - w) * 1.0 / a;  } else {   t1 = Math.sqrt(2 * d * 1.0 / a);   w = Math.sqrt(2 * a * d * 1.0);   }    t2 = afterMark(l - d, w);    t = t1 + t2;    } else {  t = afterMark(l, 0.0);   }   out.println(t);  out.flush();  return; } }
6	public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer("");  public static void main(String[] args) {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (Exception e) {  e.printStackTrace();  } }  public static String readString() {  while (!st.hasMoreTokens()) {  try {   st = new StringTokenizer(in.readLine(), " \n\r\t:");  } catch (Exception e) {   e.printStackTrace();  }  }  return st.nextToken(); }  public static int readInt() {  return Integer.parseInt(readString()); }  public static long readLong() {  return Long.parseLong(readString()); }  private static int MAX_VALUE = Integer.MAX_VALUE - 10000000; private static int[] dp; private static int[] parents; private static int[] powers; private static int[] x; private static int[] y; private static int[][] dist; private static int[] distFrom0;  private static void solve() throws IOException {  int x0 = readInt();  int y0 = readInt();  int n = readInt();  long time = System.currentTimeMillis();  x = new int[n];  y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = readInt() - x0;  y[i] = readInt() - y0;  }  dist = new int[n][n];  distFrom0 = new int[n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++) {   dist[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  }  for (int i = 0; i < n; i++) {  distFrom0[i] = x[i] * x[i] + y[i] * y[i];  }  powers = new int[n + 1];  powers[0] = 1;  for (int i = 1; i < n + 1; i++) {  powers[i] = powers[i - 1] * 2;  }  int maxMask = 1 << n;  dp = new int[maxMask];  parents = new int[maxMask];  Arrays.fill(dp, MAX_VALUE);  dp[0] = 0;  for (int i = 0; i < maxMask; i++) {  if (dp[i] != MAX_VALUE) {   int curMask = i;   int notUsed = 0;   for (int j = 0; j < n; j++) {   if ((curMask & powers[j]) == 0) {    notUsed = j;    break;   }   }   int mask = curMask | powers[notUsed];   for (int j = notUsed; j < n; j++) {   if ((powers[j] & curMask) == 0 || j == notUsed) {    int nextMask = mask | powers[j];    int minDist = dp[curMask] + distFrom0[notUsed] + dist[notUsed][j] + distFrom0[j];    if (dp[nextMask] > minDist) {    dp[nextMask] = minDist;    parents[nextMask] = curMask;    }   }   }  }  }     maxMask--;  out.println(dp[maxMask]);  while (maxMask != 0) {  out.print("0 ");  int[] diffBits = getBits(n, maxMask, parents[maxMask]);  for (int i = 1; i <= diffBits[0]; i++) {   out.print(diffBits[i] + 1 + " ");  }  maxMask = parents[maxMask];  }  out.print(0);   }  private static boolean hasBit(int x, int index) {  return (powers[index] & x) != 0; }  private static int setBit(int x, int index) {  return (x | powers[index]); }  private static int getDist(int xFrom, int yFrom, int xTo, int yTo) {  return (xTo - xFrom) * (xTo - xFrom) + (yTo - yFrom) * (yTo - yFrom); }  private static int[] getBits(int n, int nextMask, int curMask) {  int[] res = new int[3];  for (int i = 0; i < n; i++) {  if (hasBit(nextMask, i) ^ hasBit(curMask, i)) {   res[++res[0]] = i;  }  }  return res; }  private static void brute(int n, int mask) {  List<Integer> listNotTaken = new ArrayList<>();  for (int i = 0; i < n; i++) {  if (!hasBit(mask, i)) {   listNotTaken.add(i);  }  }  for (int first : listNotTaken) {  int temp = setBit(mask, first);  for (int second : listNotTaken) {   int nextMask = setBit(temp, second);   int minDist = dp[mask] + getDist(0, 0, x[first], y[first]) + getDist(x[first], y[first], x[second], y[second]) + getDist(x[second], y[second], 0, 0);   if (dp[nextMask] > minDist) {   dp[nextMask] = minDist;   parents[nextMask] = mask;   brute(n, nextMask);   }  }  } } }
5	public class a{  static int a;  static Scanner sc = new Scanner(System.in);  public static void main(String[] args) throws IOException{   int n = sc.nextInt();   int p = n;   int m = sc.nextInt();   int k = sc.nextInt();   int a[] = new int[n];   for (int i = 0; i < n; i++)   {    a[i] = sc.nextInt() - 1;   }   Arrays.sort(a);   int j =0;   for(int i=0; i<n; i++){    if(m > k){     k = k + a[n-i-1];     j++;    }   }   if(m > k)    System.out.println(-1);   else    System.out.println(j);  }  }
1	public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n= sc.nextInt(); int x= (int)Math.sqrt(n) ; int a[] = new int[n+5]; for(int i=1,o=n,j;i<=n;i+=x) for(j=(int)Math.min(i+x-1,n);j>=i;a[j--]=o--); for(int i=1;i<=n;i++)System.out.print(a[i]+" "); System.out.println();  } }
2	public class C{  static long s; public static void main(String[] args)throws IOException {  Reader.init(System.in);  long n=Reader.nextLong();  s=Reader.nextLong();  long lo=1,hi=n,mid;  while(lo<hi){  mid=(lo+hi)/2;  if(diff(mid)>=s)   hi=mid;  else   lo=mid+1;  }  if(diff(lo)>=s)  System.out.println(n-lo+1);  else  System.out.println(0); }  static long diff(long n){  String s=String.valueOf(n);  int sum=0;   for(int i=0;i<s.length();i++){    sum+=Integer.parseInt(s.valueOf(s.charAt(i)));  }  return (n-sum); }    }    class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static long nextLong() throws IOException {   return Long.parseLong( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  } }
1	public class A {  private static int[] prime = new int[] {   2,  3,  5,  7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,   47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107,  109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,  191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,  269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,  353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433,  439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521,  523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613,  617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,  709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809,  811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887,  907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997   };  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();   for (int i=0;i<prime.length-1;i++) {  if ((prime[i]+prime[i+1]+1) > n || k == 0)   break;  if (isPrime(prime[i]+prime[i+1]+1))   k--;  }   if (k == 0)  outnl("YES");  else  outnl("NO"); }  public static boolean isPrime(int x) {  int i=0;  while (i<prime.length)  if (prime[i++] == x)   return true;  return false; }  private static void debug(Object... os) { System.out.println(deepToString(os)); } private static void outnl(String out) { System.out.println(out); }  }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt();   int m=in.nextInt();   int k=in.nextInt();   Integer []cap=new Integer[n];   for(int i=0;i<n;i++) {    cap[i]=in.nextInt();   }   Arrays.sort(cap, Collections.reverseOrder());   int count=0;   while(k<m && count<cap.length) {    k+=(cap[count]-1);    ++count;   }   if(k>=m) {    out.println(count);   } else {    out.println(-1);   }  } } class InputReader {  StringTokenizer st;  BufferedReader in;  public InputReader(InputStream ins)  {   in = new BufferedReader(new InputStreamReader(ins));  }  public String nextToken()  {   while(st==null || !st.hasMoreTokens())   {    try {     st=new StringTokenizer(in.readLine());    } catch (IOException e) {     e.printStackTrace();    }   }   return st.nextToken();  }  public int nextInt()  {   return Integer.parseInt(nextToken());  }  }
3	public class D { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = na(n);  int[] ft = new int[n+3];  int x = 0;  for(int i = n-1;i >= 0;i--){  x ^= sumFenwick(ft, a[i]);  addFenwick(ft, a[i], 1);  }  x &= 1;  for(int Q = ni();Q > 0;Q--){  int l = ni(), r = ni();  long u = (r-l+1)*(r-l)/2;  x ^= u&1;  if(x == 0){   out.println("even");  }else{   out.println("odd");  }  } }  public static int sumFenwick(int[] ft, int i) {  int sum = 0;  for (i++; i > 0; i -= i & -i)  sum += ft[i];  return sum; }  public static void addFenwick(int[] ft, int i, int v) {  if (v == 0 || i < 0)  return;  int n = ft.length;  for (i++; i < n; i += i & -i)  ft[i] += v; }  public static int findGFenwick(int[] ft, int v) {  int i = 0;  int n = ft.length;  for (int b = Integer.highestOneBit(n); b != 0 && i < n; b >>= 1) {  if (i + b < n) {   int t = i + b;   if (v >= ft[t]) {   i = t;   v -= ft[t];   }  }  }  return v != 0 ? -(i + 1) : i - 1; }  public static int valFenwick(int[] ft, int i) {  return sumFenwick(ft, i) - sumFenwick(ft, i - 1); }  public static int[] restoreFenwick(int[] ft) {  int n = ft.length - 1;  int[] ret = new int[n];  for (int i = 0; i < n; i++)  ret[i] = sumFenwick(ft, i);  for (int i = n - 1; i >= 1; i--)  ret[i] -= ret[i - 1];  return ret; }  public static int before(int[] ft, int x) {  int u = sumFenwick(ft, x - 1);  if (u == 0)  return -1;  return findGFenwick(ft, u - 1) + 1; }  public static int after(int[] ft, int x) {  int u = sumFenwick(ft, x);  int f = findGFenwick(ft, u);  if (f + 1 >= ft.length - 1)  return -1;  return f + 1; }  public static int[] buildFenwick(int[] a) {  int n = a.length;  int[] ft = new int[n + 1];  System.arraycopy(a, 0, ft, 1, n);  for (int k = 2, h = 1; k <= n; k *= 2, h *= 2) {  for (int i = k; i <= n; i += k) {   ft[i] += ft[i - h];  }  }  return ft; }  public static int[] buildFenwick(int n, int v) {  int[] ft = new int[n + 1];  Arrays.fill(ft, 1, n + 1, v);  for (int k = 2, h = 1; k <= n; k *= 2, h *= 2) {  for (int i = k; i <= n; i += k) {   ft[i] += ft[i - h];  }  }  return ft; }   void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new D().run(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
4	public class C {  private static FastReader fr = new FastReader();  private static PrintWriter out=new PrintWriter(System.out);  private static Random random = new Random();  public static void main(String[] args) throws IOException {   StringBuilder sb = new StringBuilder();     int t = fr.nextInt();   while (t-- > 0){    int n = fr.nextInt();    int[] arr = fr.nextIntArray(n);    sb.append(1).append("\n");    List<Integer> state = new ArrayList<>();    state.add(1);    for(int i = 1; i < n; i++){     List<Integer> nextState = new ArrayList<>();     boolean found = false;     int till = -1;     for(int j = state.size() - 1; j >= 0; j--){      if(state.get(j) + 1 == arr[i]){       till = j;       found = true;       break;      }     }     if(found){      for(int j = 0; j < till; j++){       nextState.add(state.get(j));      }      nextState.add(arr[i]);      sb.append(nextState.get(0));      for(int z = 1; z < nextState.size(); z++){       sb.append(".").append(nextState.get(z));      }      sb.append("\n");     }     if(!found){      nextState.addAll(state);      nextState.add(arr[i]);      sb.append(nextState.get(0));      for(int z = 1; z < nextState.size(); z++){       sb.append(".").append(nextState.get(z));      }      sb.append("\n");     }     state = nextState;    }   }   System.out.print(sb.toString());  }  static void ruffleSort(int[] a) {   int n=a.length;   for (int i=0; i<n; i++) {    int oi=random.nextInt(n), temp=a[oi];    a[oi]=a[i]; a[i]=temp;   }   Arrays.sort(a);  }  static class FastReader{   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=new StringTokenizer("");   public String next() {    while (!st.hasMoreTokens())     try {      st=new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] nextIntArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   public long nextLong() {    return Long.parseLong(next());   }   public long[] nextLongArray(int n) {    long[] a=new long[n];    for (int i=0; i<n; i++) a[i]=nextLong();    return a;   }  }  static class Pair<A, B>{   A first;   B second;   public Pair(A first, B second){    this.first = first;    this.second = second;   }  }  static long mod(String num, long a)  {     long res = 0;      for (int i = 0; i < num.length(); i++)    res = (res*10 + num.charAt(i) - '0') %a;   return res;  }  static long binomialCoeff(long n, long k, long MOD)  {   long res = 1;      if (k > n - k)    k = n - k;        for (int i = 0; i < k; ++i) {    res *= (n - i);    res /= (i + 1);    res %= MOD;   }   return res;  }  static long power(long x, long y, long p)  {      long res = 1;        x = x % p;   while (y > 0) {           if (y % 2 == 1)     res = (res * x) % p;        y = y >> 1;    x = (x * x) % p;   }   return res;  }    static long modInverse(long n, long p)  {   return power(n, p - 2, p);  }     static long nCrModPFermat(int n, int r,        long p)  {      if (r == 0)    return 1;           long[] fac = new long[n + 1];   fac[0] = 1;   for (int i = 1; i <= n; i++)    fac[i] = fac[i - 1] * i % p;   return (fac[n] * modInverse(fac[r], p)     % p * modInverse(fac[n - r], p)     % p)     % p;  } }
5	public class A {   public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);      int n = sc.nextInt(), m = sc.nextInt(), k = sc.nextInt();  int pl[] = new int[n];  if (k >= m) {  System.out.println(0);  System.exit(0);  }  m -= k;  for (int i = 0; i < n; i++) {  pl[i] = sc.nextInt() - 1;  }  Arrays.sort(pl);  int out = 0;  for (int i = n - 1; i >= 0; i--) {  m -= pl[i];  out++;  if (m <= 0)   break;  }  if (m <= 0)  System.out.println(out);  else  System.out.println(-1); } }
5	public class A2 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = new int[n];  int[] b = new int[n];  for(int i = 0;i < n;i++)b[i] = a[i] = ni();   b = radixSort(b);  int ct = 0;  for(int i = 0;i < n;i++){  if(a[i] != b[i])ct++;  }  if(ct <= 2){  out.println("YES");  }else{  out.println("NO");  } }  public static int[] radixSort(int[] f) {  int[] to = new int[f.length];  {  int[] b = new int[65537];  for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;  for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];  for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];  int[] d = f; f = to;to = d;  }  {  int[] b = new int[65537];  for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;  for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];  for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];  int[] d = f; f = to;to = d;  }  return f; }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception {  new A2().run(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
3	public class D911 {  public static long total = 0; public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  ArrayList<Integer> temp = new ArrayList<>();  int[] ar = new int[n];  int[] memo = new int[n];  for (int i = 0; i < n; i++) {  int t = in.nextInt();  int index = -1*Collections.binarySearch(temp, t)-1;  temp.add(index, t);  ar[i] = t;  memo[i] = i - index;  total += memo[i];  }  int m = in.nextInt();  for (int i = 0; i < m; i++) {   total += (-1*(in.nextInt() - 1 - in.nextInt() + 1) + 1) / 2;  System.out.println(total%2 == 0 ? "even" : "odd");  } }  public static void query(int[] ar, int[] memo, int a, int b) {  if (a >= b) {  return;  }  if (ar[a] < ar[b]) {  memo[a]++;  total++;  } else {  memo[b]--;  total--;  }  int t = ar[a];  ar[b] = ar[a];  ar[b] = t;  t = memo[a];  memo[b] = memo[a];  memo[b] = t;  query(ar, memo, a + 1, b - 1); }  }
1	public class Main2 {  static List<List<Integer>> getLayers(int[] numbers, int a, int b) {  boolean[] used = new boolean[numbers.length];  HashSet<Integer> hs = new HashSet<Integer>();  for (int i = 0; i < numbers.length; i++) {  hs.add(numbers[i]);  }  HashMap<Integer, Integer> numberToIndex = new HashMap<Integer, Integer>();  for (int i = 0; i < numbers.length; i++) {  numberToIndex.put(numbers[i], i);  }  List<List<Integer>> ans = new ArrayList<List<Integer>>();  for (int i = 0; i < numbers.length; i++) {  if (!used[i]) {   List<Integer> ansRow = new ArrayList<Integer>();   LinkedList<Integer> current = new LinkedList<Integer>();   current.add(numbers[i]);   while (!current.isEmpty()) {   int c = current.removeFirst();   used[numberToIndex.get(c)] = true;    boolean found = false;    if (hs.contains(a - c)) {    found = true;    if (a - c != c)    current.add(a - c);   }    if (hs.contains(b - c)) {    found = true;    if (b - c != c)    current.add(b - c);   }    if (found || ansRow.size() > 0)    ansRow.add(c);    hs.remove(c);   }   ans.add(ansRow);  }  }  return ans; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int[] numbers = new int[n];  for (int i = 0; i < numbers.length; i++) {  numbers[i] = sc.nextInt();  }  HashSet<Integer> hs = new HashSet<Integer>();  for (int i = 0; i < numbers.length; i++) {  hs.add(numbers[i]);  }  int[] belongs = new int[n];  for (int i = 0; i < belongs.length; i++) {  belongs[i] = -1;  }  HashMap<Integer, Integer> numberToIndex = new HashMap<Integer, Integer>();  for (int i = 0; i < numbers.length; i++) {  numberToIndex.put(numbers[i], i);  }  boolean possible = true;  List<List<Integer>> layers = getLayers(numbers, a, b);  for (List<Integer> layer : layers) {   if (layer.size() == 0) {   System.out.println("NO");   return;  }   int starting = -1;  for (int j = 0; j < layer.size(); j++) {   int cur = layer.get(j);   int nei = 0;   if (hs.contains(a - cur)) {   nei++;   }   if (hs.contains(b - cur)) {   nei++;   }   if (nei == 1 || (a == b && nei == 2)) {   starting = j;   }  }   if (starting == -1)   throw new Error();   int c = layer.get(starting);  HashSet<Integer> layerset = new HashSet<Integer>(layer);  while (true) {   if (layerset.contains(c) && layerset.contains(a - c)) {   belongs[numberToIndex.get(c)] = 0;   belongs[numberToIndex.get(a - c)] = 0;   layerset.remove(c);   layerset.remove(a - c);   c = b - (a - c);   } else if (layerset.contains(c) && layerset.contains(b - c)) {   belongs[numberToIndex.get(c)] = 1;   belongs[numberToIndex.get(b - c)] = 1;   layerset.remove(c);   layerset.remove(b - c);   c = a - (b - c);   } else {   break;   }   }  }  printResult(belongs);  }  static void printResult(int[] belongs) {  boolean ok = true;  for (int i = 0; i < belongs.length; i++) {  if (belongs[i] < 0)   ok = false;  }  if (ok) {  System.out.println("YES");  StringBuffer sb = new StringBuffer();   for (int i = 0; i < belongs.length; i++) {   sb.append(belongs[i]);   if (i != belongs.length - 1)   sb.append(" ");  }   System.out.println(sb.toString());  } else {  System.out.println("NO");  } } }
4	public class C {  static class Scan {   private byte[] buf=new byte[1024];   private int index;   private InputStream in;   private int total;   public Scan()   {    in=System.in;   }   public int scan()throws IOException   {    if(total<0)    throw new InputMismatchException();    if(index>=total)    {     index=0;     total=in.read(buf);     if(total<=0)     return -1;    }    return buf[index++];   }   public int scanInt()throws IOException   {    int integer=0;    int n=scan();    while(isWhiteSpace(n))    n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n))    {     if(n>='0'&&n<='9')     {      integer*=10;      integer+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    return neg*integer;   }   public double scanDouble()throws IOException   {    double doub=0;    int n=scan();    while(isWhiteSpace(n))    n=scan();    int neg=1;    if(n=='-')    {     neg=-1;     n=scan();    }    while(!isWhiteSpace(n)&&n!='.')    {     if(n>='0'&&n<='9')     {      doub*=10;      doub+=n-'0';      n=scan();     }     else throw new InputMismatchException();    }    if(n=='.')    {     n=scan();     double temp=1;     while(!isWhiteSpace(n))     {      if(n>='0'&&n<='9')      {       temp/=10;       doub+=(n-'0')*temp;       n=scan();      }      else throw new InputMismatchException();     }    }    return doub*neg;   }   public String scanString()throws IOException   {    StringBuilder sb=new StringBuilder();    int n=scan();    while(isWhiteSpace(n))    n=scan();    while(!isWhiteSpace(n))    {     sb.append((char)n);     n=scan();    }    return sb.toString();   }   private boolean isWhiteSpace(int n)   {    if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)    return true;    return false;   }  }   public static void sort(int arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(int arr[],int l1,int r1,int l2,int r2) {   int tmp[]=new int[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }   public static void sort(long arr[],int l,int r) {    if(l==r) {    return;   }   int mid=(l+r)/2;   sort(arr,l,mid);   sort(arr,mid+1,r);   merge(arr,l,mid,mid+1,r);  }  public static void merge(long arr[],int l1,int r1,int l2,int r2) {   long tmp[]=new long[r2-l1+1];   int indx1=l1,indx2=l2;     for(int i=0;i<tmp.length;i++) {    if(indx1>r1) {     tmp[i]=arr[indx2];     indx2++;     continue;    }    if(indx2>r2) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    if(arr[indx1]<arr[indx2]) {     tmp[i]=arr[indx1];     indx1++;     continue;    }    tmp[i]=arr[indx2];    indx2++;   }     for(int i=0,j=l1;i<tmp.length;i++,j++) {    arr[j]=tmp[i];   }  }    public static void main(String args[]) throws IOException {   Scan input=new Scan();   StringBuilder ans=new StringBuilder("");   int test=input.scanInt();   for(int tt=1;tt<=test;tt++) {    int n=input.scanInt();       ArrayList<Integer> arrli[]=new ArrayList[n];    for(int i=0;i<n;i++) {     arrli[i]=new ArrayList<>();    }       for(int i=0;i<n;i++) {     int tmp=input.scanInt();     if(i==0) {      arrli[0].add(1);      continue;     }     if(tmp==1) {      for(int j=0;j<arrli[i-1].size();j++) {       arrli[i].add(arrli[i-1].get(j));      }      arrli[i].add(tmp);      continue;     }     int indx=-1;     for(int j=0;j<arrli[i-1].size();j++) {      if(arrli[i-1].get(j)==tmp-1) {       indx=j;      }     }     for(int j=0;j<indx;j++) {      arrli[i].add(arrli[i-1].get(j));     }     arrli[i].add(tmp);    }    for(int i=0;i<n;i++) {     for(int j=0;j<arrli[i].size();j++) {      ans.append(arrli[i].get(j));      if(j!=arrli[i].size()-1) {       ans.append(".");      }     }     ans.append("\n");    }   }   System.out.println(ans);  }  }
3	public class ProblemD {  public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static StringTokenizer tok = null;  public static void main(String args[]) throws IOException {  tok = new StringTokenizer(in.readLine());  int n = Integer.parseInt(tok.nextToken());   int tab[] = new int[n];  tok = new StringTokenizer(in.readLine());  for (int i=0; i<n; i++)  tab[i] = Integer.parseInt(tok.nextToken());   int inversions = countInversions(tab);  boolean isOdd = inversions % 2 == 1;   tok = new StringTokenizer(in.readLine());  int k = Integer.parseInt(tok.nextToken());   int start, end, len;   for (int i=0; i<k; i++) {  tok = new StringTokenizer(in.readLine());  start = Integer.parseInt(tok.nextToken());  end = Integer.parseInt(tok.nextToken());    len = (end - start + 1) % 4;  if (len == 2 || len ==3)   isOdd = !isOdd;    out.println(isOdd ? "odd" : "even");  }   out.close();   }  private static int countInversions(int tab[]) {  int n = tab.length;  int auxTab[] = new int[n+1];  return _countInversions(tab, 0, n, auxTab); };  private static int _countInversions(int tab[], int start, int end, int auxTab[]) {   if (start+1 >= end)  return 0;   int mid = (start + end) / 2;  int lowerFound = 0;  int higherFound = 0;   int count = 0;   for (int i=start; i<end; i++){  if (tab[i] < mid+1){   count += higherFound;   auxTab[start+lowerFound] = tab[i];   lowerFound++;  } else {   auxTab[mid + higherFound] = tab[i];   higherFound++;  }  }   for (int i=start; i<end; i++)  tab[i] = auxTab[i];   count += _countInversions(tab, start, mid, auxTab);  count += _countInversions(tab, mid, end, auxTab);   return count; }    }
1	public class Naldbah implements Runnable {  boolean isLocalMode = false;  public static void main(String[] args) {   new Naldbah().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(getReader());    tokenizer = null;    writer = new PrintWriter(System.out);       doJob();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  private void doJob() throws IOException {   int n = nextInt();   int k = nextInt();   boolean[] primes = sieve(n + 1);   for(int i=n;i>=2;i--){    if(primes[i]){     int solve = i-1;     int sn=getNextD(primes,solve);     int en = getNextD(primes,n);     while(en!=-1&&sn+en>=solve){      if((sn+en)==solve)k--;      sn=en;      en=getNextD(primes,en);     }    }   }   writer.write(k<=0?"YES":"NO");  }  private int getNextD(boolean[] primes, int i) {   for(int p = i-1;p>=2;p--){    if(primes[p])return p;   }   return -1;  }  public boolean[] sieve(int n)  {   boolean[] prime=new boolean[n+1];   Arrays.fill(prime,true);   prime[0]=false;   prime[1]=false;   int m= (int) Math.sqrt(n);   for (int i=2; i<=m; i++)   if (prime[i])    for (int k=i*i; k<=n; k+=i)     prime[k]=false;   return prime;  }   int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  public Reader getReader() throws FileNotFoundException {   if (isLocalMode) {    return new FileReader("input.txt");   } else {    return new InputStreamReader(System.in);   }  } }
0	public class fuck { public static int[] a;  public static void main(String[] args) {  Scanner input = new Scanner(System.in);  long r = input.nextLong();  long l = input.nextLong();  if((l - r + 1) < 3){  System.out.println(-1);  }  else  {  if(r % 2 == 0)   System.out.println(r + " " + (r +1)+ " " + (r+2) );  else{   if(l -r + 1 >3){   ++r;   System.out.println(r + " " + (r +1)+ " " + (r+2) );   }   else   System.out.println(-1);   }  } } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt();   int[] a = in.nextIntArray(n);   int[] b = a.clone();   Collections.sort(ArrayUtils.asList(b));   int diff = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i])     diff++;   }   out.println(diff <= 2 ? "YES" : "NO");  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1 << 16];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int nextInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c & 15;    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int[] nextIntArray(int count) {   int[] result = new int[count];   for (int i = 0; i < count; i++) {    result[i] = nextInt();   }   return result;  }  } class OutputWriter {  private PrintWriter writer;  public OutputWriter(OutputStream stream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void println(String x) {   writer.println(x);  }  public void close() {   writer.close();  }  } class ArrayUtils {  public static List<Integer> asList(int[] array) {   return new IntList(array);  }  private static class IntList extends AbstractList<Integer> implements RandomAccess {   int[] array;   private IntList(int[] array) {    this.array = array;   }   public Integer get(int index) {    return array[index];   }   public Integer set(int index, Integer element) {    int result = array[index];    array[index] = element;    return result;   }   public int size() {    return array.length;   }  }  }
1	public class BDiv1 { static int n; static int a; static int b; static HashMap<Integer,Integer> graphA=new HashMap<>(); static HashMap<Integer,Integer> graphB=new HashMap<>(); static int [] array; static int [] original; static boolean x=true;  public static void main(String[] args) throws Exception{   BufferedReader buf =new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st =new StringTokenizer(buf.readLine());   n=parseInt(st.nextToken());   a=parseInt(st.nextToken());   b=parseInt(st.nextToken());   st =new StringTokenizer(buf.readLine());   array=new int[n];   original=new int [n];   for (int i=0;i<n;i++){    array[i]=parseInt(st.nextToken());    original[i]=array[i];   }   Arrays.sort(array); for (int i=0;i<n;i++){  int k= Arrays.binarySearch(array,a-array[i]);  if (k>=0){   graphA.put(array[i],array[k]);   graphA.put(array[k],array[i]);  } } for (int i=0;i<n;i++){  int k= Arrays.binarySearch(array,b-array[i]);  if (k>=0){   graphB.put(array[i],array[k]);   graphB.put(array[k],array[i]);  }  }  for (int i=0;i<n;i++){  Integer j=graphA.get(array[i]);  if (j!=null){   if (graphB.containsKey(array[i]) && graphB.containsKey(j)){    graphA.remove(array[i]);    graphA.remove(j);   }   else if (graphB.containsKey(array[i]) && !graphB.containsKey(j)){       graphB.remove(graphB.get(array[i]));    graphB.remove(array[i]);   }   else if (!graphB.containsKey(array[i]) && graphB.containsKey(j)){    graphB.remove(graphB.get(j));    graphB.remove(j);   }    }  } int [] res=new int [n]; for (int i=0;i<n;i++){  if (graphA.containsKey(original[i]))res[i]=0;  else if (graphB.containsKey(original[i])) res[i]=1;  else {   System.out.println("NO");   return;  } } System.out.println("YES"); for (int k:res)System.out.print(k+" "); }  }
6	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int[] x;  int[] y;  int n;  int X, Y;  int[] d;  int[][] dist;  int sqr(int a) {   return a * a;  }  int dist(int X, int Y, int i) {   return sqr(X - x[i]) + sqr(Y - y[i]);  }  int[] dp;  byte[][] pred;  int rec(int mask) {   if (dp[mask] == -1) {    int res = 1 << 29;    boolean ok = false;    for (int i = 0; i < n; ++i)     if ((mask & (1 << i)) > 0) {      ok = true;      int mm = mask & ~(1 << i);      for (int j = i; j < n; j++)       if ((mask & (1 << j)) > 0) {        int nmask = mm & ~(1 << j);        int a = rec(nmask) + d[i] + d[j] + dist[i][j];        if (a < res) {         res = a;         pred[0][mask] = (byte) (i);         pred[1][mask] = (byte) (j);        }       }      break;     }    if (!ok)     res = 0;    dp[mask] = res;   }   return dp[mask];  }  void solve() throws IOException {   X = ni();   Y = ni();   n = ni();   x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = ni();    y[i] = ni();   }   d = new int[n];   dist = new int[n][n];   for (int i = 0; i < n; ++i)    d[i] = dist(X, Y, i);   for (int i = 0; i < n; ++i)    for (int j = 0; j < n; j++) {     dist[i][j] = dist(x[i], y[i], j);    }   pred = new byte[2][1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(rec((1 << n) - 1));   int a = (1 << n) - 1;   while (a > 0) {    if (pred[0][a] != pred[1][a])     out.print(0 + " " + (pred[0][a] + 1) + " " + (pred[1][a] + 1)       + " ");    else     out.print(0 + " " + (pred[0][a] + 1) + " ");    int na = a & ~(1 << pred[0][a]);    na &= ~(1 << pred[1][a]);    a = na;   }   out.println(0);  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
5	public class ProblemA {  BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));  int[] readInts() throws IOException {   String[] strings = reader.readLine().split(" ");   int[] ints = new int[strings.length];   for(int i = 0; i < ints.length; i++) {    ints[i] = Integer.parseInt(strings[i]);   }   return ints;  }  void solve() throws IOException {   int[] tt = readInts();   int n = tt[0];   int m = tt[1];   int k = tt[2];   int[] a = readInts();   Arrays.sort(a);   for(int i = 0, j = a.length - 1; i < j; i++, j--) {    int t = a[i];    a[i] = a[j];    a[j] = t;   }   int ix = 0;   while(k < m && ix < n) {    k += a[ix++] - 1;   }   if(k < m) {    writer.println(-1);   }   else {    writer.println(ix);   }   writer.flush();  }  public static void main(String[] args) throws IOException {   new ProblemA().solve();  } }
4	public class C2 {  String filename = null;  InputReader sc;  void solve() {   int n = sc.nextInt();   int[] a = sc.nextArray(n);   int[] ps = new int[n];   int[] q = new int[n];   int[] qs = new int[n];   int nq = 0;   for (int i = 1; i < n; i++) {    if (a[i] == 1) {     qs[nq] = i - 1;     q[nq++] = a[i - 1] + 1;     ps[i] = i - 1;    } else {     if (a[i] == a[i - 1] + 1) {      qs[nq] = i - 1;      q[nq++] = 1;      ps[i] = i - 1;     } else {      for (int j = nq - 1; j >= 0; j--) {       if (a[i] == q[j]) {        ps[i] = qs[j];        nq = j;        break;       }      }     }    }   }   int[] parents = ps;   String[] strs = new String[n];   strs[0] = "1";   System.out.println(strs[0]);   for (int i = 1; i < n; i++) {    String p = strs[parents[i]];    if (a[i] == 1) {     strs[i] = p + ".1";    } else {     int lastDot = p.lastIndexOf(".");     if (lastDot == -1) {      strs[i] = a[i] + "";     } else {      strs[i] = p.substring(0, lastDot) + "." + a[i];     }    }    System.out.println(strs[i]);   }  }  public void run() throws FileNotFoundException {   if (filename == null) {    sc = new InputReader(System.in);   } else {    sc = new InputReader(new FileInputStream(new File(filename)));   }   int nTests = sc.nextInt();   for (int test = 0; test < nTests; test++) {    solve();   }  }  public static void main(String[] args) {   C2 sol = new C2();   try {    sol.run();   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public float nextFloat() {    return Float.parseFloat(next());   }   public double nextDouble() {    return Float.parseFloat(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public int[] nextArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = nextInt();    }    return a;   }  } }
3	public class InversionCounting { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br.readLine(); int[] a = Arrays.stream(br.readLine().split(" ")).mapToInt(x->Integer.parseInt(x)).toArray(); boolean evenInv = true; for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a.length-1; j++) {  if(a[j]>a[j+1]) {   int temp = a[j];   a[j] = a[j+1];   a[j+1] = temp;   evenInv =!evenInv;  }  } } int q = Integer.parseInt(br.readLine()); for (int i = 0; i < q; i++) {  int[] sw = Arrays.stream(br.readLine().split(" ")).mapToInt(x->Integer.parseInt(x)).toArray();  int len = sw[1]-sw[0];  if((len)*(len+1)%4 != 0) {  evenInv = !evenInv;  }  if(evenInv) {  System.out.println("even");  }else {  System.out.println("odd");  } }  } }
5	public class Main {  public static void main(String[] args) {       Scanner kb = new Scanner(System.in);  int n = kb.nextInt();  int a[] = new int[n];  int b[] = new int[n];  for(int i = 0;i<n;i++){  a[i]=kb.nextInt();  b[i]=a[i];  }  Arrays.sort(a);  int count = 0;  for(int i=0;i<n;i++){  if(a[i]!=b[i])count++;  }  if(count<=2)  System.out.println("YES");  else  System.out.println("NO");  } }
3	public class utkarsh{ BufferedReader br; PrintWriter out;  int game(int s, int mid, int e, int[] a){  int i, j, n, m;  n = mid - s + 1;  m = e - mid;  int b[] = new int[n];  int c[] = new int[m];  for(i = 0; i < n; i++) b[i] = a[s + i];  for(j = 0; j < m; j++) c[j] = a[mid + 1 + j];  i = j = 0;  int ans = 0;  for(int k = s; k <= e; k++){  if(i == n){   a[k] = c[j++];  }else if(j == m){   a[k] = b[i++];  }else{   if(b[i] < c[j]){   a[k] = b[i++];   }else{   a[k] = c[j++];   ans += n - i;   }  }  }  return ans; }  int play(int s, int e, int[] a){  if(s >= e) return 0;  int m = (s + e) >> 1;  return play(s, m, a) + play(m+1, e, a) + game(s, m, e, a); }  void solve(){  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int i, j, k, l, r, n;  n = ni();  int a[] = new int[n];  int d[] = new int[n];  for(i = 0; i < n; i++) {  a[i] = ni();  d[i] = a[i];  }  int ans = (play(0, n-1, d) & 1);  int q = ni();  while(q-- > 0){  l = ni(); r = ni();  ans ^= ((r - l + 1) * (r - l) / 2);    if((ans & 1) > 0) out.println("odd");  else  out.println("even");  }  out.flush(); }  int ni(){  return Integer.parseInt(ns()); }  String ip[]; int len, sz;  String ns(){  if(len >= sz){  try{   ip = br.readLine().split(" ");   len = 0;   sz = ip.length;  }catch(IOException e){   throw new InputMismatchException();  }  if(sz <= 0) return "-1";  }  return ip[len++]; }  public static void main(String[] args){ new utkarsh().solve(); } }
1	public class TwoSets {  static int n, a, b;  static HashSet<Integer> arr = new HashSet<Integer>();  static HashSet<Integer> visited = new HashSet<Integer>();  static HashMap<Integer, Integer> result = new HashMap<Integer, Integer>();  static void dfs(int x, int parent, int len) {   stack.push(x);   visited.add(x);   int children = 0;   if (a - x > 0) {    if (a - x != parent && arr.contains(a - x)) {     dfs(a - x, x, len + 1);     children++;    }   }   if (b - x > 0) {    if (b - x != parent && arr.contains(b - x)) {     dfs(b - x, x, len + 1);     children++;    }   }   if (children == 0) {    if (len % 2 == 1) {     System.out.println("NO");     System.exit(0);    } else {     while (!stack.isEmpty()) {      int first = stack.pop();      int second = stack.pop();      if (first == a - second) {       result.put(first, 0);       result.put(second, 0);      } else {       result.put(first, 1);       result.put(second, 1);      }     }    }   }  }  static Stack<Integer> stack = new Stack<Integer>();  public static void main(String[] args) {   InputReader r = new InputReader(System.in);   n = r.nextInt();   a = r.nextInt();   b = r.nextInt();   int[] list = new int[n];   for (int i = 0; i < n; i++) {    list[i] = r.nextInt();    arr.add(list[i]);   }   for (int x : arr) {    if (!visited.contains(x)) {     if (arr.contains(a - x) && arr.contains(b - x))      continue;     if (arr.contains(a - x) || arr.contains(b - x)) {      dfs(x, -1, 1);     } else {      System.out.println("NO");      System.exit(0);     }    }   }   PrintWriter out = new PrintWriter(System.out);   out.println("YES");   for (int i = 0; i < list.length; i++) {    if (result.get(list[i]) == null)     out.println(0);    else     out.println(result.get(list[i]));   }   out.close();  }  static class InputReader {   private BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream));    tokenizer = null;   }   public InputReader(FileReader stream) {    reader = new BufferedReader(stream);    tokenizer = null;   }   public String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {         e.printStackTrace();     return null;    }   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }  } }
3	public class Main {  static PrintWriter out; static InputReader ir;  static void solve() {  int n=ir.nextInt();  int[] a=ir.nextIntArray(n);  int m=ir.nextInt();  long ret=mergeSort(a,0,n)%2;  int p,q;  for(int i=0;i<m;i++){  p=ir.nextInt()-1;  q=ir.nextInt()-1;  if((q-p)%4==1||(q-p)%4==2)   ret^=1;  f(ret);  } }  public static void f(long a){  if(a==0){  out.println("even");  }  else  out.println("odd"); } public static long mergeSort(int[] a, int left, int right) {   long cnt = 0;   if (left + 1 < right) {    int mid = (left + right) / 2;    cnt += mergeSort(a, left, mid);    cnt += mergeSort(a, mid, right);    cnt += merge(a, left, mid, right);   }   return cnt;  }  public static long merge(int[] a, int left, int mid, int right) {   long cnt = 0;   int n1 = mid - left;   int n2 = right - mid;   int[] l = new int[n1 + 1];   int[] r = new int[n2 + 1];   for (int i = 0; i < n1; i++) {    l[i] = a[left + i];   }   for (int i = 0; i < n2; i++) {    r[i] = a[mid + i];   }   l[n1] = Integer.MAX_VALUE;   r[n2] = Integer.MAX_VALUE;   for (int i = 0, j = 0, k = left; k < right; k++) {    if (l[i] <= r[j]) {     a[k] = l[i];     i++;    } else {     a[k] = r[j];     j++;     cnt += n1 - i;    }   }   return cnt;  }  public static void main(String[] args) throws Exception {  ir = new InputReader(System.in);  out = new PrintWriter(System.out);  solve();  out.flush(); }  static class InputReader {  private InputStream in;  private byte[] buffer = new byte[1024];  private int curbuf;  private int lenbuf;  public InputReader(InputStream in) {  this.in = in;  this.curbuf = this.lenbuf = 0;  }  public boolean hasNextByte() {  if (curbuf >= lenbuf) {   curbuf = 0;   try {   lenbuf = in.read(buffer);   } catch (IOException e) {   throw new InputMismatchException();   }   if (lenbuf <= 0)   return false;  }  return true;  }  private int readByte() {  if (hasNextByte())   return buffer[curbuf++];  else   return -1;  }  private boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  private void skip() {  while (hasNextByte() && isSpaceChar(buffer[curbuf]))   curbuf++;  }  public boolean hasNext() {  skip();  return hasNextByte();  }  public String next() {  if (!hasNext())   throw new NoSuchElementException();  StringBuilder sb = new StringBuilder();  int b = readByte();  while (!isSpaceChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }  public int nextInt() {  if (!hasNext())   throw new NoSuchElementException();  int c = readByte();  while (isSpaceChar(c))   c = readByte();  boolean minus = false;  if (c == '-') {   minus = true;   c = readByte();  }  int res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res = res * 10 + c - '0';   c = readByte();  } while (!isSpaceChar(c));  return (minus) ? -res : res;  }  public long nextLong() {  if (!hasNext())   throw new NoSuchElementException();  int c = readByte();  while (isSpaceChar(c))   c = readByte();  boolean minus = false;  if (c == '-') {   minus = true;   c = readByte();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res = res * 10 + c - '0';   c = readByte();  } while (!isSpaceChar(c));  return (minus) ? -res : res;  }  public double nextDouble() {  return Double.parseDouble(next());  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public char[][] nextCharMap(int n, int m) {  char[][] map = new char[n][m];  for (int i = 0; i < n; i++)   map[i] = next().toCharArray();  return map;  } } }
0	public class A { static String file = ""; static BufferedReader br; static PrintWriter pw; static StringTokenizer st;  public static void main(String[] args) throws NumberFormatException,  IOException {  Locale.setDefault(Locale.US);  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(   System.out)));  long a = nextLong();  long b = nextLong();  if (a % 2 == 1 && b - a == 2 || b - a == 1 || a == b) {  pw.print(-1);  } else {  if (a % 2 == 1)   a++;  pw.print(a + " " + (a + 1) + " " + (a + 2));  }  pw.close(); }  private static double yuza(double x1, double y1, double x2, double y2,  double x3, double y3) {  return (x1 * (y3 - y2) + x2 * (y1 - y3) + x3 * (y2 - y1)); }  private static void ffile() throws IOException {  br = new BufferedReader(new FileReader(file + "in"));  pw = new PrintWriter(new BufferedWriter(new FileWriter(file + "out"))); }  private static int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next()); }  private static long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next()); }  private static double nextDouble() throws NumberFormatException,  IOException {  return Double.parseDouble(next()); }  private static String next() throws IOException {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
6	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] line = in.readLine().split(" ");   int Xs = Integer.parseInt(line[0]);   int Ys = Integer.parseInt(line[1]);   int n = Integer.parseInt(in.readLine());     int[][] points = new int[n+1][2];   points[n][0] = Xs;   points[n][1] = Ys;     for(int i=0; i< n ; i++)   {    line = in.readLine().split(" ");    points[i][0] = Integer.parseInt(line[0]);    points[i][1] = Integer.parseInt(line[1]);   }        int[][] distances = new int[n+1][n+1];   ComputeDistances(points, distances, n);     int[] dp = new int[1<<n];   int[] path = new int[1<<n];   ComputeLowestPath(dp, path, distances, n);   OutputLowestAndPath(dp, path, n);    }     private static void ComputeLowestPath(int[] dp, int[] path, int[][] distances, int n)  {   for(int i = 1; i < 1<<n; i++)   {    int j = 0;    while(true)    {     if((i&(1<<j))!=0)     {      break;     }     j++;    }       int pastEntry = i & ~(1<<j);    path[i] = pastEntry;    int distance = distances[j][n] * 2;    dp[i] = dp[pastEntry] + distance;        for(int m = j +1; m < n; m++)    {     if((i & (1<<m))!=0)     {      int entry = i & ~((1<<j)|(1<<m));      distance = distances[j][n] + distances[j][m] + distances[m][n];            if(dp[i] > dp[entry] + distance)      {       dp[i] = dp[entry] + distance;       path[i] = entry;      }     }    }      }  }   private static void OutputLowestAndPath(int[] dp, int[] path, int n)  {     StringBuilder out = new StringBuilder();   out.append(dp[(1<<n)-1]);   out.append("\n");   out.append("0 ");   int index = (1<<n)-1;   while(index != 0)   {    int j = path[index];    int k = index ^ j;    for(int m = 0; m < n; m++)    {     if((k & (1 << m)) != 0)     {      out.append(m+1);      out.append(" ");     }    }    out.append("0 ");    index = j;   }   System.out.println(out.toString());  }   private static void ComputeDistances(int[][] points, int[][] distances, int n)  {   for(int i = 0; i <= n; i++)   {    for(int j=i+1; j<=n; j++)    {     int x= points[i][0] - points[j][0];     int y= points[i][1] - points[j][1];     distances[i][j] = x*x + y*y;    }   }  }  }
1	public class GFG { public static void main (String[] args) {  Scanner sc = new Scanner (System.in);  int n = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int c = sc.nextInt();  int ans = 0;  int t= sc.nextInt();  int arr[] = new int[n];  for(int i=0;i<n;i++){   int nn = sc.nextInt();   ans+=a;   if(b<c){    ans += (t-nn) * (c - b);   }  }  System.out.println(ans); } }
5	public class Main {  public static void main(String[] args) {  Scanner cin=new Scanner(new BufferedInputStream(System.in));   int n=cin.nextInt(),   m=cin.nextInt(),   k=cin.nextInt();  int[] a=new int[51];   for (int i=0;i<n;i++) {  a[i]=-cin.nextInt();  }  Arrays.sort(a);   if (m<=k) {   System.out.println(0);   return;  }  for (int i=0;i<Math.min(k,n);i++) {  m+=a[i];  if (m-(k-1-i)<=0) {   System.out.println(i+1);   return;  }  }  for (int i=k;i<n;i++) {  m+=a[i]+1;  if (m<=0) {   System.out.println(i+1);   return;  }  }  System.out.println(-1);   cin.close(); } }
4	public class Deltix {  static PrintWriter out;  public static void main(String[] args) {   MyScanner sc = new MyScanner();   out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   while (t-- > 0) {    int n = sc.nextInt();    Stack<Integer> s = new Stack<>();    int [] a = new int[n];    for (int i = 0; i < n; ++i) a[i] = sc.nextInt();    for (int i = 0; i < n; i++) {     if (a[i] == 1) {      s.push(1);     } else {      while (s.peek() != a[i] - 1) {       s.pop();      }      s.pop();      s.push(a[i]);     }     print(s);    }   }   out.close();  }  static void print(Stack<Integer> s) {   ArrayDeque<Integer> a = new ArrayDeque<>();   while (!s.isEmpty()) {    a.addFirst(s.pop());   }   while (!a.isEmpty()) {    int x = a.pollFirst();    out.print(x);    s.push(x);    if (a.size() != 0) out.print(".");   }   out.println();  }   static void sort(int[] a) {   ArrayList<Integer> q = new ArrayList<>();   for (int i : a) q.add(i);   Collections.sort(q);   for (int i = 0; i < a.length; i++) a[i] = q.get(i);  }  static void sort(long[] a) {   ArrayList<Long> q = new ArrayList<>();   for (long i : a) q.add(i);   Collections.sort(q);   for (int i = 0; i < a.length; i++) a[i] = q.get(i);  }    public static class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   } }
6	public class CodeD { static class Scanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer("");   public String nextLine()  {  try  {   return br.readLine();  }  catch(Exception e)  {   throw(new RuntimeException());  }  }   public String next()  {  while(!st.hasMoreTokens())  {   String l = nextLine();   if(l == null)   return null;   st = new StringTokenizer(l);  }  return st.nextToken();  }   public int nextInt()  {  return Integer.parseInt(next());  }   public long nextLong()  {  return Long.parseLong(next());  }   public double nextDouble()  {  return Double.parseDouble(next());  }   public int[] nextIntArray(int n)  {  int[] res = new int[n];  for(int i = 0; i < res.length; i++)   res[i] = nextInt();  return res;  }   public long[] nextLongArray(int n)  {  long[] res = new long[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }   public double[] nextDoubleArray(int n)  {  double[] res = new double[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }  public void sortIntArray(int[] array)  {  Integer[] vals = new Integer[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortLongArray(long[] array)  {  Long[] vals = new Long[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortDoubleArray(double[] array)  {  Double[] vals = new Double[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  } } static final Scanner sc; static final int n; static final int[][] distancias; static final int[] distancia; static final int[] dp; static final int[] dpNext; static final int X; static final int Y;  static {  sc = new Scanner();  X = sc.nextInt();  Y = sc.nextInt();  n = sc.nextInt();  distancias = new int[n][n];  distancia = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  dpNext = new int[1 << n]; }   static int dp(int mascara) {  if(dp[mascara] != -1)  return dp[mascara];  int highest = -1;  for(int i = 0, tmp = mascara; tmp != 0; i++, tmp >>= 1)  {  if((tmp & 1) == 1)  {   highest = i;   break;  }  }  if(highest == -1)  return 0;  int nextMsc = mascara ^ (1 << highest);  int costHighest = distancia[highest];  int best = (costHighest << 1) + dp(nextMsc);  int bestNext = nextMsc;  for(int i = 0, tmp = nextMsc, iC = 1; tmp != 0; i++, tmp >>= 1, iC <<= 1)  {  if((tmp & 1) == 1)  {   int msc = nextMsc ^ iC;   int possibleA = costHighest + distancias[highest][i] + distancia[i] + dp(msc);   if(possibleA < best)   {   best = possibleA;   bestNext = msc;   }  }  }  dpNext[mascara] = bestNext;  return dp[mascara] = best;   } public static void main(String[] args) {  int[][] objetos = new int[n][2];  for(int i = 0; i < n; i++)  {  objetos[i][0] = sc.nextInt();  objetos[i][1] = sc.nextInt();  distancia[i] = (X - objetos[i][0]) * (X - objetos[i][0]) + (Y - objetos[i][1]) * (Y - objetos[i][1]);  }  for(int i = 0; i < n; i++)  for(int j = 0; j < n; j++)   distancias[i][j] = (objetos[i][0] - objetos[j][0]) * (objetos[i][0] - objetos[j][0]) + (objetos[i][1] - objetos[j][1]) * (objetos[i][1] - objetos[j][1]);  int ans = dp((1 << n) - 1);  System.out.println(ans);  int current = (1 << n) - 1;  while(current != 0)  {  int next = dpNext[current];  int differents = next ^ current;  System.out.print("0 ");  for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   System.out.print((i + 1) + " ");  current = next;  }  System.out.println("0"); } }
2	public class Main {  static class Task {   PrintWriter out;   int[] num = new int[3];   public void solve(MyScanner in, PrintWriter out) {    this.out = out;    long n = in.nextLong();    long s = in.nextLong();    long l = 1;    long r = n;    while (r - l > 5) {     long x = (l + r) / 2;     long ans = ans(x);     if (ans >= s) {      r = x;     } else {      l = x;     }    }    for (long i = l; i <= r; i++) {     if (ans(i) >= s) {      out.println((n - i + 1));      return;     }    }    out.println(0);   }   long ans(long n) {    long res = n;    while (n > 9) {     res -= n % 10;     n /= 10;    }    res -= n;    return res;   }  }  public static void main(String[] args) {   MyScanner in = new MyScanner();   PrintWriter out = new PrintWriter(System.out);   Task solver = new Task();   solver.solve(in, out);   out.close();  }  public static class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
4	public class x1523C {  public static void main(String hi[]) throws Exception  {   BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(infile.readLine());   int T = Integer.parseInt(st.nextToken());   StringBuilder sb = new StringBuilder();   while(T-->0)   {    st = new StringTokenizer(infile.readLine());    int N = Integer.parseInt(st.nextToken());    int[] arr = new int[N];    for(int i=0; i < N; i++)     arr[i] = Integer.parseInt(infile.readLine());    ArrayList<Integer>[] buckets = new ArrayList[N];    buckets[0] = new ArrayList<Integer>();    buckets[0].add(arr[0]);       for(int i=1; i < N; i++)    {     ArrayList<Integer> ls = new ArrayList<Integer>();     if(arr[i] == 1)     {      for(int x: buckets[i-1])       ls.add(x);      ls.add(1);     }     else     {      int dex = -1;      for(int a=0; a < buckets[i-1].size(); a++)       if(buckets[i-1].get(a) == arr[i]-1)        dex = a;      for(int a=0; a < dex; a++)       ls.add(buckets[i-1].get(a));      ls.add(arr[i]);     }     buckets[i] = ls;    }       for(int a=0; a < N; a++)    {     for(int i=0; i < buckets[a].size()-1; i++)     {      sb.append(buckets[a].get(i));      sb.append(".");     }     sb.append(arr[a]);     sb.append("\n");    }   }   System.out.print(sb);  } }
6	public class ProblemC_008 implements Runnable{  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in; OutputWriter out; StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args){  new Thread(null, new ProblemC_008(), "", 128 * (1L << 20)).start(); }    void init() throws FileNotFoundException{  Locale.setDefault(Locale.US);   if (ONLINE_JUDGE){  in = new BufferedReader(new InputStreamReader(System.in));  out = new OutputWriter(System.out);  }else{  in = new BufferedReader(new FileReader("input.txt"));  out = new OutputWriter("output.txt");  } }    long timeBegin, timeEnd;  void time(){  timeEnd = System.currentTimeMillis();  System.err.println("Time = " + (timeEnd - timeBegin)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    String delim = " ";  String readString() throws IOException{  while(!tok.hasMoreTokens()){  try{   tok = new StringTokenizer(in.readLine());  }catch (Exception e){   return null;  }  }   return tok.nextToken(delim); }  String readLine() throws IOException{  return in.readLine(); }    final char NOT_A_SYMBOL = '\0';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException{  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException{  int[] array = new int[size];   for (int index = 0; index < size; ++index){  array[index] = readInt();  }   return array; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }    Point readPoint() throws IOException{  return new Point(readInt(), readInt()); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    class OutputWriter extends PrintWriter{  final int DEFAULT_PRECISION = 12;   int precision;  String format, formatWithSpace;   {  precision = DEFAULT_PRECISION;    format = createFormat(precision);  formatWithSpace = format + " ";  }   public OutputWriter(OutputStream out) {  super(out);  }  public OutputWriter(String fileName) throws FileNotFoundException {  super(fileName);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   private String createFormat(int precision){  return "%." + precision + "f";  }   @Override  public void print(double d){  printf(format, d);  }   public void printWithSpace(double d){  printf(formatWithSpace, d);  }  public void printAll(double...d){  for (int i = 0; i < d.length - 1; ++i){   printWithSpace(d[i]);  }    print(d[d.length - 1]);  }   @Override  public void println(double d){  printlnAll(d);  }   public void printlnAll(double... d){  printAll(d);  println();  } }    int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};   boolean check(int index, int lim){  return (0 <= index && index < lim); }    void solve() throws IOException{  Point bag = readPoint();   int n = readInt();   Point[] points = new Point[n];   for (int i = 0; i < n; ++i){  points[i] = readPoint();  }   int[] dist = new int[n];  for (int i = 0; i < n; ++i){  int dx = points[i].x - bag.x;  int dy = points[i].y - bag.y;    dist[i] = dx * dx + dy * dy;  }   int[][] d = new int[n][n];  for (int i = 0; i < n; ++i){  for (int j = 0; j < n; ++j){   int dx = points[i].x - points[j].x;   int dy = points[i].y - points[j].y;     d[i][j] = dx * dx + dy * dy;   d[i][j] += dist[i] + dist[j];  }  }   int[] singleMasks = new int[n];  for (int i = 0; i < n; ++i){  singleMasks[i] = (1 << i);  }   int[][] doubleMasks = new int[n][n];  for (int i = 0; i < n; ++i){  for (int j = 0; j < n; ++j){   doubleMasks[i][j] = (singleMasks[i] | singleMasks[j]);  }  }   int lim = (1 << n);  int[] dp = new int[lim];   Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;   int[] p = new int[lim];  Arrays.fill(p, -1);   for (int mask = 0; mask < lim; ++mask){  if (dp[mask] == Integer.MAX_VALUE){   continue;  }    int minBit = -1;    for (int bit = 0; bit < n; ++bit){   if (checkBit(mask, bit)) continue;     if (minBit == -1 || (dist[minBit] > dist[bit])){   minBit = bit;   }  }    if (minBit == -1){   continue;  }    for (int bit = 0; bit < n; ++bit){   if (checkBit(mask, bit)) continue;     int newMask = (mask | (1 << minBit) | (1 << bit));     if (dp[newMask] > dp[mask] + d[minBit][bit]){   dp[newMask] = dp[mask] + d[minBit][bit];   p[newMask] = minBit * n + bit;   }  }  }   out.println(dp[lim-1]);   int curMask = lim - 1;  while (p[curMask] != -1){  out.print("0 ");    int first = p[curMask] / n;  int second = p[curMask] % n;    out.print((first + 1) + " ");  curMask ^= (1 << first);    if (first != second){   out.print((second + 1) + " ");   curMask ^= (1 << second);  }  }   out.println("0"); }  private boolean checkBit(int mask, int bitNumber) {  return (mask & (1 << bitNumber)) != 0; }  boolean checkMask(int mask, int innerMask){  return (mask & innerMask) == innerMask; } }
3	public class Codeshefcode{ public static void main(String[] args) throws IOException{      new Thread(null,new Runnable(){  public void run(){   Solver Machine = new Solver() ;   try{   Machine.Solve() ;   Machine.Finish() ;   }catch(Exception e){   e.printStackTrace() ;   System.out.flush() ;   System.exit(-1) ;   }catch(Error e){   e.printStackTrace() ;   System.out.flush() ;   System.exit(-1) ;   }  }  },"Solver",1l<<27).start() ; } } class Mod{ static long mod=1000000007 ; static long d(long a,long b){ return (a*MI(b))%mod ; } static long m(long a,long b){ return (a*b)%mod ; } static private long MI(long a){ return pow(a,mod-2) ; } static long pow(long a,long b){  if(b<0) return pow(MI(a),-b) ;  long val=a ; long ans=1 ;  while(b!=0){  if((b&1)==1) ans = (ans*val)%mod ;   val = (val*val)%mod ;   b/=2 ;  }  return ans ; } } class pair implements Comparable<pair>{ int x ; int y ;  pair(int x,int y){ this.x=x ; this.y=y ;}  public int compareTo(pair p){  return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ; } } class Solver{ Reader ip = new Reader(System.in) ;  PrintWriter op = new PrintWriter(System.out) ; public void Solve() throws IOException{  int n = ip.i() ;  int a[] = new int[n] ;  for(int i=0 ; i<n ; i++) a[i] = ip.i() ;  int num=0 ;  for(int i=0 ; i<n ; i++)  for(int j=(i+1) ; j<n ; j++)   if(a[i]>a[j])   num++ ;  num%=2 ;  int m = ip.i() ;  while(m--!=0){  int l = ip.i() ;  int r = ip.i() ;  int d = (r-l+1) ;  int mod = d%4 ;  int bit ;  if(mod<=1) bit=0 ; else bit=1 ;  num+=bit ;  num%=2 ;  pln(num==1 ? "odd" : "even") ;  } } void Finish(){  op.flush();  op.close(); } void p(Object o){  op.print(o) ; } void pln(Object o){  op.println(o) ; }  } class mylist extends ArrayList<Integer>{} class myset extends TreeSet<Integer>{} class mystack extends Stack<Integer>{} class mymap extends TreeMap<Long,Integer>{} class Reader { BufferedReader reader; StringTokenizer tokenizer; Reader(InputStream input) {  reader = new BufferedReader(   new InputStreamReader(input) );  tokenizer = new StringTokenizer("") ; } String s() throws IOException {  while (!tokenizer.hasMoreTokens()){  tokenizer = new StringTokenizer(  reader.readLine()) ;  }  return tokenizer.nextToken(); } int i() throws IOException {  return Integer.parseInt(s()) ; } long l() throws IOException{  return Long.parseLong(s()) ; } double d() throws IOException {  return Double.parseDouble(s()) ; } }
5	public class Solution {    private static StringTokenizer st;  private static java.io.BufferedReader reader;  private static java.io.BufferedWriter writer;  private static long nextLong() {   return Long.parseLong(st.nextToken());  }  private static int nextInt() {   return Integer.parseInt(st.nextToken());  }  private static double nextDouble() {   return Double.parseDouble(st.nextToken());  }  private static short nextShort() {   return Short.parseShort(st.nextToken());  }  private static byte nextByte() {   return Byte.parseByte(st.nextToken());  }  private static void initTokenizer() throws Exception {   st = new StringTokenizer(reader.readLine());  }      public static void main(String[] args) throws Exception { reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in), 1 << 20); writer = new java.io.BufferedWriter(new java.io.OutputStreamWriter(System.out));    initTokenizer(); int n = nextInt(); int m = nextInt(); int k = nextInt();  initTokenizer(); int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt(); }  Arrays.sort(a);  int total = k; int cnt = 0;  while (total < m && cnt < a.length) {  total += a[a.length - 1 - cnt] - 1;  cnt++; }  if (total >= m) System.out.println(cnt); else System.out.println(-1);  } }
4	public class C {  static class Node{   StringBuilder sb = new StringBuilder();   Stack<Integer> stk = new Stack<>();  }  public static void main(String[] args) throws IOException {   Soumit sc = new Soumit();   int t = sc.nextInt();   StringBuilder sb = new StringBuilder();   while (t-->0){    int n = sc.nextInt();    int[] arr = sc.nextIntArray(n);    Stack<Node> mainstk = new Stack<>();    Node pnode = new Node();    pnode.stk.push(1);    pnode.sb.append("1");    mainstk.push(pnode);    sb.append(pnode.sb).append("\n");    for(int i=1;i<n;i++){     int val = arr[i];     if(val==1){      Node node = new Node();      node.stk.push(1);      node.sb.append(mainstk.peek().sb).append(".1");      mainstk.push(node);      sb.append(node.sb).append("\n");     }     else {      while (true) {       Node node = mainstk.pop();       if (node.stk.peek()==val-1) {        node.stk.push(val);        if(mainstk.isEmpty()){         node.sb = new StringBuilder();         node.sb.append(val);         sb.append(val).append("\n");        }        else{         Node peeknode = mainstk.peek();         node.sb = new StringBuilder();         node.sb.append(peeknode.sb).append(".").append(val);         sb.append(peeknode.sb).append(".").append(val).append("\n");        }        mainstk.push(node);        break;       }      }     }    }   }   System.out.println(sb);   sc.close();  }  static class Soumit {   final private int BUFFER_SIZE = 1 << 18;   final private DataInputStream din;   final private byte[] buffer;   private PrintWriter pw;   private int bufferPointer, bytesRead;   StringTokenizer st;   public Soumit() {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public Soumit(String file_name) throws IOException {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }   public void streamOutput(String file) throws IOException {    FileWriter fw = new FileWriter(file);    BufferedWriter bw = new BufferedWriter(fw);    pw = new PrintWriter(bw);   }   public void println(String a) {    pw.println(a);   }   public void print(String a) {    pw.print(a);   }   public String readLine() throws IOException {    byte[] buf = new byte[3000064];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n')      break;     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public void sort(int[] arr) {    ArrayList<Integer> arlist = new ArrayList<>();    for (int i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public void sort(long[] arr) {    ArrayList<Long> arlist = new ArrayList<>();    for (long i : arr)     arlist.add(i);    Collections.sort(arlist);    for (int i = 0; i < arr.length; i++)     arr[i] = arlist.get(i);   }   public int[] nextIntArray(int n) throws IOException {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   public long[] nextLongArray(int n) throws IOException {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   public double[] nextDoubleArray(int n) throws IOException {    double[] arr = new double[n];    for (int i = 0; i < n; i++) {     arr[i] = nextDouble();    }    return arr;   }   public int nextInt() throws IOException {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public long nextLong() throws IOException {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }   public double nextDouble() throws IOException {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }    if (neg)     return -ret;    return ret;   }   private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }   private byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }   public void close() throws IOException {       if (din != null) din.close();    if (pw != null) pw.close();   }  } }
0	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Scanner in = new Scanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskD solver = new TaskD();  solver.solve(1, in, out);  out.close(); } } class TaskD {  public void solve(int testNumber, Scanner in, PrintWriter out) {   String[] str = in.nextLine().split(" ");   int a = Integer.parseInt(str[0]);   int v = Integer.parseInt(str[1]);   str = in.nextLine().split(" ");   int l = Integer.parseInt(str[0]);   int d = Integer.parseInt(str[1]);   int w = Integer.parseInt(str[2]);    double minTime = 0.;   if (w >= v) {    minTime = getTimeAfterSign(0, v, l, a);    out.format(Locale.US, "%.6f", minTime);    return;   }   double whenGetSpeedWPath = (w * w) / (2. * a);   if (whenGetSpeedWPath >= d) {    double time = Math.sqrt((2.0 * d) / a);    minTime = time + getTimeAfterSign(a * time, v, l - d, a);   } else {    double stopPath = (v * v - w * w) / (2. * a);    double vMaxPath = (v * v) / (2. * a);    if (stopPath + vMaxPath > d) {      double topSpeed = Math.sqrt((2. * a * d + w * w) / 2);     minTime = (2. * topSpeed - w) / a + getTimeAfterSign(w, v, l - d, a);    } else {     double stopTime = (v - w) / (a + 0.);     double getMaxTime = v / (a + 0.);     double maxTime = (d - (stopPath + vMaxPath)) / v;     minTime = stopTime + getMaxTime + maxTime + getTimeAfterSign(w, v, l - d, a);    }   }   out.format(Locale.US, "%.6f", minTime);  }  double getTimeAfterSign(double startSpeed, double maxSpeed, double path, int a) {   double maxSpeedTime = (maxSpeed - startSpeed) / a;   double maxSpeedPath = startSpeed * maxSpeedTime + (a * maxSpeedTime * maxSpeedTime) / 2;   if (maxSpeedPath > path) {    return (-startSpeed + Math.sqrt(startSpeed * startSpeed + 2 * a * path)) / a;   } else {    return maxSpeedTime + (path - maxSpeedPath) / maxSpeed;   }  } }
5	public class A {  static StreamTokenizer st;  static class Sort implements Comparable<Sort> {   int val;   public int compareTo(Sort o) {    return this.val-o.val;   }  }  public static void main(String[] args) throws IOException{   st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   Sort[]a = new Sort[n+1];   int[]b = new int[n+1];   for (int i = 1; i <= n; i++) {    a[i] = new Sort();    a[i].val = nextInt();    b[i] = a[i].val;   }   Arrays.sort(a, 1, n+1);   int k1 = 0, k2 = 0;   for (int i = 1; i <= n; i++) {    if (b[i] != a[i].val) {     if (k1==0)      k1 = i;     else if (k2==0)      k2 = i;     else {      System.out.println("NO");      return;     }    }   }   if (k1==0)    System.out.println("YES");   else if (k2==0)    System.out.println("NO");   else {    if (b[k1]==a[k2].val && b[k2]==a[k1].val)     System.out.println("YES");    else     System.out.println("NO");   }   pw.close();  }  private static int nextInt() throws IOException{   st.nextToken();   return (int) st.nval;  } }
0	public class C {   public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tokenizer= new StringTokenizer(br.readLine());  BigInteger left = new BigInteger(tokenizer.nextToken());  BigInteger right= new BigInteger(tokenizer.nextToken());  BigInteger val= (right.subtract(left)).add(new BigInteger(""+1));  if(val.intValue()<3){  System.out.println(-1);  return;    }   BigInteger a, b, c;  BigInteger i=left;  while(i.intValue()<=right.intValue()){  BigInteger temp1=i;   BigInteger temp2= i.add(new BigInteger(""+1));  BigInteger j=temp2.add(new BigInteger(""+1));  while(j.intValue()<=right.intValue()){   BigInteger b1= temp2;   BigInteger b2 =j;   BigInteger b3 = temp1;   BigInteger gcd= b1.gcd(b2);   if(gcd.intValue()==1){   BigInteger gcd2 =b2.gcd(b3);   if(gcd2.intValue() !=1){    a=b3;    b= b1;    c= b2;    System.out.print(a+" "+b+" "+c+" ");    System.out.println();    return ;   }   }   j=j.add(new BigInteger(""+1));  }  i=i.add(new BigInteger(""+1));  }  System.out.println(-1); } }
2	public class P {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  long N = sc.nextLong(), S = sc.nextLong();  long lo = 0, hi = N;  long pivot = 0;  while (lo <= hi) {  long mid = lo + (hi - lo) / 2;  int sumOfDigits = 0;  long saveMid = mid;  while (saveMid > 0) {   sumOfDigits += saveMid % 10;   saveMid /= 10;  }  if (mid - sumOfDigits < S) {   pivot = mid;   lo = mid + 1;  } else   hi = mid - 1;  }  System.out.println(N - pivot); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String f) throws FileNotFoundException {  br = new BufferedReader(new FileReader(f));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  }  public int[] nextIntArray(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public int[] nextIntArray1(int n) throws IOException {  int[] a = new int[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextInt();  return a;  }  public int[] shuffle(int[] a, int n) {  int[] b = new int[n];  for (int i = 0; i < n; i++)   b[i] = a[i];  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = b[i];   b[i] = b[j];   b[j] = t;  }  return b;  }  public int[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  a = shuffle(a, n);  Arrays.sort(a);  return a;  }  public long[] nextLongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArray1(int n) throws IOException {  long[] a = new long[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArraySorted(int n) throws IOException {  long[] a = nextLongArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   long t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  } } }
5	public class Solution implements Runnable {  void solve() throws Exception {  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int a [] = new int [n];  for (int i = 0; i < n; i++) {  a[i] = sc.nextInt();  }  Arrays.sort(a);  if (k >= m) {  out.println(0);  return;  }  int sum = k;  for (int j = n - 1; j >= 0; j--) {  sum--;  sum += a[j];  if (sum >= m) {   out.println((n - j));   return;  }  }  out.println(-1); }  BufferedReader in; PrintWriter out; FastScanner sc;  static Throwable uncaught;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Solution.uncaught = t;  } finally {  out.close();  } }  public static void main(String[] args) throws Throwable {  Thread t = new Thread(null, new Solution(), "", (1 << 26));  t.start();  t.join();  if (uncaught != null) {  throw uncaught;  } } } class FastScanner {  BufferedReader reader; StringTokenizer strTok;  public FastScanner(BufferedReader reader) {  this.reader = reader; }  public String nextToken() throws IOException {  while (strTok == null || !strTok.hasMoreTokens()) {  strTok = new StringTokenizer(reader.readLine());  }  return strTok.nextToken(); }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
3	public class d {   public static void main(String args[]) throws IOException {  FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();  int perm[] = new int[n];  for(int i = 0; i < n; i++) {  perm[i] = in.nextInt();  }  int q = in.nextInt();   int inv[] = new int[n];  inv[0] = 0;  for(int i = 1; i < n; i++) {  inv[i] = inv[i-1];  for(int j = i - 1; j >= 0; j--) {   if(perm[i] < perm[j]) inv[i]++;  }  }  boolean parity = inv[n-1] % 2 == 0;   for(int i = 0; i < q; i++) {  int l = in.nextInt() - 1;  int r = in.nextInt() -1;   if(l == r) {   System.out.println(parity?"even":"odd");   continue;  }   int s = r - l + 1;  s = s * (s-1)/ 2;  if(s % 2 != 0) {   parity = !parity;  }  System.out.println(parity?"even":"odd");  }  out.close(); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(InputStream i) {  br = new BufferedReader(new InputStreamReader(i));  st = null;  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public String nextLine() throws IOException {  if (st == null) {   st = new StringTokenizer(br.readLine());  }  String line = st.nextToken("\n");  st = null;  return line;  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  public static class combinatorics {  static long modInv(long a, long b) {  return 1 < a ? b - modInv(b % a, a) * b / a : 1;  }  static long factorial[], mod;  combinatorics(int n, long MOD) {  mod = MOD;  factorial = new long[n + 1];  factorial[0] = 1;  for (int i = 1; i <= n; i++) {   factorial[i] = i * factorial[i - 1];   factorial[i] %= mod;  }  }  static long nCr(int n, int r) {  if (r > n)   return 0;  return (factorial[n] * modInv((factorial[n - r] * factorial[r]) % mod, mod)) % mod;  } }  public static class DisjointSet {  int p[], r[], s[];  int numDisjoint;  DisjointSet(int N) {  numDisjoint = N;  r = new int[N];  s = new int[N];  p = new int[N];  for (int i = 0; i < N; i++)   p[i] = i;  }  int findSet(int i) {  return (p[i] == i) ? i : (p[i] = findSet(p[i]));  }  boolean isSameSet(int i, int j) {  return findSet(i) == findSet(j);  }  void unionSet(int i, int j) {  if (!isSameSet(i, j))   {   numDisjoint--;   int x = findSet(i), y = findSet(j);   if (r[x] > r[y]) {   p[y] = x;    s[x] += s[y];   } else {   p[x] = y;   if (r[x] == r[y])    r[y]++;   s[y] += s[x];   }  }  }  int sizeOfSet(int i) {  return s[findSet(i)];  } }; }
6	public class Main { public static int n, x, y; public static int[] a,b; public static int dp[], before[]; public static int dx[]; public static int d[][]; public static final int INF = 24 * 201 * 201;  public static void main(String[] argv) {  FastScanner scan = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);   x = scan.nextInt();  y = scan.nextInt();   n = scan.nextInt();   a = new int[n+1];  b = new int[n+1];  dx = new int[n+1];  d = new int[n+1][n+1];  for(int i = 0; i < n; ++i){  a[i] = scan.nextInt();  b[i] = scan.nextInt();  }   for(int i = 0; i < n; ++i){  dx[i] = dist(i);  }  for(int i = 0; i < n; ++i){  for(int j = 0; j < n; ++j){   d[i][j] = dist(i,j);  }  }   dp = new int[1 << n];  before = new int[1 << n];  Arrays.fill(dp, INF);  dp[0] = 0;  for(int state = 0; state < (1<<n); state++){    for(int i = 0; i < n; ++i){   int ii = (1 << i);   if((state & ii) > 0){   if(dp[state - ii] == INF) continue;   int newdist = dp[state - ii] + dx[i] + dx[i];   if(dp[state] > newdist){    dp[state] = newdist;    before[state] = state - ii;   }      } else continue;     for(int j = i + 1; j < n; ++j){   if(i == j) continue;   int jj = (1 << j);   if((state & jj) > 0){    if(dp[state - ii - jj] == INF) continue;    int newdist = dp[state - ii - jj] + dx[i] + d[i][j] + dx[j];    if(dp[state] > newdist){    dp[state] = newdist;    before[state] = state - ii - jj;    }       }   }   break;  }  }  System.out.println(dp[(1<<n)-1]);  int state = (1<<n) - 1;  StringBuffer ret = new StringBuffer();  while(state > 0){  int nstate = before[state];  boolean find = false;  String made = "";  for(int i = 0; i < n; ++i){   if(((state & (1<<i)) > 0) && ((nstate & (1<<i)) == 0)){   find = true;   made = made + " " + (i + 1);   }  }  if(find){   made = made + " 0";   ret.append(made, 0, made.length());  }  state = nstate;  }  out.println("0" + ret.toString());  out.close(); } public static int dist(int to){  return Math.abs(a[to] - x) * Math.abs(a[to] - x) + Math.abs(b[to] - y) * Math.abs(b[to] - y); } public static int dist(int from, int to){  return Math.abs(a[from]-a[to]) * Math.abs(a[from]-a[to]) + Math.abs(b[from]-b[to]) * Math.abs(b[from]-b[to]); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(InputStream is) {  try {   br = new BufferedReader(new InputStreamReader(is));  } catch (Exception e) {   e.printStackTrace();  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   return null;   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.valueOf(next());  } } }
6	public class Handbag {      public static class Item{  int x;  int y;   Item(int x, int y){  this.x = x;   this.y = y;  }     public int dist(Item i){  int dx = x - i.x;  int dy = y - i.y;  return dx*dx + dy*dy;  } }     public static int solve(int bitNum){   if(bitNum == (1 << N) - 1)   return 0;   if(bits[bitNum] != -1)   return bits[bitNum];   int ans = Integer.MAX_VALUE;  int j = 0;  for(int i = 1; i < N; i++){    if((bitNum & (1 << i)) == 0){      if(j == 0){       ans = 2 * items[0].dist(items[i]) + solve(bitNum | (1 << i));    j = i;   }   else{      int dist1 = items[0].dist(items[i]);      int dist2 = items[i].dist(items[j]);      int dist3 = items[j].dist(items[0]);               ans = Math.min(ans, dist1 + dist2 + dist3 + solve(bitNum | (1 << i) | (1 << j)));   }  }  }  return bits[bitNum] = ans;  }  static void printOptPath(int bitNum) {  if (bitNum == (1 << N) - 1)  return;     int j = 0;  for (int i = 1; i < N; i++)    if ((bitNum & (1 << i)) == 0) {     if (j == 0) {      j = i;    if (bits[bitNum] == 2 * items[0].dist(items[i]) + solve(bitNum | (1 << i))) {    pw.print(" " + i + " 0");    printOptPath(bitNum | (1 << i));    return;   }   }   else if (bits[bitNum] ==     items[0].dist(items[i]) + items[i].dist(items[j]) + items[j].dist(items[0]) + solve(bitNum | (1 << i) | (1 << j))) {      pw.print(" " + j + " " + i + " 0");    printOptPath(bitNum | (1 << i) | (1 << j));    return;   }  } }  private static int N = 0; private static Item[] items; private static int[] bits;   private static PrintWriter pw = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String[] input = br.readLine().split(" ");  Item handbag = new Item(Integer.parseInt(input[0]), Integer.parseInt(input[1]));   N = Integer.parseInt(br.readLine()) + 1;  items = new Item[N];  for(int n = 1; n < N; n++){  input = br.readLine().split(" ");  items[n] = new Item(Integer.parseInt(input[0]), Integer.parseInt(input[1]));  }   items[0] = handbag;        bits = new int[1 << N];  Arrays.fill(bits, -1);    int ans = solve(1 << 0);  pw.println(ans);    pw.print("0");  printOptPath(1 << 0);    pw.close(); } }
1	public class Solution {  static boolean canWinFromOneMove(char []s,int k) {  int prefix=0;  int n=s.length;  for(int i=0;i<n && s[i]==s[0];i++)  prefix++;  int suffix=0;  for(int i=n-1;i>=0 && s[i]==s[n-1];i--)  suffix++;   return s[0]==s[n-1] && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;   } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n=sc.nextInt(),k=sc.nextInt();  char []s=sc.next().toCharArray();  if(canWinFromOneMove(s, k)) {  System.out.println("tokitsukaze");  return;  }  int []suff=new int [n+1];  suff[n-1]=1;  for(int i=n-2;i>=0;i--) {  suff[i]=1+(s[i+1]==s[i]?suff[i+1]:0);  }  for(int i=n-2;i>=0;i--)  suff[i]=Math.max(suff[i], suff[i+1]);  int max=0,curr=0;  boolean draw=false;  int ones=0;  for(int i=0;i+k<=n;i++) {      int prefix=ones==i?k+ones:max;  int suffix=i+k==n?k:s[i+k]=='1' && suff[i+k]==n-(i+k)?k+suff[i+k]:suff[i+k];  char first=i==0?'1':s[0],last=i+k==n?'1':s[n-1];  boolean zero=first==last && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;     prefix=ones==0?k+ones:max;   suffix=i+k==n?k:s[i+k]=='0' && suff[i+k]==n-(i+k)?k+suff[i+k]:suff[i+k];   first=i==0?'0':s[0];   last=i+k==n?'0':s[n-1];  boolean one=first==last && prefix+suffix+k>=n || Math.max(prefix, suffix)+k>=n;  if(!zero || !one) {   draw=true;  }  if(s[i]=='1')   ones++;  if(i>0 && s[i]==s[i-1] )   curr++;  else   curr=1;  max=Math.max(max, curr);  }  out.println(draw?"once again":"quailty");  out.close();  }  static class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  Scanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  }  String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  String nextLine() throws IOException {  return br.readLine();  }  int nextInt() throws IOException {  return Integer.parseInt(next());  }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next());  }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next());  }  boolean ready() throws IOException {  return br.ready();  }  } }
1	public class A implements Runnable{  BufferedReader in;  PrintWriter out;  StringTokenizer st;  public static final String filename = "";  public void solve() throws IOException{   int n = nextInt();   int[] a = new int[n + 1];   ArrayList<Integer> pr = new ArrayList<Integer>();     for(int i = 2;i < n + 1;i ++){    if(a[i] != 0)continue;    pr.add(i);    for(int j = 2 * i;j < n + 1;j += i){     a[j] = 1;    }   }   int k = nextInt();   for(int i = 2;i < n + 1;i ++){    if(a[i] != 0)continue;    for(int j = 1;j < pr.size();j ++){     if(i == pr.get(j) + pr.get(j - 1) + 1){      k --;      break;     }    }   }   if(k > 0){    out.println("NO");    return;   }   out.println("YES");  }  public void run(){   try{    Locale.setDefault(Locale.US);    in = new BufferedReader(new InputStreamReader(System.in));       out = new PrintWriter(System.out);       st = new StringTokenizer("");    solve();    out.close();   } catch(IOException e){    throw new RuntimeException(e);   }  }  public static void main(String[] args){   new Thread(new A()).start();  }  public String nextToken() throws IOException{   while(!st.hasMoreTokens()){    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws IOException{   return Integer.parseInt(nextToken());  }  public double nextDouble() throws IOException{   return Double.parseDouble(nextToken());  } }
3	public class Main { private static BufferedReader br; private static StringTokenizer st; private static PrintWriter pw;  public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int qq = Integer.MAX_VALUE;   for(int casenum = 1; casenum <= qq; casenum++) {  int n = readInt();  int[] l = new int[n];  for(int i = 0; i < n; i++) {   l[i] = readInt();  }  int ret = 0;  for(int i = 0; i < n; i++) {   for(int j = i+1; j < n; j++) {   if(l[i] > l[j]) {    ret++;   }   }  }  int qqq = readInt();  while(qqq-- > 0) {   int a = readInt();   int b = readInt();   int d = b-a;   ret ^= d*(d+1)/2;   pw.println(ret%2 == 0 ? "even" : "odd");  }  }  exitImmediately(); }  private static void exitImmediately() {  pw.close();  System.exit(0); }  private static long readLong() throws IOException {  return Long.parseLong(nextToken()); }  private static double readDouble() throws IOException {  return Double.parseDouble(nextToken()); }  private static int readInt() throws IOException {  return Integer.parseInt(nextToken()); }  private static String nextLine() throws IOException {  String s = br.readLine();  if(s == null) {  exitImmediately();  }  st = null;  return s; }  private static String nextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(nextLine().trim());  }  return st.nextToken(); } }
3	public class P911d {  private static void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int cnt = 0;  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (a[i] > a[j]) {   cnt++;   }  }  }  cnt %= 2;  int m = nextInt();  for (int i = 0; i < m; i++) {  int l = nextInt();  int r = nextInt();   int size = r - l + 1;  int sum = (size * (size - 1)) / 2;   sum %= 2;   cnt += sum;  cnt %= 2;   out.println(cnt == 0 ? "even" : "odd");  } }  private static void run() {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  private static StringTokenizer st; private static BufferedReader br; private static PrintWriter out;  private static String next() {  while (st == null || !st.hasMoreElements()) {  String s;  try {   s = br.readLine();  } catch (IOException e) {   return null;  }  st = new StringTokenizer(s);  }  return st.nextToken(); }  private static int nextInt() {  return Integer.parseInt(next()); }  private static long nextLong() {  return Long.parseLong(next()); }  public static void main(String[] args) {  run(); } }
4	public class Main {   static void deal(int n,int[] arr) {   int[] a = new int[n];   a[0] = 1;   int l = 1;   out.println(toString(a,l));   for(int i=1;i<n;i++) {    if(arr[i] == 1) {     a[l] = 1;     l++;    } else {     int index = l-1;     while(index>=0 && a[index] != arr[i]-1) {      index--;     }     a[index]++;     l = index+1;    }    out.println(toString(a,l));   }  }   static String toString(int[] arr,int l) {   StringBuilder sb = new StringBuilder();   for(int i=0;i<l-1;i++) {    sb.append(arr[i]);    sb.append('.');   }   sb.append(arr[l-1]);   return sb.toString();  }   public static void main(String[] args) {   MyScanner sc = new MyScanner();   out = new PrintWriter(new BufferedOutputStream(System.out));   int t = sc.nextInt();   for(int i=0;i<t;i++) {    int n = sc.nextInt();    int[] arr = new int[n];    for(int j=0;j<n;j++) arr[j] = sc.nextInt();    deal(n,arr);   }   out.close();  }     public static PrintWriter out;     public static class MyScanner {   BufferedReader br;   StringTokenizer st;     public MyScanner() {     br = new BufferedReader(new InputStreamReader(System.in));   }     String next() {     while (st == null || !st.hasMoreElements()) {       try {         st = new StringTokenizer(br.readLine());       } catch (IOException e) {         e.printStackTrace();       }     }     return st.nextToken();   }     int nextInt() {     return Integer.parseInt(next());   }     long nextLong() {     return Long.parseLong(next());   }     double nextDouble() {     return Double.parseDouble(next());   }     String nextLine(){     String str = "";  try {    str = br.readLine();  } catch (IOException e) {    e.printStackTrace();  }  return str;   }    } }
5	public class Main {  public static void main(String[] args) {   InputReader in = new StreamInputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   run(in, out);  }  public static void run(InputReader in, PrintWriter out) {   Solver solver = new TaskB();   solver.solve(1, in, out);   Exit.exit(in, out);  } } abstract class InputReader {  private boolean finished = false;  public abstract int read();  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public void setFinished(boolean finished) {   this.finished = finished;  }  public abstract void close(); } class StreamInputReader extends InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar, numChars;  public StreamInputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public void close() {   try {    stream.close();   } catch (IOException ignored) {   }  } } class Exit {  private Exit() {  }  public static void exit(InputReader in, PrintWriter out) {   in.setFinished(true);   in.close();   out.close();  } } interface Solver {  public void solve(int testNumber, InputReader in, PrintWriter out); } class TaskB implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out)  {   int n = in.readInt();   int m = in.readInt();   int k = in.readInt();   int[] a = new int[n];   for(int i=0;i<n;i++) a[i] = in.readInt();   Arrays.sort(a);   if(k>=m)   {    out.println(0);   }   else   {    for(int i=n-1;i>=0;i--)    {     k += (a[i]-1);     if(k>=m)     {      out.println(n-i);      return;     }    }    if(k<m) out.println(-1);   }  } }
5	public class a {  void solve() throws Exception {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int a[] = new int[n];  for (int i = 0; i<n; i++){  a[i] = in.nextInt();  }  Arrays.sort(a);  int sum = 0;  if (k >= m){  out.println(0);  return;  }  sum = a[n-1] + k - 1;  int j = 1;  for (int i = n-2; i >=0 && sum < m; i--, j++){  sum += a[i] - 1;  }  if (sum < m){  out.println(-1);  }else{  out.println(j);  } }  FastScanner in; PrintWriter out;  String input = ""; String output = "";  void run() {  try {  if (input.length() > 0) {   in = new FastScanner(new BufferedReader(new FileReader(input)));  } else   in = new FastScanner(new BufferedReader(new InputStreamReader(    System.in)));  if (output.length() > 0)   out = new PrintWriter(new FileWriter(output));  else   out = new PrintWriter(System.out);   solve();   out.flush();  out.close();  } catch (Exception ex) {  ex.printStackTrace();  out.flush();  out.close();  } finally {  out.close();  } }  public static void main(String[] args) {  new a().run(); }  class FastScanner {  BufferedReader bf;  StringTokenizer st;  public FastScanner(BufferedReader bf) {  this.bf = bf;  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(bf.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public String nextLine() throws IOException {  return bf.readLine();  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  } }
4	public class Main implements Runnable {  final static int mod = 1000000007;  static FastReader sc;  static PrintWriter out;  static boolean test_case_input = true;  static final int MAX = 1000000000;  static final int MIN = -1000000000;  public static void print(int a[], int point) {   out.print(a[1]);   for(int i = 2; i <= point; i++) {    out.print("." + a[i]);   }   out.println();  }  public static void solution(int test_case) throws IOException {     int n = sc.nextInt();   int a[] = sc.intarr(n);   int lev[] = new int[n + 1];   lev[1] = 1;   int point = 1;   out.println(1);   for(int i=1; i < n; i++) {    if(a[i] == 1) {     point++;     lev[point] = 1;     print(lev, point);    }    else if(a[i] == lev[point] + 1) {     lev[point]++;     print(lev, point);    }    else {     while(lev[point] + 1 != a[i]) {      point--;     }     lev[point]++;     print(lev, point);    }   }  }    public static int logint(int x, int base) {   return (int) (Math.log(x) / Math.log(base));  }  public static int logint(long x, long base) {   return (int) (Math.log(x) / Math.log(base));  }  public static int logint(double x, double base) {   return (int) (Math.log(x) / Math.log(base));  }  public static double logdouble(int x, int base) {   return (Math.log(x) / Math.log(base));  }  public static double logdouble(long x, long base) {   return (Math.log(x) / Math.log(base));  }  public static double logdouble(double x, double base) {   return (Math.log(x) / Math.log(base));  }  public static long loglong(int x, int base) {   return (long) (Math.log(x) / Math.log(base));  }  public static long loglong(long x, long base) {   return (long) (Math.log(x) / Math.log(base));  }  public static long loglong(double x, double base) {   return (long) (Math.log(x) / Math.log(base));  }    public static void debug(String msg, Object value) {   File output = new File("output.txt");   if (!output.exists()) return;   String type = value.getClass().getSimpleName();   if (type.equals("int[]")) out.println(msg + " => " + Arrays.toString((int[]) value));   else if (type.equals("double[]")) out.println(msg + " => " + Arrays.toString((double[]) value));   else if (type.equals("float[]")) out.println(msg + " => " + Arrays.toString((float[]) value));   else if (type.equals("long[]")) out.println(msg + " => " + Arrays.toString((long[]) value));   else if (type.equals("char[]")) out.println(msg + " => " + Arrays.toString((char[]) value));   else if (type.equals("String[]")) out.println(msg + " => " + Arrays.toString((String[]) value));   else if (type.equals("int[][]")) {    out.println(msg + "=>");    for (int i[] : (int[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("double[][]")) {    out.println(msg + "=>");    for (double i[] : (double[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("float[][]")) {    out.println(msg + "=>");    for (float i[] : (float[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("long[][]")) {    out.println(msg + "=>");    for (long i[] : (long[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("char[][]")) {    out.println(msg + "=>");    for (char i[] : (char[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("String[][]")) {    out.println(msg + "=>");    for (String i[] : (String[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else out.println(msg + " => " + value);  }  public static void debug(Object value) {   File output = new File("output.txt");   if (!output.exists()) return;   String type = value.getClass().getSimpleName();   if (type.equals("int[]")) out.println(" => " + Arrays.toString((int[]) value));   else if (type.equals("double[]")) out.println(" => " + Arrays.toString((double[]) value));   else if (type.equals("float[]")) out.println(" => " + Arrays.toString((float[]) value));   else if (type.equals("long[]")) out.println(" => " + Arrays.toString((long[]) value));   else if (type.equals("char[]")) out.println(" => " + Arrays.toString((char[]) value));   else if (type.equals("String[]")) out.println(" => " + Arrays.toString((String[]) value));   else if (type.equals("int[][]")) {    out.println("=>");    for (int i[] : (int[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("double[][]")) {    out.println("=>");    for (double i[] : (double[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("float[][]")) {    out.println("=>");    for (float i[] : (float[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("long[][]")) {    out.println("=>");    for (long i[] : (long[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("char[][]")) {    out.println("=>");    for (char i[] : (char[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else if (type.equals("String[][]")) {    out.println("=>");    for (String i[] : (String[][]) value)     out.println(" . " + Arrays.toString(i).replace(' ', '\t'));   } else out.println(" => " + value);  }    public static void addUndirectedEdge(ArrayList<ArrayList<Integer>> adj, int u, int v) {   adj.get(u).add(v);   adj.get(v).add(u);  }  public static void addDirectedEdge(ArrayList<ArrayList<Integer>> adj, int u, int v) {   adj.get(u).add(v);  }  public static <T> void addUndirectedEdge(ArrayList<ArrayList<Point>> adj, int u, int v, T weight) {   adj.get(u).add(new Point(v, weight));   adj.get(v).add(new Point(u, weight));  }  public static <T> void addDirectedEdge(ArrayList<ArrayList<Point>> adj, int u, int v, T weight) {   adj.get(u).add(new Point(v, weight));  }  public static <T> void toString(String msg, ArrayList<ArrayList<T>> adj) {   out.println(msg + ":");   int count = 0;   for (ArrayList<T> i : adj) {    out.print("\t" + count++ + ": ");    for (T j : i) {     out.print(j + " ");    }    out.println();   }  }  public static void addUndirectedEdge(Map<Integer, ArrayList<Integer>> adj, int u, int v) {   if (adj.containsKey(u)) {    ArrayList<Integer> temp = adj.get(u);    temp.add(v);    adj.put(u, temp);   } else {    ArrayList<Integer> temp = new ArrayList<>();    temp.add(v);    adj.put(u, temp);   }   if (adj.containsKey(v)) {    ArrayList<Integer> temp = adj.get(v);    temp.add(u);    adj.put(v, temp);   } else {    ArrayList<Integer> temp = new ArrayList<>();    temp.add(u);    adj.put(v, temp);   }  }  public static void addDirectedEdge(Map<Integer, ArrayList<Integer>> adj, int u, int v) {   if (adj.containsKey(u)) {    ArrayList<Integer> temp = adj.get(u);    temp.add(v);    adj.put(u, temp);   } else {    ArrayList<Integer> temp = new ArrayList<>();    temp.add(v);    adj.put(u, temp);   }  }  public static <T> void addUndirectedEdge(Map<Integer, ArrayList<Point>> adj, int u, int v, T weight) {   if (adj.containsKey(u)) {    ArrayList<Point> temp = adj.get(u);    temp.add(new Point(v, weight));    adj.put(u, temp);   } else {    ArrayList<Point> temp = new ArrayList<>();    temp.add(new Point(v, weight));    adj.put(u, temp);   }   if (adj.containsKey(v)) {    ArrayList<Point> temp = adj.get(v);    temp.add(new Point(u, weight));    adj.put(v, temp);   } else {    ArrayList<Point> temp = new ArrayList<>();    temp.add(new Point(u, weight));    adj.put(v, temp);   }  }  public static <T> void addDirectedEdge(Map<Integer, ArrayList<Point>> adj, int u, int v, T weight) {   if (adj.containsKey(u)) {    ArrayList<Point> temp = adj.get(u);    temp.add(new Point(v, weight));    adj.put(u, temp);   } else {    ArrayList<Point> temp = new ArrayList<>();    temp.add(new Point(v, weight));    adj.put(u, temp);   }  }  public static <T> void toString(String msg, Map<T, ArrayList<T>> adj) {   out.println(msg + ":");   for (Map.Entry<T, ArrayList<T>> entry : adj.entrySet()) {    out.println("\t" + entry.getKey() + ": " + entry.getValue());   }  }    public static int __gcd(int a, int b) {   BigInteger n1 = BigInteger.valueOf(a);   BigInteger n2 = BigInteger.valueOf(b);   BigInteger gcd = n1.gcd(n2);   return gcd.intValue();  }  public static long __gcd(long a, long b) {   BigInteger n1 = BigInteger.valueOf(a);   BigInteger n2 = BigInteger.valueOf(b);   BigInteger gcd = n1.gcd(n2);   return gcd.longValue();  }  public static void main(String args[]) throws IOException {   new Thread(null, new Main(), "random", 1 << 26).start();  }  @Override  public void run() {   long start = 0, end = 0;   try {    File output = new File("output.txt");    sc = new FastReader();    if (output.exists()) {     out = new PrintWriter(new FileOutputStream("output.txt"));     start = System.nanoTime();    } else {     out = new PrintWriter(System.out);    }    int test_cases = 1;    if (test_case_input) test_cases = sc.nextInt();    for (int i = 1; i <= test_cases; i++) {     solution(i);    }    if (output.exists()) {     end = System.nanoTime();     out.println("Execution time: " + (end - start) / 1000000 + " ms");    }    out.flush();    out.close();   } catch (Exception e) {    out.println("Exception: " + e);    out.println("At Line no. : " + e.getStackTrace()[0].getLineNumber());    out.flush();    out.close();    return;   }  }    static class Edge implements Comparable<Edge> {   Object u;   Object v;   Object wt;   public Edge(Object origin, Object destination, Object weight) {    u = origin;    v = destination;    wt = weight;   }   public String toString() {    String ans = u + " -> " + v + " : " + wt;    return ans;   }   public int getIntOrigin() {    return (int) u;   }   public int getIntDestination() {    return (int) v;   }   public int getIntWeight() {    return (int) wt;   }   public long getLongOrigin() {    return (long) u;   }   public long getLongDestination() {    return (long) v;   }   public long getLongWeight() {    return (long) wt;   }   @Override   public int compareTo(Edge edge) {    if ((edge.u).getClass() == Long.class) return (((Long) this.wt).compareTo((Long) edge.wt));    else return (((Integer) this.wt).compareTo((Integer) edge.wt));   }  }    static class Point implements Comparable<Point> {   Object x;   Object y;   public Point(Object a, Object b) {    x = a;    y = b;   }   public int getIntX() {    return (int) x;   }   public int getIntY() {    return (int) y;   }   public long getLongX() {    return (long) x;   }   public long getLongY() {    return (long) y;   }   public int compareTo(Point obj) {    if (obj.x.equals(this.x)) {     if ((obj.y).getClass() == Long.class) return ((Long) this.y).compareTo((Long) obj.y);     else return ((Integer) this.y).compareTo((Integer) obj.y);    } else {     if ((obj.x).getClass() == Long.class) return ((Long) this.x).compareTo((Long) obj.x);     else return ((Integer) this.x).compareTo((Integer) obj.x);    }   }   public String toString() {    String ans = "(" + x + ", " + y + ")";    return ans;   }   @Override   public int hashCode() {    int hash = 7;    hash = 71 * hash + (int) this.x;    hash = 71 * hash + (int) this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) return false;    Point point = (Point) obj;    if (point.x.equals(this.x) && point.y.equals(this.y)) return true;    else return false;   }  }    static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() throws FileNotFoundException {    File in = new File("input.txt");    if (in.exists()) {     br = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));    } else {     br = new BufferedReader(new InputStreamReader(System.in));    }   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   float nextFloat() {    return Float.parseFloat(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   int[] intarr(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = Integer.parseInt(next());    }    return a;   }   long[] longarr(int n) {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = Long.parseLong(next());    }    return a;   }   float[] floatarr(int n) {    float a[] = new float[n];    for (int i = 0; i < n; i++) {     a[i] = Float.parseFloat(next());    }    return a;   }   double[] doublearr(int n) {    double a[] = new double[n];    for (int i = 0; i < n; i++) {     a[i] = Double.parseDouble(next());    }    return a;   }    int[][] intmatrix(int row, int col) {    int a[][] = new int[row][col];    for (int i = 0; i < row; i++) {     for (int j = 0; j < col; j++) {      a[i][j] = Integer.parseInt(next());     }    }    return a;   }   long[][] longmatrix(int row, int col) {    long a[][] = new long[row][col];    for (int i = 0; i < row; i++) {     for (int j = 0; j < col; j++) {      a[i][j] = Long.parseLong(next());     }    }    return a;   }   float[][] floatmatrix(int row, int col) {    float a[][] = new float[row][col];    for (int i = 0; i < row; i++) {     for (int j = 0; j < col; j++) {      a[i][j] = Float.parseFloat(next());     }    }    return a;   }   double[][] doublematrix(int row, int col) {    double a[][] = new double[row][col];    for (int i = 0; i < row; i++) {     for (int j = 0; j < col; j++) {      a[i][j] = Double.parseDouble(next());     }    }    return a;   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
0	public class Main {  public static void main(String[] args) {   Scanner read = new Scanner(System.in);   double a = (double)read.nextInt();   double v = (double)read.nextInt();   double l = (double)read.nextInt();   double d = (double)read.nextInt();   double w = (double)read.nextInt();   double t=0;   if(w>=v){    double d1=v*v/(2*a);    if(d1>l){     t+= Math.sqrt(2*l/a);    }    else{     t+= v/a + (l-d1)/v;    }   }   else{    double temp = (v-w)/a;    double d1 = v*v/(2*a);    double d2 = d - v*temp + a*temp*temp/2;    if(d1>d2){     double temp2 = Math.sqrt(2*a*d);     if(temp2<w){      w=temp2;      temp=(v-w)/a;      t+= temp2/a;     }     else{      double vx=Math.sqrt(v*v/2+a*d2);      t+= (vx/a) + ((vx-w)/a);     }    }    else{     t+= (v/a) + ((d2-d1)/v) + (temp);    }    double d3 = d + w*temp + a*temp*temp/2;    if(d3>l){     t+= (-w+Math.sqrt(w*w+2*a*(l-d)))/a;    }    else{     t+= (temp) + ((l-d3)/v);    }   }   System.out.printf("%.6f", t);   read.close();  } }
4	public class C { public static void main(String[] args) throws IOException {    Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));     int t = sc.nextInt();  for (int z = 0; z < t; ++z) {  int n = sc.nextInt();  ArrayList<Integer> al = new ArrayList<>();  for (int i = 0; i < n; ++i) {   int x = sc.nextInt();   if (x==1) {   al.add(x);   } else {   while (al.get(al.size()-1)!=x-1) {    al.remove(al.size()-1);   }   al.remove(al.size()-1);   al.add(x);   }   StringBuilder pr = new StringBuilder();   String d = "";   for (int xx : al) {   pr.append(d+xx);   d = ".";   }   System.out.println(pr);  }  } } }
6	public class Main { private void run() throws IOException {  int cx = in.nextInt();  int cy = in.nextInt();  int n = in.nextInt();  int[] x = new int[n];  int[] y = new int[n];  for (int i = 0; i < n; ++i) {  x[i] = in.nextInt() - cx;  y[i] = in.nextInt() - cy;  }  int[] dp = new int[1 << n];  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;  int[] prev = new int[1 << n];  for (int mask = 0; mask < (1 << n); ++mask) {  if (dp[mask] == Integer.MAX_VALUE) {   continue;  }  for (int i = 0; i < n; ++i) {   if (((mask >> i) & 1) == 0) {   if (dp[mask | (1 << i)] > dp[mask] + dist(x[i], y[i])) {    dp[mask | (1 << i)] = dp[mask] + dist(x[i], y[i]);    prev[mask | (1 << i)] = mask;   }   for (int j = i + 1; j < n; ++j) {    if (((mask >> j) & 1) == 0) {    if (dp[mask | (1 << i) | (1 << j)] > dp[mask] + dist(x[i], y[i], x[j], y[j])) {     dp[mask | (1 << i) | (1 << j)] = dp[mask] + dist(x[i], y[i], x[j], y[j]);     prev[mask | (1 << i) | (1 << j)] = mask;    }    }   }   break;   }  }  }  out.println(dp[(1 << n) - 1]);  int mask = (1 << n) - 1;  out.print(0);  while (mask != 0) {  int p = prev[mask];  int cur = p ^ mask;  List<Integer> who = new ArrayList<Integer>();  for (int i = 0; i < n; ++i) {   if (((cur >> i) & 1) != 0) {   who.add(i + 1);   }  }  for (int t : who) {   out.print(" " + t);  }  out.print(" " + 0);  mask = p;  }  out.flush(); }  private int dist(int x, int y, int x2, int y2) {  return x * x + y * y + x2 * x2 + y2 * y2 + (x2 - x) * (x2 - x) + (y2 - y) * (y2 - y); }  private int dist(int x, int y) {  return 2 * (x * x + y * y); }  private class Scanner {  private StringTokenizer tokenizer;  private BufferedReader reader;  public Scanner(Reader in) {  reader = new BufferedReader(in);  tokenizer = new StringTokenizer("");  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean hasNext() throws IOException {  while (!tokenizer.hasMoreTokens()) {   String next = reader.readLine();   if (next == null)   return false;   tokenizer = new StringTokenizer(next);  }  return true;  }  public String next() throws IOException {  hasNext();  return tokenizer.nextToken();  }  public String nextLine() throws IOException {  tokenizer = new StringTokenizer("");  return reader.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  } }  public static void main(String[] args) throws IOException {  new Main().run(); } Scanner in = new Scanner(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); }
0	public final class FollowTrafficRules {  private static double[] acce(double i, double a, double v) {   double[] r = new double[2];   r[0] = (v - i)/a;   r[1] = 1d/2d * a * pow(r[0], 2) + i * r[0];   return r;  }  private static double solve(double i, double a, double l) {   double e = sqrt(pow(i, 2) + 2d * a * l);   e = a > 0 ? e : -1d * e;   return (e - i)/a;  }  private static double time(double i, double a, double v, double l) {   double[] r = acce(i, a, v);   if (r[1] >= l) return solve(i, a, l);   return r[0] + (l - r[1])/v;  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   double a = sc.nextDouble();   double v = sc.nextDouble();   double l = sc.nextDouble();   double d = sc.nextDouble();   double w = sc.nextDouble();   double t = 0d;   if (v <= w) t = time(0, a, v, l);   else {    double[] r = acce(0, a, w);    if (r[1] >= d) t = time(0, a, v, l);    else {     t += r[0];     t += 2d * time(w, a, v, (d - r[1])/2d);     t += time(w, a, v, l - d);    }   }   System.out.println(t);  } }
1	public class A {  public static void main(String[] args) {  new A().run(); }  private void run() {  Scanner sc =new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();  sc.close();  boolean[] isp = new boolean[n + 1];  Arrays.fill(isp, true);  isp[1] = false;  int[] primes = new int[n];  int pc = 0;  for (int i = 2; i <= n; i++) {  if (isp[i]) {   primes[pc++] = i;   for (int j = i * i; j <= n; j+= i) {   isp[j] = false;   }  }  }  int res = 0;  for (int i = 0; i < pc; i++) {  for (int j = 1; j < i; j++)     if (primes[i] == primes[j] + primes[j - 1] + 1)    res++;  }  System.out.println(res >= k ? "YES" : "NO"); } }
5	public class Main {    public static void main(String[] args) {   Scanner in=new Scanner(new InputStreamReader(System.in));   PrintWriter out=new PrintWriter(System.out);   int n=in.nextInt();   Vector<Integer> mas=new Vector<Integer>();   Vector<Integer> mas2=new Vector<Integer>();   int index=-1;   boolean res=false;   for(int i=0; i<n; i++){    mas.add(in.nextInt());    if(i!=0 && mas.get(i)<mas.get(i-1)){     index=i-1;     break;    }   }   if(index==-1) res=true;   else{    int min=mas.get(index+1);    int minIndex=index+1;    for(int i=index+2; i<n; i++){     mas.add(in.nextInt());     if(mas.get(i)<=min){      min=mas.get(i);      minIndex=i;          }    }       mas2.addAll(mas);    mas.set(minIndex, mas.get(index));    mas.set(index, min);    int o=mas.hashCode();    Collections.sort(mas);    int nw=mas.hashCode();    res=nw==o;   }   if(!res){    mas=mas2;    for(int i=n-1; i>=0; i--){     if(i!=n-1 && mas.get(i)>mas.get(i+1)){      index=i+1;      break;     }    }    if(index==-1) res=true;    else{     int max=mas.get(index-1);     int maxIndex=index-1;     for(int i=index-1; i>=0; i--){      if(mas.get(i)>=max){       max=mas.get(i);       maxIndex=i;      }     }     mas.set(maxIndex, mas.get(index));     mas.set(index, max);     int o=mas.hashCode();     Collections.sort(mas);     int nw=mas.hashCode();     res=res||nw==o;    }   }   if(res) out.println("YES");   else out.println("NO");   out.close();  } }
3	public class Main {  static LinkedList<Integer> adj[]; static ArrayList<Integer> adj1[]; static int[] color,visited1; static boolean b[],visited[],possible; static int level[]; static Map<Integer,HashSet<Integer>> s; static int totalnodes,colored; static int count[]; static long sum[]; static int nodes; static double ans=0; static long[] as=new long[10001]; static long c1=0,c2=0; static int[] a,d,k; static int max=100000000; static long MOD = (long)1e9 + 7,sm=0,m=Long.MIN_VALUE; static boolean[] prime=new boolean[1000005]; static int[] levl;  static int[] eat;  static int price[];  static int size[],res[],par[];  static int result=0;   public static void main(String[] args) throws IOException {  in=new InputReader(System.in);  w=new PrintWriter(System.out);  int n=ni();  int[] a=na(n);  int ans=0;  for(int i=0;i<n;i++)  {   for(int j=i+1;j<n;j++)   {   if(a[j]<a[i])    ans++;   }  }  int m=ni();  ans=ans%2;  while(m-->0)  {   int l=ni(),r=ni();   int range=r-l+1;   range=range*(range-1)/2;   range=range%2;   ans=(ans+range)%2;   if(ans==1)   w.println("odd");   else   w.println("even");  }   w.close();  }    public static long nCrModp(long n, long r, long p) {    long[] C=new long[(int)r+1];      C[0] = 1;     for (long i = 1; i <= n; i++)  {      for (long j = Math.min(i, r); j > 0; j--)          C[(int)j] = (C[(int)j] + C[(int)(j-1)])%p;  }  return C[(int)r]; } public static long nCr(long n, long r) {  long x=1;  for(long i=n;i>=n-r+1;i--)  x=((x)*(i));  for(long i=r;i>=1;i--)  x=((x)/(i));   return x%MOD; } public static long nCrModpDP(long n, long r, long p) {   long[] C=new long[(int)r+1];    C[0] = 1;      for (long i = 1; i <= n; i++)  {   for (int j = (int)Math.min(i, r); j > 0; j--)    C[j] = (C[j] + C[j-1])%p;  }  return C[(int)r]; }  public static long nCrModpLucas(long n,long r, long p) {    if (r==0)   return 1;    long ni = n%p, ri = r%p;   return (nCrModpLucas(n/p,r/p, p) * nCrModpDP(ni,ri, p)) % p;  }   public static void buildgraph(int n){   adj=new LinkedList[n+1];   visited=new boolean[n+1];   levl=new int[n+1];   par=new int[n+1];   for(int i=0;i<=n;i++){    adj[i]=new LinkedList<Integer>();      }   } public static int getSum(long BITree[], int index) {  int sum = 0;    while (index > 0)  {   sum += BITree[index];   index -= index & (-index);  }  return sum; }  public static long[] updateBIT(long BITree[], int n, int index, int val) {  while (index <= n)  {   BITree[index] += val;   index += index & (-index);  }  return BITree; }    public static boolean isPrime(int n) {    if (n <= 1) return false;  if (n <= 3) return true;        if (n%2 == 0 || n%3 == 0)   return false;    for (int i=5; i*i<=n; i=i+6)   if (n%i == 0 || n%(i+2) == 0)    return false;    return true; }    public static String ns() {  return in.nextLine(); } public static int ni() {  return in.nextInt(); } public static long nl() {  return in.nextLong(); } public static int[] na(int n) {  a=new int[n];  for(int i=0;i<n;i++)  a[i]=ni();  return a; } public static void sieveOfEratosthenes()  {   int n=prime.length;   for(int i=0;i<n;i++)    prime[i] = true;       for(int p = 2; p*p <=n; p++)   {    if(prime[p] == true)    {     for(int i = p*2; i <n; i += p)      prime[i] = false;    }   }  }  public static boolean printDivisors(long n)  {  long ans=0;   for (int i=1; i<=Math.sqrt(n); i++)   {    if (n%i==0)    {     if (n/i == i)      ans++;     else     {     ans=ans+2;     }    }    if(ans>3)    break;   }   if(ans==3)   return true;   else   return false;  }  public static void dfs(int i) {  visited[i]=true;  for(int j:adj[i])  {  if(!visited[j])   {   dfs(j);   nodes++;   }  }   } public static String rev(String s) {  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString(); } static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;    a = temp;  }  return a; } static InputReader in; static PrintWriter w; static class InputReader {  private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter;  public InputReader(InputStream stream) { this.stream = stream; }  public int snext() { if (snumChars == -1)  throw new InputMismatchException(); if (curChar >= snumChars) {  curChar = 0;  try  {  snumChars = stream.read(buf);  }  catch (IOException e)  {  throw new InputMismatchException();  }  if (snumChars <= 0)  return -1; } return buf[curChar++]; }  public int nextInt() { int c = snext(); while (isSpaceChar(c))  {  c = snext(); } int sgn = 1; if (c == '-') {  sgn = -1;  c = snext(); } int res = 0; do {  if (c < '0' || c > '9')  throw new InputMismatchException();  res *= 10;  res += c - '0';  c = snext(); } while (!isSpaceChar(c)); return res * sgn; }  public long nextLong() { int c = snext(); while (isSpaceChar(c))  {  c = snext(); } int sgn = 1; if (c == '-') {  sgn = -1;  c = snext(); } long res = 0; do {  if (c < '0' || c > '9')  throw new InputMismatchException();  res *= 10;  res += c - '0';  c = snext(); } while (!isSpaceChar(c)); return res * sgn; }  public String readString() { int c = snext(); while (isSpaceChar(c))  {  c = snext(); } StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isSpaceChar(c)); return res.toString(); }  public String nextLine() { int c = snext(); while (isSpaceChar(c))  c = snext(); StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isEndOfLine(c)); return res.toString(); }  public boolean isSpaceChar(int c) { if (filter != null)  return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }  public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }  }
6	public class ProblemC { public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);     int[] pt = readPoint(s);  int n = Integer.valueOf(s.readLine());  int[][] xp = new int[n+1][];  for (int i = 1 ; i <= n ; i++) {  xp[i] = readPoint(s);  }  xp[0] = pt;   int[][] dist = new int[n+1][n+1];  for (int i = 0 ; i <= n ; i++) {  for (int j = 0 ; j <= n ; j++) {   int dx = Math.abs(xp[i][0] - xp[j][0]);   int dy = Math.abs(xp[i][1] - xp[j][1]);   dist[i][j] = dx*dx + dy*dy;  }  }   int[][] dist2 = new int[n+1][n+1];  for (int i = 0 ; i <= n ; i++) {  for (int j = 0 ; j <= n ; j++) {   dist2[i][j] = dist[0][i] + dist[i][j] + dist[j][0];  }  }   int[] dp = new int[1<<n];  int[][] dp_prev = new int[2][1<<n];  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;   for (int i = 0 ; i < (1<<n) ; i++) {  if (dp[i] == Integer.MAX_VALUE) {   continue;  }  int base = dp[i];    for (int y = 0 ; y < n ; y++) {   if ((i & (1<<y)) >= 1) {   break;   }   for (int z = y+1 ; z < n ; z++) {   if ((i & (1<<z)) >= 1) {    continue;   }   int ti = i | (1<<y) | (1<<z);   int d = dist2[y+1][z+1];   if (dp[ti] > base + d) {    dp[ti] = base + d;    dp_prev[0][ti] = z+1;    dp_prev[1][ti] = y+1;   }   }  }  }      int bestOnes = 0;  for (int i = 0 ; i < (1<<n) ; i++) {  if (dp[i] == Integer.MAX_VALUE) {   continue;  }  int sub = (1<<n) - 1 - i;  int add = 0;  for (int j = 0 ; j < n ; j++) {   if ((sub & (1<<j)) >= 1) {   add += dist[0][j+1] * 2;   }  }  if (dp[i] + add < dp[(1<<n)-1]) {   dp[(1<<n)-1] = dp[i] + add;   bestOnes = sub;  }  }   StringBuffer b = new StringBuffer();  b.append(" 0");  for (int i = 0 ; i < n ; i++) {  if ((bestOnes & (1<<i)) >= 1) {   b.append(" ").append(i+1).append(" ").append(0);  }  }   out.println(dp[(1<<n)-1]);  int nptn = (1<<n)-1-bestOnes;  while (nptn >= 1) {  int i1 = dp_prev[0][nptn];  int i2 = dp_prev[1][nptn];  if (i1 >= 1) {   nptn -= 1<<(i1-1);   b.append(" ").append(i1);  }  if (i2 >= 1) {   nptn -= 1<<(i2-1);   b.append(" ").append(i2);  }  b.append(" ").append(0);  }  out.println(b.substring(1));  out.flush(); }  private static void generateRandom() {  System.out.println("0 0");  System.out.println("24");  for (int i = 0 ; i < 24 ; i++) {  int a = (int)(Math.random() * 200 - 100);  int b = (int)(Math.random() * 200 - 100);  System.out.println(a + " " + b);  } }   private static int[] readPoint(BufferedReader s) throws IOException {  int[] ret = new int[2];  String[] data = s.readLine().split(" ");  ret[0] = Integer.valueOf(data[0]);  ret[1] = Integer.valueOf(data[1]);  return ret; }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
0	public class D {  public static void main(String[] args) throws IOException {   new D().solve();  }  static final double EPS = 1e-10;  Parser parser;  enum Result {   UNDER, OVER  }  private void solve() throws IOException {   this.parser = new Parser(new BufferedReader(new InputStreamReader(System.in)));   double a = parser.nextInt();   double vmax = parser.nextInt();   double l = parser.nextInt();   double d = parser.nextInt();   double w = parser.nextInt();   double low = 0;   double high = 20000;   while (Math.abs(high - low) > 1e-10) {    double accelerateTime = (low + high) / 2;    Result res = check(accelerateTime, a, vmax, d, w).result;    if (res == Result.UNDER) {     low = accelerateTime;    } else {     high = accelerateTime;    }   }   IP ip = check(high, a, vmax, d, w);   TV tv = tv(ip.v, l - d, a, vmax);   PrintWriter pw = new PrintWriter(System.out);   pw.printf("%.5f\n", ip.time + tv.time);   pw.close();  }  private IP check(double accelerateTime, double a, double vmax, double d, double w) {   DV dv = dv(0, a, accelerateTime, vmax);   if (dv.d > d) {    return new IP(accelerateTime, dv.v, Result.OVER);   }   Double slowTime = time2MakeDist(-a, dv.v, d - dv.d);   if (slowTime == null) {    return new IP(0, 0, Result.UNDER);   }   double vDown = dv.v - a * slowTime;   if (vDown < w) {    return new IP(0, 0, Result.UNDER);   } else {    return new IP(accelerateTime + slowTime, vDown, Result.OVER);   }  }  static class IP {   final double time;   final double v;   final Result result;   IP(double time, double v, Result result) {    this.time = time;    this.v = v;    this.result = result;   }  }  static class DV {   final double d;   final double v;   DV(double d, double v) {    this.d = d;    this.v = v;   }  }  static class TV {   final double time;   final double v;   TV(double time, double v) {    this.time = time;    this.v = v;   }  }  static Double time2MakeDist(double a, double v0, double dist) {   return quadric(a / 2, v0, -dist);  }  static TV tv(double v0, double d, double a, double vmax) {   double acTime = (vmax - v0) / a;   double unboundedTime = time2MakeDist(a, v0, d);   if (unboundedTime > acTime) {    double ad = dist(v0, a, acTime);    return new TV(acTime + (d - ad) / vmax, vmax);   } else {    return new TV(unboundedTime, v0 + a * unboundedTime);   }  }  static DV dv(double v0, double a, double time, double vmax) {   double time2maxV = (vmax - v0) / a;   if (time2maxV < time) {    return new DV(dist(v0, a, time2maxV) + dist(vmax, 0, time - time2maxV), vmax);   } else {    return new DV(dist(v0, a, time), v0 + a * time);   }  }  static double dist(double v0, double a, double time) {   return v0 * time + a * time * time / 2;  }  static Double quadric(final double a, final double b, final double c) {   double d = b * b - 4 * a * c;   if (d < -EPS) {    return null;   }   d = Math.abs(d);   double x1 = (-b + Math.sqrt(d)) / (2 * a);   double x2 = (-b - Math.sqrt(d)) / (2 * a);   double r = Integer.MAX_VALUE;   if (x1 > -EPS) {    r = x1;   }   if (x2 > -EPS) {    r = Math.min(r, x2);   }   if (r == Integer.MAX_VALUE) {    throw new RuntimeException("BOTVA");   }   return r;  }  static class Parser {   final BufferedReader br;   StringTokenizer st = new StringTokenizer("");   public Parser(BufferedReader bufferedReader) {    this.br = bufferedReader;   }   String nextToken() throws IOException {    while (!st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine());    }    return st.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(nextToken());   }  } }
4	public class p3 { static class FastReader {  BufferedReader br;  StringTokenizer st;  public FastReader()  {   br = new BufferedReader(new InputStreamReader(System.in));  }  String next()  {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    }    catch (IOException e) {     e.printStackTrace();    }   }   return st.nextToken();  }  int nextInt() { return Integer.parseInt(next()); }  byte nextByte() { return Byte.parseByte(next()); }  short nextShort() { return Short.parseShort(next()); }  long nextLong() { return Long.parseLong(next()); }  double nextDouble() { return Double.parseDouble(next()); }  String nextLine()  {   String str = "";   try {    str = br.readLine();   }   catch (IOException e) {    e.printStackTrace();   }   return str;  } }  public static void main(String[] args) {  FastReader fr=new FastReader();  byte t=fr.nextByte();  while(t-->0)  {  short n=fr.nextShort();  short a[]=new short [n];  for (short i=-1;++i<n;)   a[i]=fr.nextShort();    String s="1";  System.out.println(s);   for(short i=0;++i<n;)  {   if(a[i]==1)   {   s+=".1";   System.out.println(s);   }   else if(a[i]==a[i-1]+1)   {   int c=s.lastIndexOf(".");   s=s.substring(0,c+1)+a[i];   System.out.println(s);   }   else   {      for(;;)   {    s=s.substring(0,s.lastIndexOf("."));    int c=s.lastIndexOf(".");    int b=Integer.parseInt(s.substring(c+1,s.length()));    if(b+1==a[i])    {    s=s.substring(0,c+1)+a[i];    System.out.println(s);    break;    }   }   }  }  } } }
3	public class TaskD {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = s.nextInt();  }  int m = s.nextInt();  int inv = 0;   for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (a[i] > a[j]) {   inv++;   }  }  }  boolean odd = (inv % 2 == 1);  for (int i = 0; i < m; i++) {  int l = s.nextInt();  int r = s.nextInt() + 1;   int num = (r - l)*(r - l - 1)/2;  if (num % 2 == 1) {   odd = !odd;  }  System.out.println((odd) ? "odd" : "even");  } } }
1	public class TaskB {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int k = s.nextInt();   int[] nums = new int[100000 + 10];     int first = -1, last = -1;   Set<Integer> dif = new TreeSet<Integer>();     s.nextLine();   for (int i = 0; i < n; i++) {    nums[i] = s.nextInt();    dif.add(nums[i]);    if (dif.size() == k) {     last = i;     break;    }   }   dif.clear();   for (int i = last; i >= 0; i--) {    dif.add(nums[i]);    if (dif.size() == k) {     first = i;     break;    }   }     if (last == -1)    System.out.print("-1 -1");   else    System.out.print(Integer.toString(first + 1) + " " + Integer.toString(last + 1));  } }
5	public class A {  BufferedReader in; StringTokenizer st; PrintWriter out;  String next() throws IOException {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(next()); }  long nextLong() throws Exception {  return Long.parseLong(next()); }  double nextDouble() throws Exception {  return Double.parseDouble(next()); }  void solve() throws Exception {  int n = nextInt(), k = nextInt(), s = nextInt();  int a[] = new int[n];  for (int i = 0; i < n; i++)  a[i] = -nextInt();   Arrays.sort(a);  for(int i=0;i<n;i++)  {  if (s>=k)  {   out.println(i);   return;  }    s += -a[i];  s--;  }  if (s<k)  out.println(-1);  else  out.println(n); }  void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));  solve();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public static void main(String[] args) {  new A().run(); }  }
5	public class A {  final int MOD = (int)1e9 + 7; final double eps = 1e-12; final int INF = (int)1e9;  public A () {  int N = sc.nextInt();  int M = sc.nextInt();  int K = sc.nextInt();   Integer [] S = sc.nextInts();  sort(S, reverseOrder());    int cnt = K, res;  for (res = 0; res < N && cnt < M; ++res)  cnt += S[res] - 1;   exit(cnt < M ? -1 : res); }    static MyScanner sc;  static class MyScanner {  public String next() {  newLine();  return line[index++];  }   public char nextChar() {  return next().charAt(0);  }    public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }   public double nextDouble() {  return Double.parseDouble(next());  }   public String nextLine() {  line = null;  return readLine();  }   public String [] nextStrings() {  line = null;  return readLine().split(" ");  }   public char [] nextChars() {  return next().toCharArray();  }  public Integer [] nextInts() {  String [] L = nextStrings();  Integer [] res = new Integer [L.length];  for (int i = 0; i < L.length; ++i)   res[i] = Integer.parseInt(L[i]);  return res;  }    public Long [] nextLongs() {  String [] L = nextStrings();  Long [] res = new Long [L.length];  for (int i = 0; i < L.length; ++i)   res[i] = Long.parseLong(L[i]);  return res;  }  public Double [] nextDoubles() {  String [] L = nextStrings();  Double [] res = new Double [L.length];  for (int i = 0; i < L.length; ++i)   res[i] = Double.parseDouble(L[i]);  return res;  }     private boolean eol() {  return index == line.length;  }  private String readLine() {  try {   return r.readLine();  } catch (Exception e) {   throw new Error(e);  }  }  private final BufferedReader r;  MyScanner () {  this(new BufferedReader(new InputStreamReader(System.in)));  }   MyScanner(BufferedReader r) {  try {   this.r = r;   while (!r.ready())   Thread.sleep(1);   start();  } catch (Exception e) {   throw new Error(e);  }  }   private String [] line;  private int index;  private void newLine() {  if (line == null || eol()) {   line = readLine().split(" ");   index = 0;  }  }  }  static void print (Object o, Object... a) {  pw.println(build(o, a)); }  static void exit (Object o, Object... a) {  print(o, a);  exit(); }  static void exit () {  pw.close();  System.out.flush();  System.err.println("------------------");  System.err.println("Time: " + ((millis() - t) / 1000.0));  System.exit(0); }  void NO() {  throw new Error("NO!"); }    static String build(Object... a) {  StringBuilder b = new StringBuilder();  for (Object o : a)  append(b, o);  return b.toString().trim();  }  static void append(StringBuilder b, Object o) {  if (o.getClass().isArray()) {  int L = Array.getLength(o);  for (int i = 0; i < L; ++i)   append(b, Array.get(o, i));  } else if (o instanceof Iterable<?>) {  for (Object p : (Iterable<?>)o)   append(b, p);  } else  b.append(" ").append(o);  }    public static void main(String[] args) {  sc = new MyScanner ();  new A();  exit(); }  static void start() {  t = millis(); }  static PrintWriter pw = new PrintWriter(System.out);  static long t;  static long millis() {  return System.currentTimeMillis(); } }
0	public class Task483A {  public static void main(String... args) throws NumberFormatException,    IOException {   Solution.main(System.in, System.out);  }  static class Scanner {   private final BufferedReader br;   private String[] cache;   private int cacheIndex;   Scanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));    cache = new String[0];    cacheIndex = 0;   }   int nextInt() throws IOException {    if (cacheIndex >= cache.length) {     cache = br.readLine().split(" ");     cacheIndex = 0;    }    return Integer.parseInt(cache[cacheIndex++]);   }   long nextLong() throws IOException {    if (cacheIndex >= cache.length) {     cache = br.readLine().split(" ");     cacheIndex = 0;    }    return Long.parseLong(cache[cacheIndex++]);   }   String next() throws IOException {    if (cacheIndex >= cache.length) {     cache = br.readLine().split(" ");     cacheIndex = 0;    }    return cache[cacheIndex++];   }   void close() throws IOException {    br.close();   }  }   static class Solution {    public static void main(InputStream is, OutputStream os)     throws NumberFormatException, IOException {    PrintWriter pw = new PrintWriter(os);    Scanner sc = new Scanner(is);    long l = sc.nextLong();    long r = sc.nextLong();    long interval = r-l;    if(interval == 0 || interval == 1 || (interval == 2 && l % 2 ==1 )){     pw.println(-1);    } else {     if(l % 2 == 1){      l++;     }     pw.print(l);     pw.print(" ");     pw.print(l+1);     pw.print(" ");     pw.print(l+2);    }     pw.flush();    sc.close();   }  } }
1	public class Main { public static void main(String args[]) throws IOException {  Scanner sc = new Scanner(System.in);     int n = sc.nextInt(), k = sc.nextInt(), kol = 0, prev;     boolean ok;     ArrayList<Integer> al = new ArrayList<Integer>();     al.add(2);     prev = 2;     for(int i=3;i<=n;i+=2)     {     ok = true;     for(Integer x: al)      if (i%x == 0)     {      ok = false;      break;     }     if (ok)      {      for(Integer x: al)      if (ok)      {      prev = x;       ok = false;      } else      {      if (x + prev + 1 == i)       {       kol++;       break;      }      if (x + prev + 1 > i) break;      prev = x;      }      al.add(i);     }     }     if (kol >= k) System.out.print("YES"); else System.out.print("NO"); } }
1	public class test{         static StreamTokenizer in = new StreamTokenizer(new BufferedReader(    new InputStreamReader(System.in)));  static PrintWriter out = new PrintWriter(System.out);     static int nextInt() {   try {    in.nextToken();   } catch (IOException ex) {    Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);   }   return (int) in.nval;  }  static String nextString() {   try {    in.nextToken();   } catch (IOException ex) {    Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);   }   return in.sval;  }  public static void main(String args[]) throws Exception {   int n = nextInt();   long k = nextInt();   long a[] = new long[n + 1];   Map<Long, Long> drb = new HashMap<Long, Long>();   int elso = 1;   long sk = 0;   long sm = 0;   long minjo = Long.MAX_VALUE;   long minjoh = Long.MAX_VALUE;   Vector<long[]> ret = new Vector<long[]>();   for (int i = 1; i <= n; i++) {    a[i] = nextInt();    if (true) {     sm += a[i];     if (drb.containsKey(a[i])) {      drb.put(a[i], drb.get(a[i]) + 1);     } else {      drb.put(a[i], (long) 1);      sk++;     }     while (sk > k || drb.get(a[elso]) > 1) {      long s = drb.get(a[elso]);      if (s == 1) {       drb.remove(a[elso]);       sk--;      } else {       drb.put(a[elso], s - 1);      }      sm -= a[elso];      elso++;     }     if (sk == k) {      if (minjo > sm) {       minjo = sm;       ret.clear();       minjoh = i - elso;      }      if (minjo == sm) {       if (minjoh > i - elso) {        ret.clear();        minjoh = i - elso;       }       ret.add(new long[]{elso, i});      }     }    } else {     elso = i;     drb.clear();     drb.put(a[i], (long) 1);     sk = 1;     sm = a[i];     if (k == 1) {      if (minjo > sm) {       minjo = sm;       ret.clear();      }      if (minjo == sm) {       ret.add(new long[]{elso, i});      }     }    }   }   for (long[] r : ret) {    System.out.print(r[0] + " ");    System.out.print(r[1] + " ");    break;   }   if (ret.size() == 0) {    System.out.print(-1 + " ");    System.out.print(-1 + " ");   }  } }
5	public class Main{  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int produzeni = in.nextInt();   int devices = in.nextInt();   int stekovi = in.nextInt();   int [] filter = new int[produzeni];   for(int i = 0; i<produzeni; i++){    filter[i] = in.nextInt();   }   Arrays.sort(filter);   int filt_no = filter.length-1;   if(devices<=stekovi) {    System.out.println("0");    return;   }   int used = 0;   while(devices>stekovi){    try{    stekovi+=filter[filt_no--]-1;    }    catch(Exception e){     System.out.println("-1");     return;    }   }     System.out.println(filter.length - filt_no-1);         } }
0	public class Rules { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int a = in.nextInt();  double maxSpeed = in.nextInt();  double len = in.nextInt();  double delayDist = in.nextInt();  double delaySpeed = in.nextInt();   double timeToDelaySpeed = delaySpeed/a;  double timeToDelay = travelS(a, 0.0, maxSpeed, delayDist);   if (timeToDelay < timeToDelaySpeed) {     timeToDelay = travelS(a, 0.0, maxSpeed, len);  double timeToMax = maxSpeed/a;  if (timeToDelay < timeToMax) {   System.out.printf("%.9f\n", timeToDelay);   return;  }    double[] parts = travelA(a, 0.0, maxSpeed);  double remainingDist = len - parts[1];  double time = parts[0] + remainingDist / maxSpeed;  System.out.printf("%.9f\n", time);  return;  }  if (delaySpeed > maxSpeed) {  double time = travelS(a, 0.0, maxSpeed, len);  System.out.printf("%.9f\n", time);  return;  }     double lowV = delaySpeed;  double highV = maxSpeed;  int loopCount = 1000;  double[] initial = null;  double[] secondary = null;  while (loopCount-->0) {  double guessV = (lowV+highV)/2.0;  initial = travelA(a, 0.0, guessV);  secondary = travelA(a, guessV, Math.min(delaySpeed, maxSpeed));  if (initial[1] + secondary[1] < delayDist) {   lowV = guessV;  } else {   highV = guessV;  }  }  double totalTime = 0.0;  double finalSpeed = 0.0;  initial = travelA(a, 0.0, lowV);  secondary = travelA(a, lowV, delaySpeed);  totalTime = initial[0] + secondary[0];  double totalDist = initial[1] + secondary[1];  totalTime += (delayDist-totalDist)/maxSpeed;     totalTime += travelS(a, delaySpeed, maxSpeed, len-delayDist);  System.out.printf("%.9f\n", totalTime); }    public static double[] travelA(int a, double startSpeed, double endSpeed) {  if (startSpeed > endSpeed)  a = -a;   double time = (endSpeed - startSpeed) / a;  double dist = 0.5*a*time*time + startSpeed*time;  return new double[] {time, dist}; }   public static double travelS(int a, double startSpeed, double maxSpeed, double dist) {  double timeToMax = (maxSpeed - startSpeed) / a;  double targetTime = (-startSpeed + Math.sqrt(startSpeed*startSpeed + 2*a*dist)) / a;  if (targetTime < timeToMax)  return targetTime;   double partialDist = 0.5*timeToMax*timeToMax*a + startSpeed*timeToMax;  double remainingDist = dist - partialDist;  targetTime = remainingDist / maxSpeed;  return targetTime + timeToMax; } }
5	public class Main {  public static void main (String[] args) throws java.lang.Exception  {   Scanner sc = new Scanner(System.in);   int numSupply = sc.nextInt();   int dev = sc.nextInt();   int socket = sc.nextInt();   int[] sockInSu = new int[numSupply];   for (int i = 0; i< sockInSu.length; i++) {    sockInSu[i] = sc.nextInt();   }     Arrays.sort(sockInSu);     if (socket >= dev) {    System.out.println(0);   }else {    int count = 0;    for (int i = sockInSu.length-1; i >= 0; i--) {     socket+= sockInSu[i]-1;     count++;     if (socket >= dev) {      System.out.println(count);      break;     }    }    if (socket < dev)     System.out.println(-1);   }  } }
0	public class D0005 {  public static void main(String args[]) throws Exception {   new D0005();  }  D0005() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   a = sc.nextInt();   max = sc.nextInt();   double length = sc.nextInt();   double dist = sc.nextInt();   double limit = sc.nextInt();   if (max <= limit) {    out.println(travelTime(length, 0));   }   else {    double tLimit = limit / a;    double dLimit = distance(0, tLimit);    if (dLimit >= dist) {     out.println(travelTime(length, 0));    }    else {     double res = tLimit + 2 * (travelTime(0.5 * (dist - dLimit), limit)) +       travelTime(length - dist, limit);     out.println(res);    }   }   out.close();   System.exit(0);  }  double a, max;  double distance(double v, double t) {   return v * t + 0.5 * a * t * t;  }  double travelTime(double d, double v) {   double tAll = (-v + Math.sqrt(v * v + 2 * a * d)) / a;   double tMax = (max - v) / a;   if (tAll <= tMax) {    return tAll;   }   else {    return tMax + (d - distance(v, tMax)) / max;   }  }    public class PandaScanner {   BufferedReader br;   StringTokenizer st;   InputStream in;   PandaScanner(InputStream in) throws Exception {    br = new BufferedReader(new InputStreamReader(this.in = in));   }   public String next() throws Exception {    if (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine().trim());     return next();    }    return st.nextToken();   }   public boolean hasNext() throws Exception {    return (st != null && st.hasMoreTokens()) || in.available() > 0;   }   public long nextLong() throws Exception {    return Long.parseLong(next());   }   public int nextInt() throws Exception {    return Integer.parseInt(next());   }  } }
1	public class Main{   public static void main(String[] args) {  Parser p = new Parser(System.in);  PrintWriter pw= new PrintWriter(System.out);  int n = p.nextInt();  int k = p.nextInt();  int[] a = p.nextIntArray(n);  int [] pos = new int[100001];  Arrays.fill(pos,-1);  int cnt = 0;  for(int i=0; i<n; ++i){  int e = a[i];  if( pos[e] == -1 ){   ++cnt;  }  pos[e] = i;  if( cnt == k){   break;  }  }  if( cnt < k){  pw.println("-1 -1");  pw.close();  return;  }  int min = 1000000;  int max = -1;  for(int i=0; i<100001; ++i){  if(pos[i] != -1 && pos[i] < min ){   min = pos[i];  }  if( pos[i] > max){   max = pos[i];  }  }  ++min;  ++max;  pw.println(min+" "+max);  pw.close(); }      static class Parser{   StringTokenizer st;  BufferedReader br;  public Parser(InputStream is){  this.br = new BufferedReader( new InputStreamReader(is));    }   public int nextInt(){  return Integer.parseInt(nextToken());  }   public double nextDouble(){  return Double.parseDouble(nextToken());  }   public String nextString(){  return nextToken();  }   public int[] nextIntArray(int s){  int[] a = new int[s];  for(int i=0; i<s; ++i){   a[i] = nextInt();  }  return a;  }   public int[][] nextIntTable(int r, int c){  int[][] a = new int[r][c];  for(int i=0; i<r; ++i){   a[i] = nextIntArray(c);  }  return a;  }   private String nextToken() {  if( st == null || ! st.hasMoreTokens() ){   try{   st = new StringTokenizer( br.readLine());   }catch( Exception e){   e.printStackTrace();   }  }  return st.nextToken();  }   } }
4	public class Main {  public static void main(String[] args) throws Exception {   FastIO in = new FastIO(args);   int t = in.ni();   while (t-- > 0) {    int n = in.ni();    LinkedList<Integer> l = new LinkedList<>();    ArrayList<LinkedList<Integer>> al = new ArrayList<>();    for (int i = 0; i < n; i++) {     int p = in.ni();     if (p == 1) {      l.addFirst(1);     } else {      while (true) {       if (l.peekFirst() == p - 1) {        l.addFirst(l.removeFirst() + 1);        break;       } else {        l.removeFirst();       }      }     }     al.add(new LinkedList<>(l));    }    for (LinkedList<Integer> ll : al) {     while (ll.size() > 1) {      System.out.print(ll.removeLast() + ".");     }     System.out.println(ll.remove());    }    System.out.println();   }   in.bw.flush();  }  static boolean willbealive(int i, int a[]) {   if (i < 0 || i >= a.length)    return false;   if (a.length == 1)    return false;   if (a[i] == 1)    return false;   if (i == 0)    return a[1] == 1;   else if (i == a.length - 1)    return a[i - 1] == 1;   else    return (a[i - 1] == 1) ^ (a[i + 1] == 1);  }  static class Data implements Comparable<Data> {   int a, b;   public Data(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public int compareTo(Data o) {    if (a == o.a) {     return Integer.compare(b, o.b);    }    return Integer.compare(a, o.a);   }   public static void sort(int a[]) {    Data d[] = new Data[a.length];    for (int i = 0; i < a.length; i++) {     d[i] = new Data(a[i], 0);    }    Arrays.sort(d);    for (int i = 0; i < a.length; i++) {     a[i] = d[i].a;    }   }  }  static class FastIO {   private final BufferedReader br;   private final BufferedWriter bw;   private String s[];   private int index;   public FastIO(String[] args) throws IOException {    if (args.length > 1) {     br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(args[0]))));     bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(args[1]))));    } else {     br = new BufferedReader(new InputStreamReader(System.in));     bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));    }    s = br.readLine().split(" ");    index = 0;   }   public int ni() throws IOException {    return Integer.parseInt(nextToken());   }   public double nd() throws IOException {    return Double.parseDouble(nextToken());   }   public long nl() throws IOException {    return Long.parseLong(nextToken());   }   public String next() throws IOException {    return nextToken();   }   public String nli() throws IOException {    try {     return br.readLine();    } catch (IOException ex) {    }    return null;   }   public int[] gia(int n) throws IOException {    int a[] = new int[n];    for (int i = 0; i < n; i++) {     a[i] = ni();    }    return a;   }   public int[] gia(int n, int start, int end) throws IOException {    validate(n, start, end);    int a[] = new int[n];    for (int i = start; i < end; i++) {     a[i] = ni();    }    return a;   }   public double[] gda(int n) throws IOException {    double a[] = new double[n];    for (int i = 0; i < n; i++) {     a[i] = nd();    }    return a;   }   public double[] gda(int n, int start, int end) throws IOException {    validate(n, start, end);    double a[] = new double[n];    for (int i = start; i < end; i++) {     a[i] = nd();    }    return a;   }   public long[] gla(int n) throws IOException {    long a[] = new long[n];    for (int i = 0; i < n; i++) {     a[i] = nl();    }    return a;   }   public long[] gla(int n, int start, int end) throws IOException {    validate(n, start, end);    long a[] = new long[n];    for (int i = start; i < end; i++) {     a[i] = nl();    }    return a;   }   public void print(String s) throws IOException {    bw.write(s);   }   public void println(String s) throws IOException {    bw.write(s);    bw.newLine();   }   public void print(int s) throws IOException {    bw.write(s + "");   }   public void println(int s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(long s) throws IOException {    bw.write(s + "");   }   public void println(long s) throws IOException {    bw.write(s + "");    bw.newLine();   }   public void print(double s) throws IOException {    bw.write(s + "");   }   public void println(double s) throws IOException {    bw.write(s + "");    bw.newLine();   }   private String nextToken() throws IndexOutOfBoundsException, IOException {    if (index == s.length) {     s = br.readLine().split(" ");     index = 0;    }    return s[index++];   }   private void validate(int n, int start, int end) {    if (start < 0 || end >= n) {     throw new IllegalArgumentException();    }   }  } }
1	public class ChainReaction {  public static void main(String [] args) {  Scanner kb = new Scanner(System.in);  int num = kb.nextInt();   int[] beacons = new int[1000002];  for (int i=0; i<num; i++) {  beacons[kb.nextInt()] = kb.nextInt();  }   int [] dp = new int[1000002];  int max = 0;  if (beacons[0] != 0)  dp[0] = 1;   for (int i=1; i<dp.length; i++) {  if (beacons[i] == 0) {   dp[i] = dp[i-1];  } else {   int index = i-1-beacons[i];   if (index<0)   dp[i] = 1;   else   dp[i] = 1 + dp[index];  }  max = Math.max(max, dp[i]);      }   System.out.println(num-max); } }
4	public class C{  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   solver.solve(in, out);   out.close();  }   static class Task{   double eps= 0.00000001;   static final int MAXN = 10000001;      static int spf[] = new int[MAXN];   Map<Integer,Set<Integer>> dp= new HashMap<>();           public void sieve()   {    spf[1] = 1;    for (int i=2; i<MAXN; i++)              spf[i] = i;           for (int i=4; i<MAXN; i+=2)     spf[i] = 2;    for (int i=3; i*i<MAXN; i++)    {         if (spf[i] == i)     {           for (int j=i*i; j<MAXN; j+=i)                    if (spf[j]==j)        spf[j] = i;     }    }   }        public Set<Integer> getFactorization(int x)   {    if(dp.containsKey(x)) return dp.get(x);    Set<Integer> ret = new HashSet<>();    while (x != 1)    {     if(spf[x]!=2) ret.add(spf[x]);     x = x / spf[x];    }    dp.put(x,ret);    return ret;   }     public int lowerIndex(List<Integer> arr, int n, int x)   {    int l = 0, h = n - 1;    while (l <= h)    {     int mid = (l + h) / 2;     if (arr.get(mid) >= x)      h = mid - 1;     else      l = mid + 1;    }    return l;   }      public int upperIndex(List<Integer> arr, int n, int y)   {    int l = 0, h = n - 1;    while (l <= h)    {     int mid = (l + h) / 2;     if (arr.get(mid) <= y)      l = mid + 1;     else      h = mid - 1;    }    return h;   }      public int countInRange(List<Integer> arr, int n, int x, int y)   {       int count = 0;    count = upperIndex(arr, n, y) -      lowerIndex(arr, n, x) + 1;    return count;   }   InputReader in;   PrintWriter out;   public void solve(InputReader in, PrintWriter out) {    this.in=in;    this.out=out;    int t=in.nextInt();    while(t-->0){     int n= in.nextInt();     int[] arr= new int[n];     for(int i=0;i<n;i++) arr[i]= in.nextInt();     int[] cur= new int[n];     int idx=0;     for(int num: arr){      if(idx<n && num==cur[idx]+1){       cur[idx]=num;       printRes(cur, idx);       idx++;      }      else{       for(int i=idx;i>=0;i--){        if(i<n && num!=cur[i]+1) cur[i]=0;        else{         cur[i]=num;         printRes(cur,i);         i++;         idx=i;         break;        }       }      }     }    }   }   public void printRes(int[] cur, int idx){    for(int i=0;i<idx;i++) out.print(cur[i]+".");    out.println(cur[idx]);   }   public boolean ok(char[] s){    boolean allEqual = true;    boolean Alternate = true;    for (int i = 0; i < s.length - 1; i++){     if (s[i]!=s[i+1]){      allEqual = false;     }     else{      Alternate = false;     }    }    if (s[0] == '0' || s[s.length-1] == '0'){     return false;    }    return allEqual || Alternate;   }      public static boolean nextPermutation(char[] array){    boolean hasNext = false;    int i;    for(i = array.length-2; i >= 0; i--){     if(array[i] < array[i+1]){      hasNext = true;      break;     }    }        if(!hasNext){     return false;    }           int j;    for(j = i+1; j < array.length; j++){     if(array[j] <= array[i]){      break;     }    }    j--;           swap(array, i, j);    reverse(array, i+1, array.length);      return true;   }   public static void swap(char[] array, int i, int j) {    char temp =array[i];    array[i] = array[j];    array[j] =temp;   }   public static void reverse(char[] array, int start, int end){    for(int i = start, j = end-1; i < j; i++, j--) {     swap(array, i, j);    }   }   public static class compareL implements Comparator<Tuple>{    @Override    public int compare(Tuple t1, Tuple t2) {     return t2.l - t1.l;    }   }   public static class compareR implements Comparator<Tuple>{    @Override    public int compare(Tuple t1, Tuple t2) {     return t1.r - t2.r;    }   }   public static class Tuple{    public int l, r, w;    public Tuple(int l, int r,int w){     this.l = l; this.r= r;     this.w =w;    }   }   public static class Range implements Comparable<Range>{    public int l, r;    List<Integer> data;    int weight;    public Range(int l, int r, List<Integer> data){     this.data = data;     this.l = l; this.r =r;     this.weight = (int)1e9;    }    @Override    public int compareTo(Range o) {     return this.l - o.l;    }   }   public int _gcd(int a, int b)   {    if(b == 0) {     return a;    }    else {     return _gcd(b, a % b);    }   }  }  static class Tuple implements Comparable<Tuple>{   int x, y, z;   public Tuple(int x, int y, int z){    this.x= x;    this.y= y;    this.z=z;   }   @Override   public int compareTo(Tuple o){    return this.x-o.x;   }  }  static class Pair implements Comparable<Pair>{   public int x;   public int y;   public Pair(int x, int y){    this.x= x;    this.y= y;   }   @Override   public int compareTo(Pair o) {    return this.x-o.x;   }  }   static class InputReader {   BufferedReader br;   StringTokenizer st;   public InputReader(InputStream stream) {    br = new BufferedReader(new InputStreamReader(stream));   }   public String nextToken() {    while (st == null || !st.hasMoreTokens()) {     String line = null;     try {      line = br.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }     if (line == null) {      return null;     }     st = new StringTokenizer(line);    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextToken());   }   public double nextDouble(){    return Double.parseDouble(nextToken());   }   public long nextLong(){    return Long.parseLong(nextToken());   }  } }
0	public class n5D {  public static void main(String[] args)  {   double a = 0, v = 0, l = 0, d = 0, w = 0;   try   {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String[] str = br.readLine().split(" ");    a = Double.parseDouble(str[0]);    v = Double.parseDouble(str[1]);    str = br.readLine().split(" ");    l = Double.parseDouble(str[0]);    d = Double.parseDouble(str[1]);    w = Double.parseDouble(str[2]);   }   catch(Exception e)   {    System.out.println(e);   }   double t1, t2, t3, t4, t5, t, D = 0;     if (w > v) w = v;   t2 = d / v - v / a + w * w / 2 / a / v;   if (t2 >= 0)   {    t1 = v / a;    t3 = t1 - w / a;   }   else   {    if (Math.sqrt(2 * d / a) > (w / a))    {     t1 = Math.sqrt((2 * a * d + w * w) / (a * a * 2));     t3 = t1 - w / a;    }    else    {     t1 = Math.sqrt(2 * d / a);     t3 = 0;    }    t2 = 0;   }   t5 = (l - d - v * v / 2 / a + a * (t1 - t3) * (t1 - t3) / 2) / v;   if (t5 >= 0) t4 = v / a - (t1 - t3);   else   {    t5 = 0;    t4 = -t1 + t3 + Math.sqrt((t1 - t3) * (t1 - t3) + 2 * (l - d) / a);   }   t = t1 + t2 + t3 + t4 + t5;   System.out.println(t);    } }
3	public class Main implements Runnable { static final double time = 1e9; static final int MOD = (int) 1e9 + 7; static final long mh = Long.MAX_VALUE; static final Reader in = new Reader(); static final PrintWriter out = new PrintWriter(System.out); StringBuilder answer = new StringBuilder(); long start = System.nanoTime();   public static void main(String[] args) {  new Thread(null, new Main(), "persefone", 1 << 28).start(); }  @Override public void run() {   solve();   printf();  long elapsed = System.nanoTime() - start;   close();  }    void solve() {  int n = in.nextInt();  int[] a = in.nextIntArray(n);  int invertions = 0;  for (int i = 1; i < n; i++) {  for (int j = i - 1; j > -1; j--) {   if (a[j] > a[i])   invertions++;  }  }  invertions %= 2;  for (int q = in.nextInt(); q > 0; q--) {  int l = in.nextInt();  int r = in.nextInt();   int k = r - l + 1;  k = (k * (k - 1) >> 1) % 2;  if (invertions == k) {   invertions = 0;   add("even", '\n');  } else {   invertions = 1;   add("odd", '\n');  }  }  }   void printf() {  out.print(answer); }  void close() {  out.close(); }  void printf(Stream<?> str) {  str.forEach(o -> add(o, " "));  add("\n"); }   void printf(Object... obj) {  printf(false, obj); }  void printfWithDescription(Object... obj) {  printf(true, obj); }    private void printf(boolean b, Object... obj) {  if (obj.length > 1) {  for (int i = 0; i < obj.length; i++) {   if (b) add(obj[i].getClass().getSimpleName(), " - ");   if (obj[i] instanceof Collection<?>) {   printf((Collection<?>) obj[i]);   } else if (obj[i] instanceof int[][]) {   printf((int[][])obj[i]);   } else if (obj[i] instanceof long[][]) {   printf((long[][])obj[i]);   } else if (obj[i] instanceof double[][]) {   printf((double[][])obj[i]);   } else printf(obj[i]);  }  return;  }  if (b) add(obj[0].getClass().getSimpleName(), " - ");  printf(obj[0]); }  void printf(Object o) {  if (o instanceof int[])  printf(Arrays.stream((int[]) o).boxed());  else if (o instanceof char[])  printf(new String((char[]) o));  else if (o instanceof long[])  printf(Arrays.stream((long[]) o).boxed());  else if (o instanceof double[])  printf(Arrays.stream((double[]) o).boxed());  else if (o instanceof boolean[]) {  for (boolean b : (boolean[]) o) add(b, " ");  add("\n");  }  else   add(o, "\n"); }  void printf(int[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(long[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(double[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(boolean[]... obj) {  for (int i = 0; i < obj.length; i++) printf(obj[i]); }  void printf(Collection<?> col) {  printf(col.stream()); }  <T, K> void add(T t, K k) {  if (t instanceof Collection<?>) {  ((Collection<?>) t).forEach(i -> add(i, " "));  } else if (t instanceof Object[]) {  Arrays.stream((Object[]) t).forEach(i -> add(i, " "));  } else  add(t);  add(k); }    <T> void add(T t) {  answer.append(t); }  @SuppressWarnings("unchecked") <T extends Comparable<? super T>> T min(T... t) {  if (t.length == 0)  return null;  T m = t[0];  for (int i = 1; i < t.length; i++)  if (t[i].compareTo(m) < 0)   m = t[i];  return m; }  @SuppressWarnings("unchecked") <T extends Comparable<? super T>> T max(T... t) {  if (t.length == 0)  return null;  T m = t[0];  for (int i = 1; i < t.length; i++)  if (t[i].compareTo(m) > 0)   m = t[i];  return m; }  int gcd(int a, int b) {  return (b == 0) ? a : gcd(b, a % b); }  long gcd(long a, long b) {  return (b == 0) ? a : gcd(b, a % b); }   int[] ext_gcd(int a, int b) {  if (b == 0) return new int[] {a, 1, 0 };  int[] vals = ext_gcd(b, a % b);  int d = vals[0];   int p = vals[2];  int q = vals[1] - (a / b) * vals[2];  return new int[] { d, p, q };  }   boolean find_any_solution(int a, int b, int c, int[] root) {  int[] vals = ext_gcd(Math.abs(a), Math.abs(b));  if (c % vals[0] != 0) return false;  printf(vals);  root[0] = c * vals[1] / vals[0];  root[1] = c * vals[2] / vals[0];  if (a < 0) root[0] *= -1;  if (b < 0) root[1] *= -1;  return true; }  int mod(int x) { return x % MOD; }  int mod(int x, int y) { return mod(mod(x) + mod(y)); }  long mod(long x) { return x % MOD; }  long mod (long x, long y) { return mod(mod(x) + mod(y)); }  int lw(long[] f, int l, int r, long k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] >= k) r = m - 1; else l = m + 1;  }  return l; }  int up(long[] f, int l, int r, long k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] > k) r = m - 1; else l = m + 1;  }  return l; }  int lw(int[] f, int l, int r, int k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] >= k) r = m - 1; else l = m + 1;  }  return l; }  int up(int[] f, int l, int r, int k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (f[m] > k) r = m - 1; else l = m + 1;  }  return l; }  <K extends Comparable<K>> int lw(List<K> li, int l, int r, K k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (li.get(m).compareTo(k) >= 0)    r = m - 1;   else    l = m + 1;  }  return l; }  <K extends Comparable<K>> int up(List<K> li, int l, int r, K k) {  int R = r, m = 0;  while (l <= r) {  m = l + r >> 1;   if (m == R) return m;   if (li.get(m).compareTo(k) > 0)    r = m - 1;   else    l = m + 1;  }  return l; }   <K extends Comparable<K>> int bs(List<K> li, int l, int r, K k) {  while (l <= r) {  int m = l + r >> 1;   if (li.get(m) == k) return m;   else if (li.get(m).compareTo(k) < 0)   l = m + 1;   else    r = m - 1;  }  return -1; }  long calc(int base, int exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * ((m * m) % MOD)) % MOD; }  long calc(int base, long exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * ((m * m) % MOD)) % MOD; }  long calc(long base, long exponent) {  if (exponent == 0) return 1;  if (exponent == 1) return base % MOD;  long m = calc(base, exponent / 2);  if (exponent % 2 == 0) return (m * m) % MOD;  return (base * (m * m % MOD)) % MOD; }  long power(int base, int exponent) {  if (exponent == 0) return 1;  long m = power(base, exponent / 2);  if (exponent % 2 == 0) return m * m;  return base * m * m; }  void swap(int[] a, int i, int j) {  a[i] ^= a[j];  a[j] ^= a[i];  a[i] ^= a[j]; }  void swap(long[] a, int i, int j) {  long tmp = a[i];  a[i] = a[j];  a[j] = tmp; }  static class Pair<K extends Comparable<? super K>, V extends Comparable<? super V>>  implements Comparable<Pair<K, V>> {  private K k;  private V v;  Pair() {}  Pair(K k, V v) {  this.k = k;  this.v = v;  }  K getK() { return k; }  V getV() { return v; }  void setK(K k) { this.k = k; }  void setV(V v) { this.v = v; }  void setKV(K k, V v) {  this.k = k;  this.v = v;  }  @SuppressWarnings("unchecked")  @Override  public boolean equals(Object o) {  if (this == o) return true;  if (o == null || !(o instanceof Pair)) return false;  Pair<K, V> p = (Pair<K, V>) o;  return k.compareTo(p.k) == 0 && v.compareTo(p.v) == 0;  }  @Override  public int hashCode() {  int hash = 31;  hash = hash * 89 + k.hashCode();  hash = hash * 89 + v.hashCode();  return hash;  }  @Override  public int compareTo(Pair<K, V> pair) {  return k.compareTo(pair.k) == 0 ? v.compareTo(pair.v) : k.compareTo(pair.k);  }  @Override  public Pair<K, V> clone() {  return new Pair<K, V>(this.k, this.v);  }  @Override  public String toString() {  return String.valueOf(k).concat(" ").concat(String.valueOf(v)).concat("\n");  } }  static class Reader {  private BufferedReader br;  private StringTokenizer st;  Reader() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  try {   while (st == null || !st.hasMoreTokens()) {   st = new StringTokenizer(br.readLine());   }  } catch (IOException e) {   e.printStackTrace();  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  int[] nextIntArray(int n) {  int[] arr = new int[n];  for (int i = 0; i < n; i++)   arr[i] = nextInt();  return arr;  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String s = "";  try {   s = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return s;  } } }
4	public final class C {  static class Node {   int val;   String path;   Node node;   Node(String p, int t) {    path = p;    val = t;   }  }  public static void main(String[] args) {   final FastScanner fs = new FastScanner();   final int t = fs.nextInt();   final StringBuilder sb = new StringBuilder();   for (int test = 0; test < t; test++) {    final int n = fs.nextInt();    final Deque<Node> dq = new ArrayDeque<>();    dq.offerLast(new Node("", 0));    for (int i = 0; i < n; i++) {     final int next = fs.nextInt();     if (dq.getFirst().val + 1 != next) {      if (next == 1) {       final Node peek = dq.getFirst();       final String p = peek.path.isEmpty() ? String.valueOf(peek.val)                : (peek.path + '.' + peek.val);       dq.addFirst(new Node(p, 1));      } else {       while (dq.getFirst().val + 1 != next) {        dq.removeFirst();       }       dq.getFirst().val++;      }     } else {      dq.getFirst().val++;     }     add(sb, dq.getFirst(), dq.getFirst().val);    }   }   System.out.println(sb);  }  private static void add(StringBuilder sb, Node node, int val) {   final String p = node.path.isEmpty() ? String.valueOf(val)            : (node.path + '.' + val);   sb.append(p);   sb.append('\n');  }  static final class Utils {   private static class Shuffler {    private static void shuffle(int[] x) {     final Random r = new Random();     for (int i = 0; i <= x.length - 2; i++) {      final int j = i + r.nextInt(x.length - i);      swap(x, i, j);     }    }    private static void shuffle(long[] x) {     final Random r = new Random();     for (int i = 0; i <= x.length - 2; i++) {      final int j = i + r.nextInt(x.length - i);      swap(x, i, j);     }    }    private static void swap(int[] x, int i, int j) {     final int t = x[i];     x[i] = x[j];     x[j] = t;    }    private static void swap(long[] x, int i, int j) {     final long t = x[i];     x[i] = x[j];     x[j] = t;    }   }   public static void shuffleSort(int[] arr) {    Shuffler.shuffle(arr);    Arrays.sort(arr);   }   public static void shuffleSort(long[] arr) {    Shuffler.shuffle(arr);    Arrays.sort(arr);   }   private Utils() {}  }  static class FastScanner {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer("");   private String next() {    while (!st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {           e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   int[] nextIntArray(int n) {    final int[] a = new int[n];    for (int i = 0; i < n; i++) { a[i] = nextInt(); }    return a;   }   long[] nextLongArray(int n) {    final long[] a = new long[n];    for (int i = 0; i < n; i++) { a[i] = nextLong(); }    return a;   }  } }
3	public class Main {  static class Reader  {   private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}   public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}   public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}   public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}   public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}   public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}   public double d() throws IOException {return Double.parseDouble(s()) ;}   public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }   public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }   public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}  }                         public static void main(String[] args)throws IOException  {   Reader sc=new Reader();   PrintWriter out=new PrintWriter(System.out);   int n=sc.i();   int arr[]=sc.arr(n);   int count=0;   for(int i=0;i<n;i++)for(int j=i+1;j<n;j++)if(arr[j]<arr[i])count++;   count%=2;   int q=sc.i();   while(q-->0)   {    int a=sc.i();    int b=sc.i();    long len=((long)(b-a+1)*(b-a))/2;    if(len%2==1)count^=1;    if(count==0)out.println("even");    else out.println("odd");   }   out.flush();  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  StreamInputReader in = new StreamInputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB { public void solve(int testNumber, StreamInputReader in, PrintWriter out) {   int N = in.readInt();   int K = in.readInt();   int[] A = new int[N];   for(int i = 0; i < N; i++)    A[i] = in.readInt();   int num = 0;   int left = 0;   int right = 0;   int[] seen = new int[100005];   while(right < N && num < K) {    if(seen[A[right]] == 0)     num++;    seen[A[right]]++;    right++;   }   right--;   if(num == K) {    while(seen[A[left]] > 1) {     seen[A[left]]--;     left++;    }    out.print((left + 1) + " " + (right + 1));    return;   }   out.print("-1 -1"); } } class StreamInputReader extends InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar, numChars;  public StreamInputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  } abstract class InputReader {  public abstract int read();  public int readInt() {   return Integer.parseInt(readString());  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  }
3	public class P911d {  private static void solve() {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int cnt = 0;  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   if (a[i] > a[j]) {   cnt++;   }  }  }  cnt %= 2;  int m = nextInt();  for (int i = 0; i < m; i++) {  int l = nextInt();  int r = nextInt();   int size = r - l + 1;  long sum = ((long)size * (size - 1)) / 2;   sum %= 2;   cnt += sum;  cnt %= 2;   System.out.println(cnt == 0 ? "even" : "odd");  } }  private static void run() {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  private static StringTokenizer st; private static BufferedReader br; private static PrintWriter out;  private static String next() {  while (st == null || !st.hasMoreElements()) {  String s;  try {   s = br.readLine();  } catch (IOException e) {   return null;  }  st = new StringTokenizer(s);  }  return st.nextToken(); }  private static int nextInt() {  return Integer.parseInt(next()); }  private static long nextLong() {  return Long.parseLong(next()); }  public static void main(String[] args) {  run(); } }
0	public class A {  public static void main(String[] args) {  Scanner sc =new Scanner (System.in);   long a=sc.nextLong(); long b=sc.nextLong();     if(b-a <=1)   System.out.println("-1");   else if(b-a==2 && a%2==1)   System.out.println("-1");   else   {   if(a%2==1)    System.out.println((a+1)+" "+(a+2)+" "+(a+3));   else    System.out.println((a)+" "+(a+1)+" "+(a+2));   }   sc.close(); } }
5	public class A {  public static void main(String [] args){   try(Scanner s = new Scanner(System.in)){    final int n = s.nextInt();    final int m = s.nextInt();    final int k = s.nextInt();    final int [] a = new int [n];    for (int i = 0; i < a.length; ++i){     a[i] = s.nextInt();    }    Arrays.sort(a);    int i = a.length - 1;    int available = k;    int filters = 0;    while (available < m && i >= 0){     available -= 1;     available += a[i];     filters++;     i--;    }    if (available < m){     System.out.println(-1);    }else{     System.out.println(filters);    }   }  } }
5	public class round159A {  static BufferedReader br = new BufferedReader(new InputStreamReader(    System.in));  static StringTokenizer st = new StringTokenizer("");  static int nextInt() throws Exception {   return Integer.parseInt(next());  }  static String next() throws Exception {   while (true) {    if (st.hasMoreTokens()) {     return st.nextToken();    }    String s = br.readLine();    if (s == null) {     return null;    }    st = new StringTokenizer(s);   }  }  public static void main(String[] args) throws Exception {   int n = nextInt();   int m = nextInt();   int k = nextInt();   int[] supply = new int[n];   for (int i = 0; i < n; ++i)    supply[i] = nextInt();   if (m <= k) {    System.out.println(0);   } else {    int have = k;    Arrays.sort(supply);    for(int i = n - 1 ; i >= 0 ; --i){     have--;     have += supply[i];     if(have >= m){      System.out.println(n - i);      return;     }    }    System.out.println(-1);   }  } }
6	public class Solution implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int[] x;  int[] y;  int n;  int X, Y;  int[] d;  int[][] dist;  int sqr(int a) {   return a * a;  }  int dist(int X, int Y, int i) {   return sqr(X - x[i]) + sqr(Y - y[i]);  }  int[] dp;  byte[][] pred;  int rec(int mask) {   if (dp[mask] == -1) {    int res = 1 << 29;    boolean ok = false;    for (int i = 0; i < n; ++i)     if ((mask & (1 << i)) > 0) {      ok = true;      int mm = mask & ~(1 << i);      for (int j = i; j < n; j++)       if ((mask & (1 << j)) > 0) {        int nmask = mm & ~(1 << j);        int a = rec(nmask) + d[i] + d[j] + dist[i][j];        if (a < res) {         res = a;         pred[0][mask] = (byte) (i);         pred[1][mask] = (byte) (j);        }       }      break;     }    if (!ok)     res = 0;    dp[mask] = res;   }   return dp[mask];  }  void solve() throws IOException {   X = ni();   Y = ni();   n = ni();        x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = ni();    y[i] = ni();   }   d = new int[n];   dist = new int[n][n];   for (int i = 0; i < n; ++i)    d[i] = dist(X, Y, i);   for (int i = 0; i < n; ++i)    for (int j = 0; j < n; j++) {     dist[i][j] = dist(x[i], y[i], j);    }   pred = new byte[2][1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(rec((1 << n) - 1));   int a = (1 << n) - 1;   while (a > 0) {    if (pred[0][a] != pred[1][a])     out.print(0 + " " + (pred[0][a] + 1) + " " + (pred[1][a] + 1)       + " ");    else     out.print(0 + " " + (pred[0][a] + 1) + " ");    int na = a & ~(1 << pred[0][a]);    na &= ~(1 << pred[1][a]);    a = na;   }   out.println(0);  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException,    InterruptedException {   Thread th = new Thread(null, new Solution(), "", 536870912);   th.start();   th.join();  }  @Override  public void run() {   try {    Locale.setDefault(Locale.US);    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();    in.close();    out.close();   } catch (Exception e) {      }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int m = in.nextInt();    int count = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (a[i] > a[j]) count++;     }    }    StringBuilder res = new StringBuilder();    int l, r, temp, c1, c2;    while (m-- > 0) {     l = in.nextInt() - 1;     r = in.nextInt() - 1;     c1 = c2 = 0;     for (int i = 0; i < (r - l + 1) / 2; i++) {      if (a[l + i] > a[r - i]) c1++;      else c2++;      temp = a[l + i];      a[l + i] = a[r - i];      a[r - i] = temp;     }     count = count + c1 - c2;     res.append(Math.abs(count) % 2 == 1 ? "odd" : "even").append('\n');    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public int[] nextIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; ++i) {     array[i] = nextInt();    }    return array;   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     tokenizer = new StringTokenizer(readLine());    }    return tokenizer.nextToken();   }   public String readLine() {    String line;    try {     line = reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    return line;   }  } }
1	public class Main{ public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  while(sc.hasNext()) {  int n=sc.nextInt();  String s=sc.next();  int sum=0;  for(int i=0;i<s.length();i++) {   if(s.charAt(i)=='+') {   sum++;   }   if(s.charAt(i)=='-'&&sum!=0) {   sum--;   }  }  System.out.println(sum);  } } }
4	public class C{  public static void main(String args[])  {   Scanner sc=new Scanner(System.in);   long mod=1000000007l;   int cases=sc.nextInt();    while(cases>0)   {    cases--;    Stack<Integer> stack=new Stack<>();    int n=sc.nextInt();    for(int j=0;j<n;j++)    {     int x=sc.nextInt();     if(x==1)     {      stack.add(1);     }     else     {      int p=stack.pop();      if(p==x-1)      {       stack.add(x);      }      else {       while (p != x-1) {        p = stack.pop();       }       stack.add(x);      }     }     StringBuilder f=new StringBuilder();     Stack<Integer> temp=new Stack<>();     while(stack.isEmpty()==false)     {      temp.add(stack.pop());     }     while(temp.isEmpty()==false)     {      int z=temp.pop();      f.append(z+".");      stack.add(z);     }      System.out.println(f.substring(0,f.length()-1));    }   }  } }
2	public class C817{  void solve() {  long n = nl(), s = nl();  long l = 0, r = n;  while(l < r)  {  long mid = (l + r)/2;  if(mid - digSum(mid) < s)   l = mid + 1;  else   r = mid;  }  out.println(l - digSum(l) >= s ? (n - l + 1) : 0); }  int digSum(long k) {  int sum = 0;  while(k != 0)  {  sum += k % 10;  k /= 10;  }  return sum; }  public static void main(String[] args){new C817().run();}  private byte[] bufferArray = new byte[1024]; private int bufLength = 0; private int bufCurrent = 0; InputStream inputStream; PrintWriter out;  public void run() {  inputStream = System.in;  out = new PrintWriter(System.out);  solve();  out.flush(); }  int nextByte() {  if(bufLength==-1)  throw new InputMismatchException();  if(bufCurrent>=bufLength)  {  bufCurrent = 0;  try  {bufLength = inputStream.read(bufferArray);}  catch(IOException e)  { throw new InputMismatchException();}  if(bufLength<=0)   return -1;  }  return bufferArray[bufCurrent++]; }  boolean isSpaceChar(int x) {return (x<33 || x>126);}  boolean isDigit(int x) {return (x>='0' && x<='9');}  int nextNonSpace() {  int x;  while((x=nextByte())!=-1 && isSpaceChar(x));  return x; }  int ni() {  long ans = nl();  if ( Integer.MIN_VALUE <= ans && ans <= Integer.MAX_VALUE )  return (int)ans;  throw new InputMismatchException(); }  long nl() {  long ans = 0;  boolean neg = false;  int x = nextNonSpace();  if(x=='-')  {  neg = true;  x = nextByte();  }  while(!isSpaceChar(x))  {  if(isDigit(x))  {   ans = ans*10 + x -'0';   x = nextByte();  }  else   throw new InputMismatchException();  }  return neg ? -ans:ans; }  String ns() {  StringBuilder sb = new StringBuilder();  int x = nextNonSpace();  while(!isSpaceChar(x))  {  sb.append((char)x);  x = nextByte();  }  return sb.toString(); }  char nc() { return (char)nextNonSpace();}  double nd() { return (double)Double.parseDouble(ns()); }  char[] ca() { return ns().toCharArray();}  char[] ca(int n) {  char[] ans = new char[n];  int p =0;  int x = nextNonSpace();  while(p<n)  {  ans[p++] = (char)x;  x = nextByte();  }  return ans; }  int[] ia(int n) {  int[] ans = new int[n];  for(int i=0;i<n;i++)  ans[i]=ni();  return ans; }  }
4	public class c1523 implements Runnable{   public static void main(String[] args) {  try{    new Thread(null, new c1523(), "process", 1<<26).start();   }   catch(Exception e){    System.out.println(e);   }  } public void run() {  FastReader scan = new FastReader();   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   Task solver = new Task();  int t = scan.nextInt();   for(int i = 1; i <= t; i++) solver.solve(i, scan, out);  out.close(); }  static class Task {  static final int oo = Integer.MAX_VALUE;  static final long OO = Long.MAX_VALUE;  public void solve(int testNumber, FastReader sc, PrintWriter out) {  int N = sc.nextInt();  int[] arr = sc.readArray(N);    Stack<Integer> cur = new Stack<>();  StringBuilder sb = new StringBuilder("");  for(int i = 0; i < N; i++) {   if(arr[i] == 1) {   cur.add(1);   } else {   while(cur.peek() != arr[i] - 1)    cur.pop();   cur.pop();   cur.add(arr[i]);   }     for(int each: cur) {   sb.append(each + ".");   }   sb.deleteCharAt(sb.length()-1);   sb.append("\n");  }    out.println(sb);  }   } static long modInverse(long N, long MOD) {  return binpow(N, MOD - 2, MOD); } static long modDivide(long a, long b, long MOD) {  a %= MOD;  return (binpow(b, MOD-2, MOD) * a) % MOD; } static long binpow(long a, long b, long m) {  a %= m;  long res = 1;  while (b > 0) {  if ((b & 1) == 1)   res = res * a % m;  a = a * a % m;  b >>= 1;  }  return res; } static int[] reverse(int a[])  {   int[] b = new int[a.length];   for (int i = 0, j = a.length; i < a.length; i++, j--) {    b[j - 1] = a[i];   }      return b;  } static long[] reverse(long a[])  {   long[] b = new long[a.length];   for (int i = 0, j = a.length; i < a.length; i++, j--) {    b[j - 1] = a[i];   }      return b;  }  static void shuffle(Object[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  Object temp = a[i];  a[i] = a[r];  a[r] = temp;  } }  static void shuffle(int[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  int temp = a[i];  a[i] = a[r];  a[r] = temp;  } } static void shuffle(long[] a) {  Random get = new Random();  for (int i = 0; i < a.length; i++) {  int r = get.nextInt(a.length);  long temp = a[i];  a[i] = a[r];  a[r] = temp;  } }  static class tup implements Comparable<tup>, Comparator<tup>{  int a, b;  tup(int a,int b){  this.a=a;  this.b=b;  }  public tup() {  }  @Override  public int compareTo(tup o){  return Integer.compare(b,o.b);  }  @Override  public int compare(tup o1, tup o2) {  return Integer.compare(o1.b, o2.b);  }   @Override  public int hashCode() {  return Objects.hash(a, b);  }   @Override  public boolean equals(Object obj) {   if (this == obj)     return true;   if (obj == null)     return false;   if (getClass() != obj.getClass())     return false;   tup other = (tup) obj;   return a==other.a && b==other.b;  }    @Override  public String toString() {   return a + " " + b;  } }  static class FastReader {  BufferedReader br;  StringTokenizer st;  public FastReader() {  br = new BufferedReader(new InputStreamReader(System.in));  }  public FastReader(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(new File(s)));  }  String next() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }   int[] readArray(int size) {  int[] a = new int[size];  for(int i = 0; i < size; i++) {   a[i] = nextInt();  }  return a;  }   long[] readLongArray(int size) {  long[] a = new long[size];  for(int i = 0; i < size; i++) {   a[i] = nextLong();  }  return a;  } }  static void dbg(int[] arr) {  System.out.println(Arrays.toString(arr)); } static void dbg(long[] arr) {  System.out.println(Arrays.toString(arr)); } static void dbg(boolean[] arr) {  System.out.println(Arrays.toString(arr)); }  static void dbg(Object... args) {   for (Object arg : args)    System.out.print(arg + " ");   System.out.println();  } }
1	public class Main { boolean eof;  public String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "-1";  }  }  return st.nextToken(); }  public int nextInt() {  return Integer.parseInt(nextToken()); }  int NOD(int a, int b) {  while (a * b > 0) {  if (a > b) {   a %= b;  } else {   b %= a;  }  }  return a + b; }  void solve() {  int n = nextInt(), k= nextInt();  int[] a = new int[n];  for (int i = 0; i < n; ++i){  a[i] = nextInt() - 1;  }  int[] b = new int[100000];  int p = 0;  for (int i = 0; i < n; ++i){  ++b[a[i]];  if (b[a[i]] == 1){   ++p;  }  if (k == p){   int j;   for (j = 0; j <= i; ++j){   if (b[a[j]] > 1){    --b[a[j]];   } else {    break;   }   }   out.print((j + 1) + " " + (i + 1));   return;  }  }  out.print("-1 -1"); }  BufferedReader br; StringTokenizer st; PrintWriter out;  void run() {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new OutputStreamWriter(System.out));       solve();  br.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  public static void main(String[] args) {  new Main().run(); } }
3	public class ProblemD {  static int mod = (int) (1e9+7);  static InputReader in;  static PrintWriter out;   static void update(int i, int val, int[] bit){   for(; i < bit.length; i += (i&-i))    bit[i] += val;  }   static int query(int i, int[] bit){   int ans=0;     for(; i>0; i -= (i&-i))    ans += bit[i];     return ans;  }   static int get(int l, int r, int[] bit){   if(l > r) return 0;   return query(r, bit) - query(l - 1, bit);  }   static void solve()  {   in = new InputReader(System.in);   out = new PrintWriter(System.out);        int n = in.nextInt();   int[] arr = new int[n + 1];   int[] bit = new int[n + 2];     for(int i = 1; i <= n; i++){    arr[i] = in.nextInt();   }   int cnt = 0;     for(int i = n; i > 0; i--){    cnt += query(arr[i], bit);    update(arr[i], 1, bit);   }   cnt %= 2;     int q = in.nextInt();   while(q-- > 0){       int l = in.nextInt();    int r = in.nextInt();    int length = r - l + 1;    int x = (length * (length - 1)) / 2;    x %= 2;    cnt ^= x;    out.println(cnt == 0 ? "even" : "odd");   }     out.close();  }   public static void main(String[] args)  {   new Thread(null ,new Runnable(){    public void run(){     try{      solve();     } catch(Exception e){      e.printStackTrace();     }    }   },"1",1<<26).start();    }  static class Pair implements Comparable<Pair>  {   long x,y;   Pair (long x,long y)   {     this.x = x;     this.y = y;   }   public int compareTo(Pair o)   {    return Long.compare(this.x,o.x);       }   public boolean equals(Object o)   {    if (o instanceof Pair)    {     Pair p = (Pair)o;     return p.x == x && p.y==y;    }    return false;   }   @Override   public String toString()   {    return x + " "+ y ;   }     }   static long add(long a,long b){   long x=(a+b);   while(x>=mod) x-=mod;   return x;  }  static long sub(long a,long b){   long x=(a-b);   while(x<0) x+=mod;   return x;  }   static long mul(long a,long b){   long x=(a*b);   while(x>=mod) x-=mod;   return x;  }   static String rev(String s){   StringBuilder sb=new StringBuilder(s);   sb.reverse();   return sb.toString();  }   static long gcd(long x,long y)  {   if(y==0)     return x;   else     return gcd(y,x%y);  }  static int gcd(int x,int y)  {   if(y==0)     return x;   else     return gcd(y,x%y);  }  static long pow(long n,long p,long m)  {   long result = 1;   if(p==0){    return 1;   }      while(p!=0)   {    if(p%2==1)     result *= n;    if(result >= m)     result %= m;    p >>=1;    n*=n;    if(n >= m)     n%=m;   }     return result;  }  static long pow(long n,long p)  {   long result = 1;   if(p==0)    return 1;   while(p!=0)   {    if(p%2==1)     result *= n;     p >>=1;    n*=n;    }   return result;  }  static void debug(Object... o)  {    System.out.println(Arrays.deepToString(o));  }  static class InputReader  {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream)   {     this.stream = stream;   }   public int snext()   {     if (snumChars == -1)       throw new InputMismatchException();     if (curChar >= snumChars)     {       curChar = 0;       try       {         snumChars = stream.read(buf);       } catch (IOException e)       {         throw new InputMismatchException();       }       if (snumChars <= 0)         return -1;     }     return buf[curChar++];   }   public int nextInt()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     int sgn = 1;     if (c == '-')     {       sgn = -1;       c = snext();     }     int res = 0;     do     {       if (c < '0' || c > '9')         throw new InputMismatchException();       res *= 10;       res += c - '0';       c = snext();     } while (!isSpaceChar(c));     return res * sgn;   }   public long nextLong()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     int sgn = 1;     if (c == '-')     {       sgn = -1;       c = snext();     }     long res = 0;     do     {       if (c < '0' || c > '9')         throw new InputMismatchException();       res *= 10;       res += c - '0';       c = snext();     } while (!isSpaceChar(c));     return res * sgn;   }   public int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)     {       a[i] = nextInt();     }     return a;   }   public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)     {       a[i] = nextLong();     }     return a;   }   public String readString()   {     int c = snext();     while (isSpaceChar(c))     {       c = snext();     }     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isSpaceChar(c));     return res.toString();   }   public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do     {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(c));     return res.toString();   }   public boolean isSpaceChar(int c)   {     if (filter != null)       return filter.isSpaceChar(c);     return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   private boolean isEndOfLine(int c)   {     return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter   {     public boolean isSpaceChar(int ch);   }  } }
0	public class Solution {  public static void main(String[] args) {     Scanner t=new Scanner(System.in);   long l=t.nextLong();   long r=t.nextLong();   if(r-l<2) System.out.println(-1);   else if(r-l<3 && l%2!=0){    if(l%3!=0) System.out.println(-1);    else if ((l+3)%2==0) System.out.println(-1);     else System.out.println(l+" "+(l+1)+" "+(l+3));   } else{    while (l%2!=0) l++;    System.out.println(l+" "+(l+1)+" "+(l+2));   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.readInt();    int[] a = in.readIntArray(n);    int swap = 0;    for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) if (a[i] > a[j]) swap ^= 1;    int m = in.readInt();    while (m-- > 0) {     int l = in.readInt();     int r = in.readInt();     int s = (r - l + 1);     s = s * (s - 1) / 2;     swap ^= s;     out.println((swap & 1) == 0 ? "even" : "odd");    }   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public int readInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public int[] readIntArray(int size) {    int[] ans = new int[size];    for (int i = 0; i < size; i++) ans[i] = readInt();    return ans;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
5	public class Main {  static class Scanner {  StreamTokenizer in;  boolean forceMode = false;   Scanner(InputStream is, String codePage, boolean forceMode) {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));   if (!forceMode) {    in.resetSyntax();    in.wordChars(33, 255);    in.whitespaceChars(0, 32);   }  }   Scanner(InputStream is, String codePage) {   in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));   if (!forceMode) {    in.resetSyntax();    in.wordChars(33, 255);    in.whitespaceChars(0, 32);   }  }   String next() {   try {    in.nextToken();    return in.sval;   } catch (Exception e) {    throw new Error();   }  }   int nextInt() {   if (forceMode) {    try {     in.nextToken();     return (int) in.nval;    } catch (Exception e) {     throw new Error();    }   } else {    return Integer.parseInt(next());   }  }   long nextLong() {   if (forceMode) {    throw new Error("No long at force mod!");   } else {    return Long.parseLong(next());   }   }   double nextDouble() {   if (forceMode) {    try {     in.nextToken();     return in.nval;    } catch (Exception e) {     throw new Error();    }   } else {    return Double.parseDouble(next());   }  }  }  static class Assertion {  static void checkRE(boolean e) {   if (!e) {    throw new Error();   }  }   static void checkTL(boolean e) {   if (!e) {    int idx = 1;    while (idx > 0) {     idx++;    }   }  }  }  Scanner in;  PrintWriter out;  class Int implements Comparable<Int> {  int value;  int pos;   public Int(int value, int pos) {   this.value = value;   this.pos = pos;  }   @Override  public int compareTo(Int second) {   if (this.value == second.value) {    return this.pos - second.pos;   } else {    return this.value - second.value;   }  }  }  void solve() {  int n = in.nextInt();  Int ar[] = new Int[n];  for (int i = 0; i < ar.length; i++) {   ar[i] = new Int(in.nextInt(), i);  }  Arrays.sort(ar);  int cnt = 0;  for (int i = 0; i < ar.length; i++) {   if (ar[i].value!=ar[ar[i].pos].value) {    cnt++;   }  }  if (cnt == 2 || cnt == 0) {   out.println("YES");  } else {   out.println("NO");  }  }  final static String fileName = "";  void run() {                    in = new Scanner(System.in, "");  out = new PrintWriter(System.out);  try {   solve();  } catch (Exception e) {   throw new Error(e);  } finally {   out.close();  }  }  public static void main(String[] args) {  new Main().run();  } }
6	public class CF8C { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s = br.readLine();  int si = s.indexOf(' ', 0);  int x = Integer.parseInt(s.substring(0, si));  int y = Integer.parseInt(s.substring(si + 1));  int n = Integer.parseInt(br.readLine());  int[] xx = new int[n + 1];  int[] yy = new int[n + 1];  for (int i = 0; i < n; i++) {  s = br.readLine();  si = s.indexOf(' ', 0);  xx[i] = Integer.parseInt(s.substring(0, si));  yy[i] = Integer.parseInt(s.substring(si + 1));  }  xx[n] = x;  yy[n] = y;  int[][] dd = new int[n + 1][n + 1];  for (int i = 0; i <= n; i++)  for (int j = i + 1; j <= n; j++) {   int dx = xx[i] - xx[j];   int dy = yy[i] - yy[j];   dd[i][j] = dx * dx + dy * dy;  }  int[] aa = new int[1 << n];  int[] bb = new int[1 << n];  for (int k = 1; k < 1 << n; k++) {  int a = -1;  for (int b = 0; b < n; b++)   if ((k & 1 << b) > 0) {   a = b;   break;   }  int l = k ^ 1 << a;  int d = dd[a][n] + dd[a][n];  aa[k] = aa[l] + d;  bb[k] = l;  for (int b = a + 1; b < n; b++)   if ((k & 1 << b) > 0) {   l = k ^ 1 << a ^ 1 << b;   d = dd[a][n] + dd[b][n] + dd[a][b];   if (aa[l] + d < aa[k]) {    aa[k] = aa[l] + d;    bb[k] = l;   }   }  }  int k = (1 << n) - 1;  System.out.println(aa[k]);  StringBuilder sb = new StringBuilder();  sb.append(0);  while (k != 0) {  int l = bb[k];  int m = k ^ l;  for (int b = 0; b < n; b++)   if ((m & 1 << b) > 0)   sb.append(' ').append(b + 1);  sb.append(' ').append(0);  k = l;  }  System.out.println(sb); } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt();   int k=in.nextInt();   int arr[]=new int[n];   in.getArray(arr);   int ansl=-1;   int ansr=n;   int occ[]=new int[100100];   boolean f[]=new boolean[n];   Arrays.fill(occ,0);   Arrays.fill(f,true);   int pk=0;   for (int l=0,r=0;r<n&&l<n;){    int num=arr[r];    if(f[r]){     f[r]=false;     occ[num]++;     if(occ[num]==1){      pk++;     }    }       if(pk<k){     r++;    }    else if (pk==k){     if((r-l)<=(ansr-ansl)){      ansl=l+1;      ansr=r+1;     }     num=arr[l];     occ[num]--;     if(occ[num]==0){      pk--;     }     l++;    }    else {     num=arr[l];     occ[num]--;     if(occ[num]==0){      pk--;     }     l++;    }   }   if(ansl==-1){    ansr=-1;   }   out.println(ansl+" "+ansr);  } } class InputReader{  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream){   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }  public String next(){   while (tokenizer == null||!tokenizer.hasMoreTokens()){    try{     tokenizer = new StringTokenizer(reader.readLine());    }    catch (IOException e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt(){   return Integer.parseInt(next());  }  public void getArray(int arr[]){   for(int i=0;i<arr.length;i++){    arr[i]=nextInt();   }  }  }
1	public class A {  public static long Mod = (long) (1e9 + 7);  public static long[][] dp;  public static void main(String[] args) throws FileNotFoundException {   PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] data = new int[n];   int[]u = new int[n];   int[]s = new int[n];   HashMap<Integer, Integer> map = new HashMap();     for(int i = 0; i < n; i++){    u[i] = i;    data[i] = in.nextInt();    map.put(data[i], i);   }     boolean ok = true;   boolean[]check = new boolean[n];   for(int i = 0; i < n; i++){    if(map.containsKey(a - data[i])){     u[find(i, u)]= u[find(map.get(a- data[i]), u)];     s[i] |= 1;    }    if(map.containsKey(b - data[i])){     u[find(i, u)]= u[find(map.get(b- data[i]), u)];     s[i] |= 2;    }      }   int[]g = new int[n];   Arrays.fill(g,3);   for(int i = 0; i< n; i++){    if(s[i] == 0){     ok = false;     break;    }    g[find(i, u)] &= s[i];    if(g[find(i,u)] == 0){     ok = false;     break;    }   }     if(ok){    out.println("YES");    for(int i = 0; i < n; i++){     if((g[find(i,u)] & 1) == 0){      out.print(1 + " ");     }else{      out.print(0 + " ");     }    }   }else{    out.println("NO");   }   out.close();  }   static int find(int index, int[]u){   if(index != u[index]){    return u[index] = find(u[index], u);   }   return index;  }  public static long pow(int a, int b, long mod) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long v = pow(a, b / 2, mod);   if (b % 2 == 0) {    return (v * v) % mod;   } else {    return (((v * v) % mod) * a) % mod;   }  }  public static int[][] powSquareMatrix(int[][] A, long p) {   int[][] unit = new int[A.length][A.length];   for (int i = 0; i < unit.length; i++) {    unit[i][i] = 1;   }   if (p == 0) {    return unit;   }   int[][] val = powSquareMatrix(A, p / 2);   if (p % 2 == 0) {    return mulMatrix(val, val);   } else {    return mulMatrix(A, mulMatrix(val, val));   }  }  public static int[][] mulMatrix(int[][] A, int[][] B) {   int[][] result = new int[A.length][B[0].length];   for (int i = 0; i < result.length; i++) {    for (int j = 0; j < result[0].length; j++) {     long temp = 0;     for (int k = 0; k < A[0].length; k++) {      temp += ((long) A[i][k] * B[k][j] % Mod);      temp %= Mod;     }     temp %= Mod;     result[i][j] = (int) temp;    }   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;    }  static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   void update(int index, int val) {       while (index < data.length) {     data[index] += val;     index += index & (-index);         }   }   int get(int index) {       int result = 0;    while (index > 0) {     result += data[index];     index -= index & (-index);        }    return result;   }  }  static long gcd(long a, long b) {   if (b == 0) {    return a;   } else {    return gcd(b, a % b);   }  }  static long pow(long a, int b) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2);   if (b % 2 == 0) {    return val * val % Mod;   } else {    return (val * val % Mod) * a % Mod;   }  }         static Point minus(Point a, Point b) {   return new Point(a.x - b.x, a.y - b.y);  }      static double cross(Point a, Point b, Point c) {   Point ab = new Point(b.x - a.x, b.y - a.y);   Point ac = new Point(c.x - a.x, c.y - a.y);   return cross(ab, ac);  }  static double cross(Point a, Point b) {   return a.x * b.y - a.y * b.x;  }    static long dot(Point a, Point b, Point c) {   Point ab = new Point(b.x - a.x, b.y - a.y);   Point ac = new Point(c.x - a.x, c.y - a.y);   return dot(ab, ac);  }  static long dot(Point a, Point b) {   long total = a.x * b.x;   total += a.y * b.y;   return total;  }  static double dist(Point a, Point b) {   long total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   return Math.sqrt(total);  }  static long norm(Point a) {   long result = a.x * a.x;   result += a.y * a.y;   return result;  }  static double dist(Point a, Point b, Point x, boolean isSegment) {   double dist = cross(a, b, x) / dist(a, b);      if (isSegment) {    Point ab = new Point(b.x - a.x, b.y - a.y);    long dot1 = dot(a, b, x);    long norm = norm(ab);    double u = (double) dot1 / norm;    if (u < 0) {     return dist(a, x);    }    if (u > 1) {     return dist(b, x);    }   }   return Math.abs(dist);    }  static long squareDist(Point a, Point b) {   long x = a.x - b.x;   long y = a.y - b.y;   return x * x + y * y;  }  static class Point {   int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }   @Override   public String toString() {    return "Point{" + "x=" + x + ", y=" + y + '}';   }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() throws FileNotFoundException {       br = new BufferedReader(new InputStreamReader(System.in));      }   public String next() {     while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
6	public class Main { static Scanner in = new Scanner(System.in); static Coor[] p; static Coor ori; static int n; static int dp[]; static Coor pre[]; public static void main(String[] args) {  ori = new Coor(in.nextInt(),in.nextInt());  n = in.nextInt();  p = new Coor[n];  dp = new int[1<<n];  pre = new Coor[1<<n];  for (int i = 0;i < n;i++) {  p[i] = new Coor(in.nextInt(),in.nextInt());  }  Arrays.fill(dp,-1);  dp[0] = 0;  System.out.println( getdp((1<<n)-1));   System.out.printf("%d",0);  trace((1<<n)-1);  System.out.println(); } static void trace(int mask) {  if (mask == 0) return;  if (pre[mask].y == -1) {  System.out.printf(" %d %d",pre[mask].x+1,0);  trace( mask - ( 1<< pre[mask].x ) );  } else {  System.out.printf(" %d %d %d",pre[mask].x+1,pre[mask].y+1,0);  trace( mask - ( 1<< pre[mask].x ) - (1<<pre[mask].y));  } } static int getdp(int mask) {  if (dp[mask] != -1)   return dp[mask];  int fr = 0;  for (int i = 0;i < n;i++)   if ( (mask & (1 << i)) != 0 ) {   fr = i;   break;  }  dp[mask] = getdp( mask - (1 << fr) ) + 2 * p[fr].dist(ori);  pre[mask] = new Coor(fr,-1);  for (int i = fr+1;i < n;i++) {  int to = i;  if ( (mask & (1 << i)) != 0) {   int tmp = getdp( mask - (1<<fr) - (1<<i) ) + p[fr].dist(ori) + p[to].dist(ori) + p[fr].dist(p[to]);   if (tmp < dp[mask]) {   dp[mask] = tmp;   pre[mask].y = i;   }  }  }  return dp[mask]; } } class Coor { int x,y; Coor(int _x,int _y) {  x = _x;y = _y; } int dist(Coor o) {  return ( (x-o.x) * (x-o.x) + (y-o.y) * (y-o.y) ); } }
3	public class Template {  String fileName = "";  long INF = Long.MAX_VALUE / 3;  int MODULO = 1000*1000*1000+7;  long[] fenwik;  int BORDER = 1000*1000+100;  void solve() throws IOException {   int n = readInt();   int[] a = new int[n];   for(int i=0; i<n; ++i){    a[i] = readInt();   }   fenwik = new long[BORDER];   long ans = 0;   for(int i=n-1;i>=0;--i){    ans+=sumFenwik(a[i]);    incFenwik(a[i],1);   }   boolean even = ans % 2 == 0;   int m = readInt();   for(int i=0; i<m; ++i){    int l = readInt();    int r = readInt();    if(((r-l+1)/2)%2==1){     even = !even;    }    out.println(even?"even":"odd");   }  }  void incFenwik(int i, int delta){   for(;i<BORDER;i = i|(i+1)){    fenwik[i]+=delta;   }  }  long sumFenwik(int r){   long sum = 0;   for(;r>=0;r = (r&(r+1))-1){    sum+=fenwik[r];   }   return sum;  }  int gcd(int a, int b){   return b == 0 ? a : gcd(b, a%b);  }  long binPow(long a, long b, long m) {   if (b == 0) {    return 1;   }   if (b % 2 == 1) {    return ((a % m) * (binPow(a, b - 1, m) % m)) % m;   } else {    long c = binPow(a, b / 2, m);    return (c * c) % m;   }  }  class Fenwik {   long[] t;   int length;   Fenwik(int[] a) {    length = a.length + 100;    t = new long[length];    for (int i = 0; i < a.length; ++i) {     inc(i, a[i]);    }   }   void inc(int ind, int delta) {    for (; ind < length; ind = ind | (ind + 1)) {     t[ind] += delta;    }   }   long getSum(int r) {    long sum = 0;    for (; r >= 0; r = (r & (r + 1)) - 1) {     sum += t[r];    }    return sum;   }  }  class SegmentTree {   int[] t;   SegmentTree(int[] a) {    int n = a.length - 1;    t = new int[n * 4];    build(a, 1, 1, n);   }   void build(int[] a, int v, int tl, int tr) {    if (tl == tr) {     t[v] = a[tl];     return;    }    int mid = (tr + tl) / 2;    build(a, 2 * v, tl, mid);    build(a, 2 * v + 1, mid + 1, tr);    t[v] = Math.max(t[2 * v], t[2 * v + 1]);   }   void update(int v, int tl, int tr, int pos, int value) {    if (tl == tr) {     t[v] = value;     return;    }    int mid = (tl + tr) / 2;    if (pos <= mid) {     update(2 * v, tl, mid, pos, value);    } else {     update(2 * v + 1, mid + 1, tr, pos, value);    }    t[v] = Math.max(t[2 * v], t[2 * v + 1]);   }   int getMax(int v, int tl, int tr, int l, int r) {    if (l > r) {     return -1000 * 1000;    }    if (tl == tr) {     return t[v];    }    if (l == tl && r == tr) {     return t[v];    }    int mid = (tl + tr) / 2;    int max1 = getMax(2 * v, tl, mid, l, Math.min(mid, r));    int max2 = getMax(2 * v + 1, mid + 1, tr, Math.max(mid + 1, l), r);    return Math.max(max1, max2);   }  }  public static void main(String[] args) throws NumberFormatException, IOException {     new Template().run();  }  void run() throws NumberFormatException, IOException {   solve();   out.close();  };  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  String delim = " ";  Random rnd = new Random();  Template() throws FileNotFoundException {   try {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   } catch (Exception e) {    if (fileName.isEmpty()) {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     in = new BufferedReader(new FileReader(fileName + ".in"));     out = new PrintWriter(fileName + ".out");    }   }   tok = new StringTokenizer("");  }  String readLine() throws IOException {   return in.readLine();  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    String nextLine = readLine();    if (null == nextLine) {     return null;    }    tok = new StringTokenizer(nextLine);   }   return tok.nextToken();  }  int readInt() throws NumberFormatException, IOException {   return Integer.parseInt(readString());  }  long readLong() throws NumberFormatException, IOException {   return Long.parseLong(readString());  }  double readDouble() throws NumberFormatException, IOException {   return Double.parseDouble(readString());  } }
2	public class Practice{ static long MOD=(long)Math.pow(10,9)+7; public static void main(String args[]) {   new Thread(null, new Runnable() {    public void run() {     try{      solve();      w.close();     }     catch(Exception e){      e.printStackTrace();     }    }   }, "1", 1 << 26).start(); } static InputReader in;  static PrintWriter w;  static void solve(){   in = new InputReader(System.in);   w = new PrintWriter(System.out);   long n=in.nextLong();   long s=in.nextLong();   long low=1,high=n,ans=-1;   while(low<=high){   long mid=(low+high)/2;   if(check(mid,s)){    ans=mid;    high=mid-1;   }else{    low=mid+1;   }   }   if(ans==-1){   w.println(0);   }else   w.println(n-ans+1);  }  static boolean check(long n,long s){  long temp=n;  long sum=0;  while(temp>0){   sum+=temp%10;   temp=temp/10;  }  if(n-sum>=s){   return true;  }  return false;  }  static int adj[][];  static int V;    static void Graph(int v){   V = v;   adj=new int[v][v];    }   static void addEdge(int u,int v,int w){   adj[u][v]=w;  }          static long gcd(long a,long b){  if(a==0){  return b;  }  return gcd(b%a,a); }  static long power(long base, long exponent, long modulus){  long result = 1L;  while (exponent > 0) {   if (exponent % 2L == 1L)    result = (result * base) % modulus;   exponent = exponent >> 1;   base = (base * base) % modulus;  }  return result; }  static HashMap<Long,Long> primeFactors(long n){   HashMap<Long,Long> ans=new HashMap<Long,Long>();     while (n%2L==0L)   {    if(ans.containsKey(2L)){    ans.put(2L,ans.get(2L)+1L);    }else{    ans.put(2L,1L);    }    n /= 2L;   }         for (long i = 3; i <= Math.sqrt(n); i+= 2L)   {       while (n%i == 0)    {    if(ans.containsKey(i)){     ans.put(i,ans.get(i)+1L);     }else{     ans.put(i,1L);     }     n /= i;    }   }         if (n > 2)    ans.put(n,1L);   return ans;  }  static void sieve(int N) {  boolean isPrime[]=new boolean[N+1];  isPrime[0] = true;  isPrime[1] = true;  for(int i = 2; i * i <= N; ++i) {   if(isPrime[i] == false) {    for(int j = i * i; j <= N ;j += i)     isPrime[j] = true;   }  } }    static int Arr[];  static long size[];   static void initialize(int N){  Arr=new int[N];  size=new long[N];   for(int i = 0;i<N;i++){   Arr[ i ] = i ;   size[ i ] = 1;   }  }  static boolean find(int A,int B){   if( root(A)==root(B) )     return true;   else   return false;  }   static void weighted_union(int A,int B,int n){   int root_A = root(A);   int root_B = root(B);   if(size[root_A] < size[root_B ]){   Arr[ root_A ] = Arr[root_B];   size[root_B] += size[root_A];   }   else{   Arr[ root_B ] = Arr[root_A];   size[root_A] += size[root_B];   }  }  static int root (int i){   while(Arr[ i ] != i){    Arr[ i ] = Arr[ Arr[ i ] ] ;    i = Arr[ i ];   }   return i;  }    static boolean isPrime(long n) {  if(n < 2L) return false;  if(n == 2L || n == 3L) return true;  if(n%2L == 0 || n%3L == 0) return false;  long sqrtN = (long)Math.sqrt(n)+1L;  for(long i = 6L; i <= sqrtN; i += 6L) {  if(n%(i-1) == 0 || n%(i+1) == 0) return false;  }  return true; }  static int maxlevel=0;                          static int minPrime[]; static void minimumPrime(int n){  minPrime=new int[n+1];  minPrime[1]=1;   for (int i = 2; i * i <= n; ++i) {    if (minPrime[i] == 0) {       for (int j = i * i; j <= n; j += i) {      if (minPrime[j] == 0) {       minPrime[j] = i;      }     }    }   }   for (int i = 2; i <= n; ++i) {    if (minPrime[i] == 0) {     minPrime[i] = i;    }   } } static long modInverse(long A, long M) {  long x=extendedEuclid(A,M)[0];  return (x%M+M)%M;  } static long[] extendedEuclid(long A, long B) {  if(B == 0) {  long d = A;  long x = 1;  long y = 0;  return new long[]{x,y,d};  }  else {  long arr[]=extendedEuclid(B, A%B);  long temp = arr[0];  arr[0] = arr[1];  arr[1] = temp - (A/B)*arr[1];  return arr;  } }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, numChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream) {    this.stream = stream;   }     public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }    public String nextLine() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isEndOfLine(c));    return res.toString();   }    public String readString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }    public long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }    public int nextInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }    public int[] nextIntArray(int n) {    int[] arr = new int[n];    for (int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }    public long[] nextLongArray(int n) {    long[] arr = new long[n];    for (int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }    public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    private boolean isEndOfLine(int c) {    return c == '\n' || c == '\r' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   } } }
4	public class Main{  static class FastScanner {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer("");   String next() {    while (!st.hasMoreTokens())     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   int[] nextArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++) a[i] = nextInt();    return a;   }   long[] nextArray(long n) {    long[] a = new long[(int) n];    for (int i = 0; i < n; i++) a[i] = nextLong();    return a;   }   long nextLong() {    return Long.parseLong(next());   }  }  static class FastWriter extends PrintWriter {   FastWriter(){    super(System.out);   }   void println(int[] array) {    for(int i=0; i<array.length; i++) {     print(array[i]+" ");    }    println();   }   void println(long [] array) {    for(int i=0; i<array.length; i++) {     print(array[i]+" ");    }    println();   }  }  static class Interval {   long start,end;   Interval(long start, long end)   {    this.start=start;    this.end=end;   }  }  static int MOD=998244353;  public static void main(String[] args){   FastScanner in = new FastScanner();   FastWriter out = new FastWriter();   Scanner sc=new Scanner(System.in);   int t=in.nextInt();     while (t-->0){    int n=in.nextInt();    int[] ar=in.nextArray(n);    int[] level=new int[1005];    int j=1;    level[1]=1;    out.println(1);    for (int i = 1; i < n; i++) {     if(ar[i]==1) {      j++;      level[j] = 1;     }else {      while (j>=1){       if(level[j]+1!=ar[i]){        j--;       }else {        break;       }      }      level[j]++;     }     for (int k = 1; k <= j; k++) {      if(k==j){       out.print(level[k]);      }else {       out.print(level[k]+".");      }     }     out.println();    }   }   out.close();  }  static int highestPowerOf2(int n) {   if (n < 1){ return 0; }   int res = 1;   for (int i = 0; i < 8 * Integer.BYTES; i++) {    int curr = 1 << i;    if (curr > n){ break; }    res = curr;   }   return res;  }  static int reduceFraction(int x, int y) {   int d= gcd(x, y);   return x/d+y/d;  }  static boolean subset(int[] ar,int n,int sum){   if(sum==0){    return true;   }   if(n<0||sum<0){    return false;   }   return subset(ar,n-1,sum)||subset(ar,n-1,sum-ar[n]);  }  static boolean isPrime(int n){   if(n<=1) return false;   for(int i = 2;i<=Math.sqrt(n);i++){    if (n % i == 0) return false;   }   return true;  }  static int gcd(int a, int b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static long gcd(long a, long b) {   if (b == 0) return a;   return gcd(b, a % b);  }  static long lcm(long a, long b) {   return (a * b) / gcd(a, b);  }  static int lcm(int a, int b) {   return (a * b) / gcd(a, b);  }  static boolean isPowerOfTwo(int n) {   if(n==0||n==1){return false;}   double v = Math.log(n) / Math.log(2);   return ((int)(Math.ceil(v)) == (int)(Math.floor(v)));  }  static boolean isPerfectSquare(int x){   if (x >= 0) {    int sr = (int)Math.sqrt(x);    return ((sr * sr) == x);   }   return false;  }  static int lower_bound(int[] arr, int x) {   int low_limit = 0, high_limit = arr.length, mid = -1;   while (low_limit < high_limit) {    mid = (low_limit + high_limit) / 2;    if (arr[mid] >= x){     high_limit = mid;    }else{     low_limit = mid + 1;    }   }   return low_limit;  }  static int upper_bound(int[] arr, int x) {   int low_limit = 0, high_limit = arr.length, mid = -1;   while (low_limit < high_limit) {    mid = (low_limit + high_limit) / 2;    if (arr[mid] > x){     high_limit = mid;    }else{     low_limit = mid + 1;    }   }   return low_limit;  }  static int binarySearch(int[] ar,int n,int num){   int low=0,high=n-1;   while (low<=high){    int mid=(low+high)/2;    if(ar[mid]==num){     return mid;    }else if(ar[mid]>num){     high=mid-1;    }else {     low=mid+1;    }   }   return -1;  } }
6	public class Order8C implements Runnable {  private Scanner in = new Scanner(System.in);  private PrintWriter out = new PrintWriter(System.out);  int mintime;  String path;  int xs;  int ys;  int n;  int[] obx;  int[] oby;   public static void main(String[] args) { new Thread(new Order8C()).start();  }  private void read() { xs = in.nextInt(); ys = in.nextInt(); n = in.nextInt(); obx = new int[n]; oby = new int[n]; for(int i = 0; i<n; i++){  obx[i] = in.nextInt();  oby[i] = in.nextInt(); }   }  private void solve() {   int[] ds = new int[n]; int[][] d = new int[n][n];  int[] best = new int[1 << n]; int[] last = new int[1 << n];  for(int i = 0; i<n; i++){  ds[i] = (obx[i]-xs)*(obx[i]-xs) + (oby[i]-ys)*(oby[i]-ys);  for(int j = i+1; j<n; j++){  d[i][j] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);  d[j][i] = (obx[i]-obx[j])*(obx[i]-obx[j]) + (oby[i]-oby[j])*(oby[i]-oby[j]);  } }  for(int i=0; i< (1<<n); i++){   best[i] = 100000000; } best[0] = 0;  for(int i=0; i< (1<<n); i++){     for(int j = 0; j<n; j++){  if( ((1 << j) & i) != 0){   if(best[i - (1<<j)] + 2*ds[j] < best[i]){  best[i] = best[i - (1<<j)] + 2*ds[j];  last[i] = i - (1<< j);   }   for(int k = j+1; k<n; k++){    if( ((1 << k) & i) != 0){    if( (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]) < best[i]){    best[i] = (best[i-(1<<j) -(1<<k)] +ds[j]+ds[k]+d[j][k]);    last[i] = i -(1<<j) - (1<< k);    }    }   }   break;  }  } } int i = (1<<n) -1; mintime = best[i]; path = "";  while(i >0){    path = path + "0 ";  int dif = i-last[i];   for(int j=0; j<n; j++){  if( ((1<<j) & dif) != 0){   path = path + (j+1) + " ";  }  }    i = last[i]; } path = path + "0";  }  private void write() { out.println(mintime); out.println(path);  }  public void run() { read(); solve(); write(); out.close();  } }
1	public class codef8 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int num = sc.nextInt();  int beacon[] = new int[1000001];  int pos[] = new int[num];  for (int i = 0; i < num; i++) {  int position = sc.nextInt();  beacon[position] = sc.nextInt();  pos[i] = position;  }  int dp[] = new int[1000001];  int max = 1;  if (beacon[0] != 0)  dp[0] = 1;   for (int i = 1; i <= 1000000; i++) {  if (beacon[i] == 0) {   dp[i] = dp[i-1];  }   else {   int j = i - beacon[i] - 1;   if (j < 0) {   dp[i] = 1;   }   else {   dp[i] = dp[j] + 1;   }  }  max = Math.max(max, dp[i]);  }   System.out.println(num-max); } }
6	public class LookingForOrder { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public int[] go; public int[][] cost;  public int [] sol; public Pair[] how; public int n, lim;  public Pair bag; public Pair[] obj;  public void main() {   bag = new Pair(in.nextInt(), in.nextInt());   n = in.nextInt();  obj = new Pair[n];  for(int i=0;i<n;++i) obj[i] = new Pair(in.nextInt(), in.nextInt());   go = new int[n];  cost = new int[n][n];  for(int i=0;i<n;++i)  {  go[i] = squDist(bag, obj[i]);  for(int j=0;j<n;++j) cost[i][j] = squDist(obj[i], obj[j]);  }   lim = (1<<n);   sol = new int[lim];  Arrays.fill(sol, -1);  how = new Pair[lim];   out.println(solve(lim-1));   Pair T;  int set = lim-1;   out.print("0");  while(set > 0)  {  solve(set);  T = how[set];  out.print(" "+(T.x+1));  set = off(T.x, set);  if(T.y >= 0)   {   out.print(" " + (T.y+1));   set = off(T.y, set);  }  out.print(" 0");  }  out.println(); }  public int oo = 987654321;  public boolean in(int x, int set) { return ((1<<x) & set) != 0; }  public int on(int x, int set) { return (set | (1<<x)); }  public int off(int x, int set) { return (set ^ (set & (1<<x)) ); }    public int solve(int set) {  if(sol[set] >= 0) return sol[set];   int ret;  if(set == 0) ret = 0;  else  {  ret = oo;    int x, y, sub, c;  for(x=0;x<n;++x) if(in(x, set)) break;    sub = off(x, set);  c = go[x]+go[x]+solve(sub);    if(c < ret)  {   how[set] = new Pair(x, -1);   ret = c;  }    for(y=x+1;y<n;++y) if(in(y, set))  {   c = go[x]+cost[x][y]+go[y] + solve(off(y, sub));   if(c < ret)   {   ret = c;   how[set] = new Pair(x, y);   }  }  }   return sol[set] = ret; }  public int squDist(int ax, int ay, int bx, int by) {  int dx, dy;  dx = ax - bx;  dy = ay - by;  return dx*dx + dy*dy; }  public int squDist(Pair p, Pair q) {  return squDist(p.x, p.y, q.x, q.y); }   private class Pair implements Comparable<Pair> {  public int x, y;  public Pair(int xx, int yy) { x = xx; y = yy; }  public int compareTo(Pair u)  {  if(x!=u.x) return x-u.x;  return y-u.y;  }  public String toString() { return "(" + x + "," + y + ")"; } }   public static void main(String[] args) {  (new LookingForOrder()).main(); } }
4	public class codeforces {  static final long MOD2 = 998_244_353;  public static void main(String[] args) {   FastScanner sc = new FastScanner();   PrintWriter pw = new PrintWriter(System.out);     int tc = sc.ni();   for (int rep = 0; rep < tc; rep++) {    int N = sc.ni();    int[] arr = sc.intArray(N);    pw.println(solve(arr));   }     pw.close();  }    static String solve(int[] arr) {   StringBuilder sb = new StringBuilder();   List<Integer> list = new ArrayList();   list.add(0);   for (int i = 0; i < arr.length; i++) {    int x = arr[i];    for (int j = list.size() - 1; j >= 0; j--) {     if (x - 1 == list.get(j)) {      list.set(j, x);      while (list.size() > j+1) {       list.remove(list.size() - 1);      }      list.add(0);                 for (int idx = 0; idx < list.size() - 1; idx++) {       sb.append(list.get(idx) + ".");      }      sb.setLength(sb.length() - 1);      sb.append("\n");      break;     }    }   }   sb.setLength(sb.length() - 1);   return sb.toString();  }   static int summation(int x) {   return x * (x+1) / 2;  }  static long pow(long num, long exp, long mod){   long ans=1;   for(int i=1;i<=exp;i++){    ans=(ans*num)%mod;   }   return ans;  }  static boolean isPrime(int n)  {    if (n <= 1)    return false;   else if (n == 2)    return true;   else if (n % 2 == 0)    return false;   for (int i = 3; i <= Math.sqrt(n); i += 2) {    if (n % i == 0)     return false;   }   return true;  }  static int gcd(int a, int b)  {   if (a == 0)    return b;   return gcd(b % a, a);  }  static long gcd(long a, long b) {   if (a == 0) return b;   return gcd(b % a, a);  }  static int lcm(int a, int b)  {   return (a / gcd(a, b)) * b;  }  public static void sort(int[] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    int temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr);  }  public static void sort(long[] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    long temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr);  }  static int charint(char c) {   return Integer.parseInt(String.valueOf(c));  }           public static void printArr(PrintWriter pw, int[] arr) {   StringBuilder sb = new StringBuilder();   for (int x : arr) {    sb.append(x + "");   }   sb.setLength(sb.length() - 1);   pw.println(sb.toString());  }  public static void printArr2d(PrintWriter pw, int[][] arr) {   StringBuilder sb = new StringBuilder();   for (int[] row : arr) {    for (int x : row) {     sb.append(x + " ");    }    sb.setLength(sb.length() - 1);    sb.append("\n");   }   pw.println(sb.toString());  } } class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {   br = new BufferedReader(new InputStreamReader(System.in), 32768);   st = null;  }  String next() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     e.printStackTrace();        }   }   return st.nextToken();  }  int ni() {   return Integer.parseInt(next());  }  int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++)    ret[i] = ni();   return ret;  }  long nl() {   return Long.parseLong(next());  }  long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++)    ret[i] = nl();   return ret;  }  double nd() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } } class MultiSet {  TreeMap<Long, Integer> map = new TreeMap<>();  private int size = 0;  public MultiSet() {  }  public void add(Long val) {   map.put(val, map.getOrDefault(val, 0) + 1);   size++;  }  public void remove(Long val) {   map.put(val, map.get(val) - 1);   if (map.get(val) == 0) {    map.remove(val);   }   size--;  }  public int size() {   return size;  }  public Long higher(Long val) {   return map.higherKey(val);  }  public Long lower(Long val) {   return map.lowerKey(val);  }  public Long ceiling(Long val) {   return map.ceilingKey(val);  }  public Long floor(Long val) {   return map.floorKey(val);  }  public Long first() {   return map.firstKey();  }  public Long last() {   return map.lastKey();  }  public boolean isEmpty() {   return map.isEmpty();  } }
0	public class CF275Ad2 {  public static void main(String[] args) throws Exception {   Scanner scan = new Scanner(System.in);   long l = scan.nextLong();  long r = scan.nextLong();   long diff = r-l;  boolean exists = false;  if(diff >= 3){  if(l%2 == 1){   l++;  }  exists = true;  } else if(diff == 2 && l%2 == 0){  exists = true;  } else if(diff == 2 && gcd(l, r) > 1){  exists = true;  }   if(!exists){  System.out.println("-1");  } else {  System.out.println(l + " " + (l+1) + " " + (l+2));  } }  private static long gcd(long a, long b){  if(b == 0){  return 1;  }  return gcd(b, a % b); } }
2	public class Q1 {  static ArrayList<Integer> adj[],adj2[]; static int color[],cc; static long mod=1000000007; static TreeSet<Integer> ts[]; static boolean b[],visited[],possible,ans1,ans2; static Stack<Integer> s; static int totalnodes,colored,min,minc; static int c[]; static long sum[]; static HashMap<Integer,Integer> hm; public static void main(String[] args) throws IOException {     in=new InputReader(System.in);  out=new PrintWriter(System.out);  String n1=in.readString();  String s1=in.readString();  long s=Long.parseLong(s1);  long n=Long.parseLong(n1);   long l=s-1;  long r=n+1;  HashSet<Long> hset=new HashSet<>();  long last=-1;  while(l<r)  {  long mid=(l+r)/2;  long sum=0;  if(hset.contains(mid))   break;  String d=String.valueOf(mid);  for(int i=0;i<d.length();i++)  {   sum=sum+(d.charAt(i)-'0');  }    hset.add(mid);    if(mid-sum>=s)  {   last=mid;   r=mid;  }  else  {   l=mid;  }  }  if(last==-1)  out.println("0");  else  {  out.println(n-last+1);  }  out.close();  }  static InputReader in; static PrintWriter out;  static void dfs(int i,int parent) {  if(color[i]!=cc)   ans1= false;  for(int j:adj[i])  {   if(j!=parent)   {   dfs(j,i);   }  }   }  static class Pair implements Comparable<Pair> {  int i;  int j;  int index;  public Pair(){    }  public Pair(int u, int v,int index) {  this.i = u;  this.j= v;  this.index=index;  }  public int compareTo(Pair other) {       return this.i-other.i;  }    } static class Node2{  Node2 left = null;  Node2 right = null;  Node2 parent = null;  int data; }   static class BinarySearchTree{  Node2 root = null;  int height = 0;  int max = 0;  int cnt = 1;  ArrayList<Integer> parent = new ArrayList<>();  HashMap<Integer, Integer> hm = new HashMap<>();  public void insert(int x){  Node2 n = new Node2();  n.data = x;  if(root==null){   root = n;  }  else{   Node2 temp = root,temp2 = null;   while(temp!=null){   temp2 = temp;   if(x>temp.data) temp = temp.right;   else temp = temp.left;   }   if(x>temp2.data) temp2.right = n;   else temp2.left = n;   n.parent = temp2;   parent.add(temp2.data);  }  }  public Node2 getSomething(int x, int y, Node2 n){  if(n.data==x || n.data==y) return n;  else if(n.data>x && n.data<y) return n;  else if(n.data<x && n.data<y) return getSomething(x,y,n.right);  else return getSomething(x,y,n.left);  }  public Node2 search(int x,Node2 n){  if(x==n.data){   max = Math.max(max, n.data);   return n;  }  if(x>n.data){   max = Math.max(max, n.data);   return search(x,n.right);  }  else{   max = Math.max(max, n.data);   return search(x,n.left);  }  }  public int getHeight(Node2 n){  if(n==null) return 0;  height = 1+ Math.max(getHeight(n.left), getHeight(n.right));  return height;  } } public static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } public static String rev(String s) { StringBuilder sb=new StringBuilder(s); sb.reverse(); return sb.toString(); } static long lcm(long a, long b) {  return a * (b / gcd(a, b)); } static long gcd(long a, long b) {  while (b > 0)  {   long temp = b;   b = a % b;   a = temp;  }  return a; } public static long max(long x, long y, long z){  if(x>=y && x>=z) return x;  if(y>=x && y>=z) return y;  return z; } static int[] sieve(int n,int[] arr) { for(int i=2;i*i<=n;i++) {  if(arr[i]==0)  {  for(int j=i*2;j<=n;j+=i)   arr[j]=1;  } } return arr; }   static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1)  throw new InputMismatchException(); if (curChar >= snumChars) {  curChar = 0;  try {  snumChars = stream.read(buf);  } catch (IOException e) {  throw new InputMismatchException();  }  if (snumChars <= 0)  return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) {  c = snext(); } int sgn = 1; if (c == '-') {  sgn = -1;  c = snext(); } int res = 0; do {  if (c < '0' || c > '9')  throw new InputMismatchException();  res *= 10;  res += c - '0';  c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) {  c = snext(); } int sgn = 1; if (c == '-') {  sgn = -1;  c = snext(); } long res = 0; do {  if (c < '0' || c > '9')  throw new InputMismatchException();  res *= 10;  res += c - '0';  c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) {  return nextIntArray(n, 0);  }   public int[] nextIntArray(int n, int off) {  int[] arr = new int[n + off];  for (int i = 0; i < n; i++) {  arr[i + off] = nextInt();  }  return arr;  }   public long[] nextLongArray(int n) { return nextLongArray(n, 0);  }    public long[] nextLongArray(int n, int off) {  long[] arr = new long[n + off];  for (int i = 0; i < n; i++) {  arr[i + off] = nextLong();  } return arr; }  public String readString() { int c = snext(); while (isSpaceChar(c)) {  c = snext(); } StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c))  c = snext(); StringBuilder res = new StringBuilder(); do {  res.appendCodePoint(c);  c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null)  return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } }  }
1	public class Main { static class MyReader{  private BufferedReader reader = null;  private StringTokenizer tokenizer = null;  MyReader(Reader r) throws IOException{   reader = new BufferedReader(r);  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } } public static void main(String []args) throws IOException{  PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));  MyReader reader = new MyReader(new InputStreamReader(System.in));  int n = reader.nextInt();  int k = reader.nextInt();  int []a = new int[n];  for (int i = 0; i < n; ++i)  a[i] = reader.nextInt();  int j = 0;  HashMap<Integer,Integer> map = new HashMap<>();  for (int i = 0; i < n; ++i){  if (map.containsKey(a[i]))   map.put(a[i], map.get(a[i])+1);  else{   map.put(a[i], 1);   if (map.size()==k) { j = i+1; break; }  }  }  if (map.size()<k){  System.out.println("-1 -1");  return;  }  for (int i = 0; i < n; ++i){  if (map.get(a[i])==1){   System.out.println(i+1 + " " + j);   return;  }  map.put(a[i], map.get(a[i])-1);  } }  }
5	public class Main { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] in = br.readLine().split(" ");   int n=Integer.parseInt(in[0]),m=Integer.parseInt(in[1]),k=Integer.parseInt(in[2]);   StringTokenizer st = new StringTokenizer(br.readLine());  int[] caps = new int[n];  for (int i = 0; i < caps.length; i++) {  caps[i] = Integer.parseInt(st.nextToken());  }  Arrays.sort(caps);   int curSockets=k, neededLines=0;  int i = n-1;  while(curSockets<m && i>=0){  curSockets+=caps[i]-1;  neededLines++;  i--;  }  if(curSockets>=m)  System.out.println(neededLines);  else  System.out.println(-1); } }
3	public class F_DSU {  public static void main(String[] args)throws Exception {   FastReader in = new FastReader(System.in);   PrintWriter pw = new PrintWriter(System.out);   n = in.nextInt();     int brr[] = new int[2*n];   for (int i = 0; i < 2*n; i+= 2) {    brr[i] = in.nextInt();    brr[i+1] = in.nextInt();   }   arr = shrink(brr);   int imap[] = new int[2*n];   for (int i = 0; i < 2*n; i++) {    imap[arr[i]] = brr[i];   }   int idx = binarySearch(arr.length);   if(idx >= arr.length) pw.println(-1);   else pw.println(imap[idx]);   pw.close();  }  static int n, arr[];  static int binarySearch(int H) {   int lo = 0, hi = H, mid;   while (lo < hi) {    mid = (lo + hi) / 2;    if (check(mid)) hi = mid;    else lo = mid + 1;   }   if(lo > 0 && check(lo-1)) return lo-1;   return lo;  }  static boolean check(int m){   DSU dsu = new DSU(2*n);   for (int i = 0; i < n; i++) {    int u = arr[2*i], v = arr[2*i+1];    if(u > m) return false;    if(v > m){     if(++dsu.cycle[dsu.find(u)] >= 2) return false;    }    else{     if(!dsu.union(u, v)){      if(++dsu.cycle[dsu.find(u)] >= 2) return false;     }     else{      if(dsu.cycle[dsu.find(u)] >= 2) return false;     }    }   }   return true;  }  static class DSU{   int parent[], cycle[], n;   DSU(int N){    n = N;    parent = new int[N];    cycle = new int[N];    for(int i = 0; i < N; i++){     parent[i] = i;    }   }   DSU(int [] p){    parent = p; n = p.length;   }   int find(int i) {    int p = parent[i];    if (i == p) return i;    return parent[i] = find(p);   }   boolean equiv(int u, int v){    return find(u) == find(v);   }   boolean union(int u, int v){    u = find(u); v = find(v);    if(u != v) {     parent[u] = parent[v];     cycle[v] += cycle[u];    }    return u != v;   }   int count(){    int cnt = 0;    for(int i = 0; i < n; i++){     if(i == find(i)) cnt++;    }    return cnt;   }  }  public static int[] shrink(int[] a) {   int n = a.length;   long[] b = new long[n];   for(int i = 0;i < n;i++)b[i] = (long)a[i]<<32|i;   Arrays.sort(b);   int[] ret = new int[n];   int p = 0;   for(int i = 0;i < n;i++) {    if(i>0 && (b[i]^b[i-1])>>32!=0)p++;    ret[(int)b[i]] = p;   }   return ret;  }  static void debug(Object...obj) {   System.err.println(Arrays.deepToString(obj));  }  static class FastReader {   InputStream is;   private byte[] inbuf = new byte[1024];   private int lenbuf = 0, ptrbuf = 0;   static final int ints[] = new int[128];   public FastReader(InputStream is){    for(int i='0';i<='9';i++) ints[i]=i-'0';    this.is = is;   }   public int readByte(){    if(lenbuf == -1)throw new InputMismatchException();    if(ptrbuf >= lenbuf){     ptrbuf = 0;     try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }     if(lenbuf <= 0)return -1;    }    return inbuf[ptrbuf++];   }   public boolean isSpaceChar(int c) {    return !(c >= 33 && c <= 126);   }   public int skip() {    int b;    while((b = readByte()) != -1 && isSpaceChar(b));    return b;   }   public String next(){    int b = skip();    StringBuilder sb = new StringBuilder();    while(!(isSpaceChar(b))){     sb.appendCodePoint(b);     b = readByte();    }    return sb.toString();   }   public int nextInt(){    int num = 0, b;    boolean minus = false;    while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));    if(b == '-'){     minus = true;     b = readByte();    }    while(true){     if(b >= '0' && b <= '9'){      num = (num<<3) + (num<<1) + ints[b];     }else{      return minus ? -num : num;     }     b = readByte();    }   }   public long nextLong() {    long num = 0;    int b;    boolean minus = false;    while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));    if(b == '-'){     minus = true;     b = readByte();    }    while(true){     if(b >= '0' && b <= '9'){      num = (num<<3) + (num<<1) + ints[b];     }else{      return minus ? -num : num;     }     b = readByte();    }   }   public double nextDouble() {    return Double.parseDouble(next());   }      public char[] next(int n){    char[] buf = new char[n];    int b = skip(), p = 0;    while(p < n && !(isSpaceChar(b))){     buf[p++] = (char)b;     b = readByte();    }    return n == p ? buf : Arrays.copyOf(buf, p);   }     } }
1	public class Main {  static BufferedReader reader;  static StringTokenizer tokenizer;  static PrintWriter writer;  static int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  static long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  static double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  static String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  public static void main(String[] args) throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   writer = new PrintWriter(System.out);   pineapple();   reader.close();   writer.close();  }  static void pineapple() throws NumberFormatException, IOException {   int n = nextInt();   int a = nextInt();   int b = nextInt();   HashSet<Integer> al = new HashSet<Integer>();   HashMap<Integer, Integer> mp = new HashMap<Integer, Integer>();   int[] ans = new int[n];   Arrays.fill(ans, -1);   HashSet<Integer> used = new HashSet<Integer>();   int[] mas = new int[n];   for (int i = 0; i < n; i++) {    int t = nextInt();    al.add(t);    mas[i] = t;    mp.put(t, i);   }   for (int st : al) {    if (used.contains(st))     continue;    {     int pr = st;     int cc = -1;     HashSet<Integer> u2 = new HashSet<Integer>();     u2.add(pr);     if (!u2.contains(a - pr) && al.contains(a - pr))      cc = a - pr;     if (!u2.contains(a - pr) && al.contains(b - pr))      cc = b - pr;     if (cc != -1) {      u2.add(cc);      boolean bGo = true;      while (bGo) {       bGo = false;       int nxt = -1;       if (!u2.contains(a - cc) && al.contains(a - cc))        nxt = a - cc;       if (!u2.contains(b - cc) && al.contains(b - cc))        nxt = b - cc;       if (nxt != -1) {        bGo = true;        u2.add(nxt);        cc = nxt;        pr = cc;       }      }      st = cc;     }    }    LinkedList<Integer> ll = new LinkedList<Integer>();    ll.add(st);    while (!ll.isEmpty()) {     int curr = ll.pollFirst();     used.add(curr);     int next1 = a - curr;     if (al.contains(next1)) {      if (!used.contains(next1)) {       ll.addLast(next1);       if (ans[mp.get(curr)] == -1 && ans[mp.get(next1)] == -1) {        ans[mp.get(next1)] = 0;        ans[mp.get(curr)] = 0;       }      }     }     int next2 = b - curr;     if (al.contains(next2)) {      if (!used.contains(next2)) {       ll.addLast(next2);       if (ans[mp.get(curr)] == -1 && ans[mp.get(next2)] == -1) {        ans[mp.get(next2)] = 1;        ans[mp.get(curr)] = 1;       }      }     }    }   }   for (int i = 0; i < n; i++) {    if (ans[i] == -1) {     if (2 * mas[i] == a) {      ans[i] = 0;      continue;     }     if (2 * mas[i] == b) {      ans[i] = 1;      continue;     }     writer.println("NO");     return;    }   }   writer.println("YES");   for (int i = 0; i < n; i++) {    writer.print(ans[i] + " ");   }  }  }
3	public class D {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {  boolean even = true;  int n = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = in.nextInt();  for (int j = 0; j < i; j++) {   if (a[j] > a[i]) {   even = !even;   }  }  }  int m = in.nextInt();  for (int i = 0; i < m; i++) {  if ((1 - in.nextInt() + in.nextInt()) / 2 % 2 == 1) {   even = !even;  }  if (even)   out.println("even");  else   out.println("odd");  }  finish(); }  public static void finish() {  out.close();  in.close();  System.exit(0); }  static class InputReader implements Iterator<String>, Closeable {     private BufferedReader r;  private String line;  private StringTokenizer st;  private String token;  public InputReader(InputStream i) {  r = new BufferedReader(new InputStreamReader(i));  }  public boolean hasNext() {  return peekToken() != null;  }  public int nextInt() {  return Integer.parseInt(nextToken());  }  public double nextDouble() {  return Double.parseDouble(nextToken());  }  public long nextLong() {  return Long.parseLong(nextToken());  }  public String next() {  return nextToken();  }   public String nextLine() {  try {   line = r.readLine();  } catch (IOException e) {   line = null;  }  token = null;  st = null;  return line;  }   public void close() {  try {   r.close();  } catch (IOException e) {  }  }  private String peekToken() {  if (token == null)   try {   while (st == null || !st.hasMoreTokens()) {    line = r.readLine();    if (line == null)    return null;    st = new StringTokenizer(line);   }   token = st.nextToken();   } catch (IOException e) {   }  return token;  }  private String nextToken() {  String ans = peekToken();  token = null;  return ans;  }   } }
5	public class Main {    static InputReader in;   public static void main(String[] args) throws IOException{       File file = new File("input.txt");   if(file.exists())in = new InputReader( new FileInputStream(file) );   else in = new InputReader( System.in );     int n=in.nextInt(), m=in.nextInt(), k=in.nextInt();   int a[]=new int[n];   for( int i=0; i<n; i++ ) a[i]=in.nextInt();   Arrays.sort( a );   int i=n-1, ans=0;   while( k<m && i>=0 ) {    k+=a[i]-1;    i--;    ans++;   }   if( m<=k ) System.out.println( ans );   else System.out.println("-1");  }       static void out(Object ...o){   System.out.println(Arrays.deepToString(o));  }    static class InputReader {     private BufferedInputStream inp; private int offset; private final int size=5120000;   private byte buff[];    InputReader( InputStream in ) throws IOException {  inp = new BufferedInputStream( in );     buff=new byte[size];     offset=0;  inp.read( buff, 0, size ); }  int nextInt() throws IOException {       int parsedInt=0;    int i=offset;    if( buff[i]==0 ) throw new IOException();        while ( i<size && ( buff[i]<'0' || buff[i]>'9' ) ) i++;       while( i<size && buff[i]>='0' && buff[i]<='9') {     parsedInt*=10;     parsedInt+=buff[i]-'0';     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  parsedInt = nextInt();    } else offset=i;    return parsedInt; }     long nextLong() throws IOException{       long parsedLong=0;    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && ( buff[i]<'0' || buff[i]>'9' ) ) i++;       while( i<size && buff[i]>='0' && buff[i]<='9') {     parsedLong*=10L;     parsedLong+=buff[i]-'0';     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  parsedLong = nextLong();    } else offset=i;    return parsedLong;   }     String next() throws IOException {       StringBuilder token=new StringBuilder();    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && ( buff[i]=='\n' || buff[i]==' ' || buff[i]=='\r' ||      buff[i]=='\t' ) ) i++;       while( i<size && buff[i]!='\n' && buff[i]!=' ' && buff[i]!='\r' &&      buff[i]!='\t' && buff[i]!=0 ) {     token.append( (char)buff[i] );     i++;    }       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  return next();    } else offset=i;    return token.toString();   }     String nextLine() throws IOException {       StringBuilder line=new StringBuilder();    int i=offset;    if( buff[i]==0 ) throw new IOException();        while( i<size && buff[i]!='\n' && buff[i]!=0 ) {     line.append( (char)buff[i] );     i++;    }    if( i<size && buff[i]=='\n' ) i++;       if ( i==size ) {      int j = 0;  for ( ; offset<buff.length; j++, offset++ )       buff[j] = buff[offset];   inp.read( buff, j, size - j );   offset = 0;  return nextLine();    } else offset=i;    line.deleteCharAt( line.length()-1 );    return line.toString();   }    } }
4	public class C {  public static void main(String[] args) throws Exception {   BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));   StringBuilder sb = new StringBuilder();   int t = Integer.parseInt(buffer.readLine());   while (t-- > 0) {    int n = Integer.parseInt(buffer.readLine());    ArrayList<Integer>list = new ArrayList<>();    for (int i = 0; i < n; i++) {     int a = Integer.parseInt(buffer.readLine());     if (a == 1)      list.add(1);     else {      for (int j = list.size()-1; j >= 0; j--) {       if (list.get(j)+1 == a)        break;       list.remove(list.size()-1);      }      list.remove(list.size()-1);      list.add(a);     }     for (int j = 0; j < list.size(); j++) {      sb.append(list.get(j));      if (j == list.size()-1)       sb.append("\n");      else       sb.append(".");     }    }   }   System.out.println(sb);  } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   int[] best = new int[1 << n];   int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    best[set] = best[set ^ (1 << i)] + single[i];    prev[set] = i + 1;    for (int j = i + 1; j < n; ++j)     if ((set & (1 << j)) != 0) {      int cur = best[set ^ (1 << i) ^ (1 << j)] + pair[i][j];      if (cur < best[set]) {       best[set] = cur;       prev[set] = (i + 1) * 100 + (j + 1);      }     }   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {    int what = prev[now];    int wa = what % 100 - 1;    int wb = what / 100 - 1;    if (wa >= 0) {     writer.print(" ");     writer.print(wa + 1);     now ^= 1 << wa;    }    if (wb >= 0) {     writer.print(" ");     writer.print(wb + 1);     now ^= 1 << wb;    }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   int[] best = new int[1 << n];   int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    best[set] = best[set ^ (1 << i)] + single[i];    prev[set] = 1 << i;    for (int j = i + 1; j < n; ++j)     if ((set & (1 << j)) != 0) {      int cur = best[set ^ (1 << i) ^ (1 << j)] + pair[i][j];      if (cur < best[set]) {       best[set] = cur;       prev[set] = (1 << i) | (1 << j);      }     }   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
0	public class dwl {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  String[] lr = sc.nextLine().split(" ");  long l = Long.valueOf(lr[0]);  long r = Long.valueOf(lr[1]);  if (r - l <= 1 || (l == 1 && (r - l) == 2)   || (l % 2 != 0 && (r - l) < 3))  System.out.println(-1);  else {  if (l == 1)   System.out.println(2 + " " + 3 + " " + 4);  else {   if (l % 2 == 0) {   String res = "";   res += l + " ";   res += (l + 1) + " ";   res += (l + 2) + " ";   res = res.trim();   System.out.println(res);   } else {   String res = "";   res += (l + 1) + " ";   res += (l + 2) + " ";   res += (l + 3) + " ";   res = res.trim();   System.out.println(res);   }  }  }  } }
0	public class Main {  FastScanner in;  PrintWriter out;  public void solve() throws IOException {   double a = in.nextInt();   double v = in.nextInt();   double l = in.nextInt();   double d = in.nextInt();   double w = in.nextInt();   if (w * w / (a * 2) > d || v < w) {    if (v * v / (a * 2) > l) {     out.println(Math.sqrt(l * 2 / a));    }    else {     double t = v / a;     double s = l - t * v / 2;     t = t + s / v;     out.println(t);    }    return;   }   double t = solveD(a, v, w, d);   if ((v + w) * (v - w) / (a * 2) > l - d) {    double dis = w * w + a * (l - d) * 2;    double t1 = (Math.sqrt(dis) - w) / a;    System.out.println(t + t1);   }   else {    double t1 = (v - w) / a;    double s = l - d - (v + w) * t1 / 2;    double t2 = s / v;    System.out.println(t + t1 + t2);   }  }  public double solveD(double a, double vMax, double wBound, double s) {   double v = Math.sqrt(a * s + wBound * wBound / 2);   if (v > vMax) {    v = vMax;   }   double t1 = v / a;   double t2 = (v - wBound) / a;   double s1 = v * t1 / 2;   double s2 = (v + wBound) * t2 / 2;   double sr = s - s1 - s2;   double tr = sr / v;   return t1 + t2 + tr;  }  public void run() {   try {    in = new FastScanner(System.in);    out = new PrintWriter(System.out);    solve();    out.close();   }   catch (IOException e) {    e.printStackTrace();   }  }  class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  public static void main(String[] arg) {   new Main().run();  } }
4	public class Main {  public static void main(String[] args){   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   solve(in, out);   out.close();  }  static String reverse(String s) {   return (new StringBuilder(s)).reverse().toString();  }  static void sieveOfEratosthenes(int n, int factors[], ArrayList<Integer> ar)  {   factors[1]=1;   int p;   for(p = 2; p*p <=n; p++)   {    if(factors[p] == 0)    {     ar.add(p);     factors[p]=p;     for(int i = p*p; i <= n; i += p)      factors[i] = p;    }   }   for(;p<=n;p++){    if(factors[p] == 0)    {     ar.add(p);    }   }  }  static void sort(int ar[]) {   int n = ar.length;   ArrayList<Integer> a = new ArrayList<>();   for (int i = 0; i < n; i++)    a.add(ar[i]);   Collections.sort(a);   for (int i = 0; i < n; i++)    ar[i] = a.get(i);  }  static void sort1(long ar[]) {   int n = ar.length;   ArrayList<Long> a = new ArrayList<>();   for (int i = 0; i < n; i++)    a.add(ar[i]);   Collections.sort(a);   for (int i = 0; i < n; i++)    ar[i] = a.get(i);  }  static long ncr(long n, long r, long mod) {   if (r == 0)    return 1;   long val = ncr(n - 1, r - 1, mod);   val = (n * val) % mod;   val = (val * modInverse(r, mod)) % mod;   return val;  }  static int findMax(int a[], int n, int vis[], int i, int d){   if(i>=n)    return 0;   if(vis[i]==1)    return findMax(a, n, vis, i+1, d);   int max = 0;   for(int j=i+1;j<n;j++){    if(Math.abs(a[i]-a[j])>d||vis[j]==1)     continue;    vis[j] = 1;    max = Math.max(max, 1 + findMax(a, n, vis, i+1, d));    vis[j] = 0;   }   return max;  }  public static void solve(InputReader sc, PrintWriter pw){   int i, j = 0;     int t = sc.nextInt();   u: while (t-- > 0) {    int n = sc.nextInt();    int a[] = new int[n];    ArrayList<Integer> ar = new ArrayList<>();    ar.add(0);    for(i=0;i<1000;i++){     ar.add(0);    }    int m = 1;    for(i=0;i<n;i++){     a[i] = sc.nextInt();     if(a[i]==1){      ar.set(m,1);      m++;     }     else{      while(m>0&&ar.get(m-1)!=a[i]-1){       m--;      }      ar.set(m-1,a[i]);     }     pw.print(ar.get(1));     for(j=2;j<m;j++){      pw.print("."+ar.get(j));     }     pw.println();    }   }  }  static long findOne(int n, int sz[], ArrayList<Integer> ar){   long paths = n-1;   long till = 0;   for(int v:ar){    paths += till*sz[v];    till += sz[v];   }   return paths;  }  static void assignAnc(ArrayList<Integer> ar[],int sz[], int pa[] ,int curr, int par){   sz[curr] = 1;   pa[curr] = par;   for(int v:ar[curr]){    if(par==v)     continue;    assignAnc(ar, sz, pa, v, curr);    sz[curr] += sz[v];   }  }  static int findLCA(int a, int b, int par[][], int depth[]){   if(depth[a]>depth[b]){    a = a^b;    b = a^b;    a = a^b;   }   int diff = depth[b] - depth[a];   for(int i=19;i>=0;i--){    if((diff&(1<<i))>0){     b = par[b][i];    }   }   if(a==b)    return a;   for(int i=19;i>=0;i--){    if(par[b][i]!=par[a][i]){     b = par[b][i];     a = par[a][i];    }   }   return par[a][0];  }  static void formArrayForBinaryLifting(int n, int par[][]){   for(int j=1;j<20;j++){    for(int i=0;i<n;i++){     if(par[i][j-1]==-1)      continue;     par[i][j] = par[par[i][j-1]][j-1];    }   }  }  static long lcm(int a, int b){   return a*b/gcd(a,b);  }  static class Pair1 {   long a;   long b;     Pair1(long a, long b) {    this.a = a;    this.b = b;   }  }  static class Pair implements Comparable<Pair> {   int a;   int b;   int c;     Pair(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }    public int compareTo(Pair p) {              return p.c - c;   }  }                     static long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a % b);  }  static long fast_pow(long base, long n, long M) {   if (n == 0)    return 1;   if (n == 1)    return base % M;   long halfn = fast_pow(base, n / 2, M);   if (n % 2 == 0)    return (halfn * halfn) % M;   else    return (((halfn * halfn) % M) * base) % M;  }  static long modInverse(long n, long M) {   return fast_pow(n, M - 2, M);  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 9992768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }  } }
1	public class Array {  void run() {   try {    BufferedReader bfd = new BufferedReader(new InputStreamReader(      System.in));    StringTokenizer tk = new StringTokenizer(bfd.readLine());    int n = Integer.parseInt(tk.nextToken());    int k = Integer.parseInt(tk.nextToken()), i;    int arr[] = new int[n];    tk = new StringTokenizer(bfd.readLine());    for(i=0;i<n;++i)     arr[i] = Integer.parseInt(tk.nextToken());    int dist=0,l=0,r=0;    HashSet<Integer> hs = new HashSet<Integer>();    for(i=0; i<n; ++i) {     if(!hs.contains(arr[i])){      hs.add(arr[i]);      dist++;     }     if(dist==k) break;     r++;    }    int freq[] = new int[100010];    if(hs.size()<k) System.out.println("-1 -1");    else {     while(l<arr.length-1 && l<r && arr[l]==arr[l+1])      ++l;     while(r>=1 && r>l && arr[r]==arr[r-1])      --r;     for(i=l;i<=r;++i)      freq[arr[i]]++;     while(freq[arr[l]]>1){      freq[arr[l]]--;      l++;     }     while(freq[arr[r]]>1){      freq[arr[r]]--;      r--;     }     System.out.println((l+1)+" " +(r+1));    }   } catch (Exception e) {   }  }  public static void main(String[] args) {   new Array().run();  } }
3	public class Main {  static int bit[];  static int array[];  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   bit = new int[1505];   array = new int[n + 1];   StringTokenizer st = new StringTokenizer(br.readLine());   for(int i = 1;i <= n;i++)    array[i] = Integer.parseInt(st.nextToken());   long ans = 0;   for(int i = n;i >= 1;i--){    ans += read(array[i]);    update(array[i]);   }   long val = (ans & 1) + 1000_000;   int m = Integer.parseInt(br.readLine());   StringBuilder sb = new StringBuilder();   for(int i = 1;i <= m;i++){    st = new StringTokenizer(br.readLine());    int l = Integer.parseInt(st.nextToken());    int r = Integer.parseInt(st.nextToken());    long temp = (r - l + 1);    temp = temp*(temp - 1) / 2;    if((temp & 1) == 1)--val;    if((val & 1) == 1)sb.append("odd");    else sb.append("even");    sb.append('\n');   }   System.out.print(sb);  }  static int update(int idx){   int sum = 0;   while(idx < 1501){    bit[idx] += 1;    idx += idx & (-idx);   }   return sum;  }  static int read(int idx){   int sum = 0;   while(idx > 0){    sum += bit[idx];    idx -= idx & (-idx);   }   return sum;  } }
1	public class CF_468B {  public static void main(String[] args) throws IOException {   new CF_468B().solve();  }   int root(int[] father, int a){   if (father[a]==a) return a;   else return father[a]=root(father, father[a]);  }  void unite(int[] father, int a, int b){   father[root(father, a)]=root(father, b);  }     private void solve() throws IOException{     InputStream in = System.in;   PrintStream out = System.out;         long mod=1_000_000_007;   Scanner sc=new Scanner(in);   int n=sc.nextInt();   long a=sc.nextLong(), b=sc.nextLong();   int[] father=new int[n];   long[] p=new long[n];   HashMap<Long, Integer> pos=new HashMap<Long, Integer>();   for (int i=0;i<n;i++){    father[i]=i;    p[i]=sc.nextLong();    pos.put(p[i],i);   }     for (int i=0;i<n;i++){    if (pos.containsKey(a-p[i])) unite(father,i,pos.get(a-p[i]) );    if (pos.containsKey(b-p[i])) unite(father,i,pos.get(b-p[i]) );   }   boolean[] canA=new boolean[n],     canB=new boolean[n];   Arrays.fill(canA,true);   Arrays.fill(canB,true);   for (int i=0;i<n;i++){    if (!pos.containsKey(a-p[i]) ||      root(father, i)!=root(father, pos.get(a-p[i])))     canA[root(father, i)]=false;    if (!pos.containsKey(b-p[i]) ||      root(father, i)!=root(father, pos.get(b-p[i])))     canB[root(father, i)]=false;    if (!canA[root(father,i)] && !canB[root(father,i)]){     out.println("NO");     return;         }   }   out.println("YES");   for (int i=0;i<n;i++)    if (canA[root(father, i)])     out.print("0 ");    else     out.print("1 ");          } }
1	public class B { static int i(String s) { return Integer.parseInt(s); } public static void main(String[] args) throws Exception {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] arr = in.readLine().split(" ");  int n = i(arr[0]);  int k = i(arr[1]);  int[] A = new int[n];  arr = in.readLine().split(" ");  for(int i=0; i<n; i++)  A[i] = i(arr[i]);   int st = 0;  int cnt = 0;  int[] cnts = new int[100*100*10+1];  for(int i=0; i<n; i++) {  cnts[A[i]]++;  if(cnts[A[i]] == 1) cnt++;  else while(cnts[A[st]] > 1) {   cnts[A[st]]--;   st++;  }  if(cnt == k) {   System.out.println((st+1)+" "+(i+1));   return;  }  }  System.out.println(-1+" "+-1); } }
1	public class A implements Runnable { public static void main(String [] args) throws IOException {  new Thread(null, new A(), "", 1 << 20).start(); }  String file = "input"; BufferedReader input; PrintWriter out;  public void run()  {  try  {    input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  input.close();  out.close();  }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } }  void solve() throws IOException {  ArrayList<Integer> p = new ArrayList<Integer>();  StringTokenizer st = tokens();  int n = nextInt(st), k = nextInt(st);  for(int i = 2; i <= n; i++)  if(prime(i)) p.add(i);   int count = 0;  for(int x = 2; x <= n; x++)  {  if(!prime(x)) continue;  for(int i = 0; i + 1 < p.size(); i++)  {   int p1 = p.get(i);   int p2 = p.get(i + 1);   int P = p1 + p2 + 1;   if(P == x)   {   count++;   break;   }   if(P > x) break;  }  }  System.out.println(count >= k ? "YES" : "NO");    }  boolean prime(int n) {  for(int i = 2; i * i <= n; i++)  if(n % i == 0) return false;  return true; }  StringTokenizer tokens() throws IOException {  return new StringTokenizer(input.readLine()); }  String next(StringTokenizer st) {  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(input.readLine()); }  int nextInt(StringTokenizer st) {  return Integer.parseInt(st.nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(input.readLine()); }  double nextDouble(StringTokenizer st) {  return Double.parseDouble(st.nextToken()); }  void print(Object... o) {  out.println(deepToString(o)); } }
0	public class RespectTheRules {  private static final double E = 1E-10;  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   double a = scanner.nextDouble();   double maxV = scanner.nextDouble();   double l = scanner.nextDouble();   double d = scanner.nextDouble();   double w = scanner.nextDouble();   double r = l - d;   w = Math.min(w, maxV);   List<WayPoint> wayPoints = new ArrayList<WayPoint>(256);   double t = 0;   wayPoints.add(new WayPoint(0));   double dW = dTo(w, 0, a);   if (leq(dW, d)) {    wayPoints.add(new WayPoint(w));    {     double v = v(w, a, (d - dW) / 2);     v = Math.min(v, maxV);     wayPoints.add(new WayPoint(v));     wayPoints.add(new WayPoint(w));     double dW_V = dTo(v, w, a);     double vDistance = d - dW - 2 * dW_V;     if (!eq(vDistance)) {      t += vDistance / maxV;     }    }    {     double dW_MaxV = dTo(maxV, w, a);     dW_MaxV = Math.min(dW_MaxV, r);     double v = v(w, a, dW_MaxV);     wayPoints.add(new WayPoint(v));     double dMaxV = r - dW_MaxV;     if (!eq(dMaxV)) {      t += dMaxV / maxV;     }    }   } else {    double dMaxV = dTo(maxV, 0, a);    dMaxV = Math.min(dMaxV, l);    double v = v(0, a, dMaxV);    wayPoints.add(new WayPoint(v));    double dv = l - dMaxV;    if (!eq(dMaxV)) {     t += dv / maxV;    }   }   for (int i = 1; i < wayPoints.size(); ++i) {    double v0 = wayPoints.get(i - 1).v;    double v = wayPoints.get(i).v;    t += Math.abs(tTo(v, v0, a));   }   System.out.println(t);  }  static double tTo(double v, double v0, double a) {   return (v - v0) / a;  }  static double dTo(double v, double v0, double a) {   return (v * v - v0 * v0) / (2 * a);  }  static double v(double v0, double a, double d) {   return Math.sqrt(2 * d * a + v0 * v0);  }  static boolean eq(double value) {   return Math.abs(value) <= E;  }  static boolean l(double v) {   return v < -E;  }  static boolean leq(double v) {   return l(v) || eq(v);  }  static boolean leq(double one, double another) {   return leq(one - another);  }  static class WayPoint {   double v;   WayPoint(double v) {    this.v = v;   }  } }
2	public class b817 { public static Scanner scn = new Scanner(System.in);  public static void main(String[] args) {    long n = scn.nextLong();  long s = scn.nextLong();  long lo = 0;  long hi = n ;  while(lo<=hi)  {  long mid=(lo+hi)/2;   if(check(mid, s))  {   hi=mid-1;  }  else  {   lo=mid+1;  }    }  if(check(lo, s))  {  System.out.println(n-lo+1);  }  else  {  System.out.println("0");    } }  public static boolean check(long n, long s) {  long sum=0;  long a=n;  while(n>0)  {   sum=sum+(n%10);  n=n/10;  }  if(a-sum>=s)  {  return true;  }  return false;  } }
5	public class A {  final String filename = new String("C").toLowerCase();  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  if (isSorted(a)) {  out.println("YES");  return;  }  int pos1 = -1;  for (int i = 0; i < n - 1; i++) {  if (a[i] > a[i + 1]) {   int j = i;   while (j >= 0 && a[j] == a[i]) {   j--;   }   pos1 = j + 1;   break;  }  }  int pos2 = -1;  for (int i = n - 2; i >= 0; i--) {  if (a[i] > a[i + 1]) {   int j = i + 1;   while (j < n && a[j] == a[i + 1]) {   j++;   }   pos2 = j - 1;   break;  }  }  int tmp = a[pos1];  a[pos1] = a[pos2];  a[pos2] = tmp;  if (isSorted(a)) {  out.println("YES");  } else {  out.println("NO");  } }  boolean isSorted(int[] a) {  for (int i = 0; i < a.length - 1; i++) {  if (a[i] > a[i + 1]) {   return false;  }  }  return true; }  void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);       solve();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  BufferedReader in; StringTokenizer st; PrintWriter out;  String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  public static void main(String[] args) {  new A().run(); } }
5	public class A implements Runnable {  String file = "input";   boolean TEST = System.getProperty("ONLINE_JUDGE") == null;   void solve() throws IOException  {   int n = nextInt();   int[] a = new int[n];   for(int i = 0; i < n; i++) a[i] = nextInt();   int[] b = a.clone();   sortInt(b);   int count = 0;   for(int i = 0; i < a.length; i++)    if(a[i] != b[i]) count++;   if(count == 0 || count == 2) out.println("YES");   else out.println("NO");  }   Random rnd = new Random();   void sortInt(int[] a)  {   sortInt(a, 0, a.length - 1);  }   void sortInt(int[] a, int from, int to)  {   if(from >= to) return;   int i = from - 1;   int p = rnd.nextInt(to - from + 1) + from;   int t = a[p]; a[p] = a[to]; a[to] = t;   for(int j = from; j < to; j++)    if(a[j] <= a[to])    {     i++;     t = a[i]; a[i] = a[j]; a[j] = t;    }   t = a[i + 1]; a[i + 1] = a[to]; a[to] = t;   sortInt(a, i + 2, to);   while(i >= 0 && a[i] == a[i + 1]) i--;   sortInt(a, from, i);    }   String next() throws IOException  {   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(input.readLine());   return st.nextToken();  }   int nextInt() throws IOException  {   return Integer.parseInt(next());  }   long nextLong() throws IOException  {   return Long.parseLong(next());  }   double nextDouble() throws IOException  {   return Double.parseDouble(next());  }   void print(Object... o)  {   System.out.println(deepToString(o));  }   void gcj(Object o)  {   String s = String.valueOf(o);   out.println("Case #" + test + ": " + s);   System.out.println("Case #" + test + ": " + s);  }   BufferedReader input;  PrintWriter out;  StringTokenizer st;  int test;   void init() throws IOException  {   if(TEST) input = new BufferedReader(new FileReader(file + ".in"));   else input = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedOutputStream(System.out));  }   public static void main(String[] args) throws IOException  {   new Thread(null, new A(), "", 1 << 22).start();  }   public void run()  {   try   {    init();    if(TEST)    {     int runs = nextInt();     for(int i = 0; i < runs; i++) solve();    }    else solve();    out.close();     }   catch(Exception e)   {    e.printStackTrace();    System.exit(1);   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastScanner in = new FastScanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastScanner in, PrintWriter out) {    int n = in.nextInt();    int[] arr = new int[n + 1];    for (int i = 1; i <= n; i++) {     arr[i] = in.nextInt();    }    int inversions = 0;    for (int i = 1; i <= n; i++) {     for (int j = i + 1; j <= n; j++) {      if (arr[i] > arr[j])       inversions++;     }    }    inversions %= 2;    int q = in.nextInt();    for (int i = 0; i < q; i++) {     int l = in.nextInt(), r = in.nextInt();     int d = r - l + 1;     d = d * (d - 1) / 2;     if ((d & 1) == 1) inversions ^= 1;     out.println((inversions & 1) == 1 ? "odd" : "even");    }   }  }  static class FastScanner {   private BufferedReader br;   private StringTokenizer st;   public FastScanner(File f) {    try {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public FastScanner(InputStream f) {    br = new BufferedReader(new InputStreamReader(f));   }   public String nextString() {    while (st == null || !st.hasMoreTokens()) {     String s = null;     try {      s = br.readLine();     } catch (IOException e) {      e.printStackTrace();     }     if (s == null)      return null;     st = new StringTokenizer(s);    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(nextString());   }  } }
4	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int tests = in.nextInt();    for (int t = 0; t < tests; t++) {     int numLines = in.nextInt();         int stackIdx = -1;     int[] stack = new int[10000];     String prev = "";     for (int x = 0; x < numLines; x++) {      int depth = 0;      int next = in.nextInt();      boolean found = false;      for (int i = stackIdx; i >= 0; i--) {       if (next == stack[i] + 1) {        depth = i;        found = true;        break;       }      }      if (found == true) {       stackIdx = depth;       stack[depth] = next;       for (int i = 0; i <= depth; i++) {        if (i != 0) {         out.print(".");        }        out.print(stack[i]);       }       out.println();      } else if (next == 1) {       stackIdx++;       stack[stackIdx] = 1;       for (int i = 0; i <= stackIdx; i++) {        if (i != 0) {         out.print(".");        }        out.print(stack[i]);       }       out.println();      } else {             stackIdx = 0;       stack[0] = next;       out.println(next);      }      }    }   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(objects[i]);    }   }   public void println() {    writer.println();   }   public void close() {    writer.close();   }   public void print(int i) {    writer.print(i);   }   public void println(int i) {    writer.println(i);   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int nextInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
6	public class Main implements Runnable { StreamTokenizer ST;  PrintWriter out;  BufferedReader br;  Scanner in; static final int inf = 1000000000+10;  int nextInt() throws IOException{   ST.nextToken();   return (int)ST.nval;  } long nextLong() throws IOException{   ST.nextToken();   return (long)ST.nval;  }  String next() throws IOException{   ST.nextToken();   return ST.sval;  }  double nextD() throws IOException{   ST.nextToken();   return ST.nval;  }  public static void main(String[] args) throws IOException {    new Thread(new Main()).start(); }  public void run() {   try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));          ST = new StreamTokenizer(br);    solve();    out.close();     br.close();   }    catch (IOException e) {    e.printStackTrace();  throw new IllegalStateException(e);  }  }  public void solve() throws IOException { int[] x = new int[32]; int[] y = new int[32]; x[0] = nextInt(); y[0] = nextInt();  int n = nextInt(); for (int i=1; i<=n; i++) {  x[i] = nextInt();  y[i] = nextInt(); } n++; int[][] a = new int[n][n]; int[][] b = new int[n-1][n-1]; for (int i=0; i<n; i++)  for (int j=0; j<n; j++)  a[i][j] = (x[i]-x[j])*(x[i]-x[j])+ (y[i]-y[j])*(y[i]-y[j]); for (int i=1; i<n; i++)  for (int j=1; j<n; j++)  if (i!=j) b[i-1][j-1] = a[0][i]+a[i][j]+a[j][0]; else b[i-1][j-1] = 2*a[0][i]; n--;  int sz = 1<<n; int[] d = new int[sz]; int[] p = new int[sz]; d[1] = 0; for (int msk=1; msk<sz; msk++) {  int j = 0;  while ((msk&(1<<j))==0) j++;  int t = inf;   for (int i=0; i<n; i++)  if ((msk&(1<<i))>0)  if (t>d[msk^((1<<i)|(1<<j))]+b[i][j]) {   t = d[msk^((1<<i)|(1<<j))]+b[i][j];   p[msk] = i*n+j;  }  d[msk] = t;   } out.println(d[sz-1]); out.print("0 "); int t = sz-1; while (t>0) {  int hz = p[t];  int i = hz/n;  int j = hz%n;  if (i!=j) out.print((i+1)+" "+(j+1)+" 0 ");else out.print((i+1)+" 0 ");  t ^= (1<<i)|(1<<j); }  }  }
1	public class Noldbach { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public boolean[] yes; public int n, k;  public void main() {  n = in.nextInt();  k = in.nextInt();   genPrime();  int i;   yes = new boolean[n+1];   int x;  for(i=0;i+1<prime.length;++i)  {  x = prime[i]+prime[i+1]+1;  if(x <= n && fac[x] == x) yes[x] = true;  }   int count = 0;  for(i=0;i<yes.length;++i) if(yes[i]) ++count;   out.println((count>=k?"YES":"NO")); }   public int N = 100000+100; public int[] fac, rest; public int[] prime;  public void genPrime() {  ArrayList<Integer> ap = new ArrayList<Integer>();  fac = new int[N];  rest = new int[N];   int x,y;  for(x=0;x<N;++x)  {  fac[x] = x;  rest[x] = 1;  }   for(x=2;x<N;++x)  if(fac[x]==x)  {  ap.add(x);  for(y=x+x;y<N;y+=x)  if(fac[y]==y)  {   fac[y] = x;   rest[y] = y/x;  }  }   prime = new int[ap.size()];  for(int i=0;i<prime.length;++i) prime[i] = ap.get(i); }    public static void main(String[] args) {  (new Noldbach()).main(); } }
4	public class C {  static FastIO f;  public static void main(String args[]) throws IOException {  f = new FastIO();  int t, n, a, i;  Node r, p, c;   t = f.ni();   while(t-->0)  {  n = f.ni();  r = p = new Node(-1, null);     for(i = 0; i < n; i++)  {   a = f.ni();   if(a != 1)   {   while(a != p.i + 1)    p = p.p;   p = p.p;   }             c = new Node(a, p);   p.c.add(c);   p = c;  }   dfs(r, "");  }  f.flush(); }  public static void dfs(Node n, String s) throws IOException {  String t;  if(n.i == -1)  t = s;  else  {  t = s + n.i + ".";  f.out(s + n.i + "\n");  }  for(Node c : n.c)  dfs(c, t); }  static class Node {  int i;  Node p;  ArrayList<Node> c;   Node(int x, Node y)  {  i = x;  p = y;  c = new ArrayList<>();  }   @Override  public int hashCode()  {  return super.hashCode();  }   @Override  public boolean equals(Object obj)  {  Node that = (Node)obj;   return super.equals(obj);  }   @Override  public String toString()  {  return "[" + "PARAMETERS" + "]";  } }  public static class FastIO {  BufferedReader br;  BufferedWriter bw, be;  StringTokenizer st;  public FastIO()  {  br = new BufferedReader(new InputStreamReader(System.in));  bw = new BufferedWriter(new OutputStreamWriter(System.out));  be = new BufferedWriter(new OutputStreamWriter(System.err));  st = new StringTokenizer("");  }  private void read() throws IOException  {  st = new StringTokenizer(br.readLine());  }  public String ns() throws IOException  {  while(!st.hasMoreTokens())   read();  return st.nextToken();  }  public int ni() throws IOException  {  return Integer.parseInt(ns());  }  public long nl() throws IOException  {  return Long.parseLong(ns());  }  public float nf() throws IOException  {  return Float.parseFloat(ns());  }  public double nd() throws IOException  {  return Double.parseDouble(ns());  }  public char nc() throws IOException  {  return ns().charAt(0);  }  public int[] nia(int n) throws IOException  {  int[] a = new int[n];  for(int i = 0; i < n; i++)   a[i] = ni();   return a;  }  public long[] nla(int n) throws IOException  {  long[] a = new long[n];  for(int i = 0; i < n; i++)   a[i] = nl();   return a;  }  public char[] nca() throws IOException  {  return ns().toCharArray();  }  public void out(String s) throws IOException  {  bw.write(s);  }  public void flush() throws IOException  {  bw.flush();  be.flush();  }  public void err(String s) throws IOException  {  be.write(s);  } } }
5	public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; PrintWriter out;  public void solution() throws IOException {  int n = nextInt();  int a[] = new int[n];  int b[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  b[i] = a[i];  }  Arrays.sort(a);  int ans = 0;  for (int i = 0; i < n; i++) {  if (a[i] != b[i]) {   ans++;  }  }  if (ans == 2 || ans == 0) {  System.out.println("YES");  } else {  System.out.println("NO");  }  }  public String nextToken() throws IOException {  if (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(bf.readLine());  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public void print(int a[]) {  for (int i = 0; i < a.length; i++) {  System.out.print(a[i] + " ");  } }  public static void main(String args[]) throws IOException {  new C().solution(); } }
1	public class CF268_TwoSets {  public static void main(String[] args) {  MyScanner in = new MyScanner();  int N = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  int[] vals = new int[N];  HashMap<Integer, Integer> val2Ind = new HashMap<Integer, Integer>();  for (int i = 0; i < N; i++) {  vals[i] = in.nextInt();  val2Ind.put(vals[i], i);  }  int[] setAssignment = new int[N];  int[] friendA = new int[N];  int[] friendB = new int[N];  Arrays.fill(setAssignment, -1);  Arrays.fill(friendA, -1);  Arrays.fill(friendB, -1);    for (int i = 0; i < N; i++) {  Integer friendAInd = val2Ind.get(a - vals[i]);  if (friendAInd != null) {   friendA[i] = friendAInd;  }   Integer friendBInd = val2Ind.get(b - vals[i]);  if (friendBInd != null) {   friendB[i] = friendBInd;  }  }    Queue<Integer> toProc = new ArrayDeque<Integer>();  for (int i = 0; i < N; i++) {  int friends = 0;  if (friendA[i] != -1) {   friends++;  }  if (friendB[i] != -1) {   friends++;  }  if (friends == 1) {   toProc.add(i);  }  }    while (!toProc.isEmpty()) {   int ind = toProc.poll();   if (setAssignment[ind] != -1) {   continue;  }   if (friendA[ind] != -1) {   int other = friendA[ind];   if (setAssignment[other] == -1) {   setAssignment[ind] = 0;   setAssignment[other] = 0;      if (friendB[other] != -1) {    int otherOther = friendB[other];    friendB[otherOther] = -1;    toProc.add(otherOther);   }   } else {   System.out.println("NO");   return;   }   }   else if (friendB[ind] != -1) {   int other = friendB[ind];   if (setAssignment[other] == -1) {   setAssignment[ind] = 1;   setAssignment[other] = 1;      if (friendA[other] != -1) {    int otherOther = friendA[other];    friendA[otherOther] = -1;    toProc.add(otherOther);   }   } else {   System.out.println("NO");   return;   }   }   else {   System.out.println("NO");   return;  }  }      for(int i = 0; i < N; i++) {    if(setAssignment[i] != -1) {   continue;  }    if(friendA[i] == -1 && friendB[i] == -1) {   System.out.println("NO");   return;  }      setAssignment[i] = 0;  setAssignment[friendA[i]] = 0;  }     System.out.println("YES");  StringBuilder sb = new StringBuilder();  for(int i = 0; i < N; i++) {  sb.append(setAssignment[i]);  sb.append(" ");  }  sb.deleteCharAt(sb.length() - 1);  System.out.println(sb); }  public static class MyScanner {  BufferedReader br;  StringTokenizer st;  public MyScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  } }
3	public class inversion__count {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int n=s.nextInt();   int[] a = new int[n+1];   for(int i=1;i<=n;i++){  a[i]=s.nextInt();  }   int m=s.nextInt();  int count=0;   for(int i=1;i<=n;i++){  for(int j=i+1;j<=n;j++){   if(a[i]>a[j]){   count++;   }  }  }   if(count%2==0){  count=0;  }else{  count=1;  }     for(int i=0;i<m;i++){  int l=s.nextInt();  int r=s.nextInt();    if(l==r){   if((count&1)==1){   System.out.println("odd");   }else{   System.out.println("even");   }   continue;  }     int d=r-l+1;   int segcount = 0;         int temp = (d*(d-1))/2;      if((temp&1)==1 && (count&1)==1){   count=0;   System.out.println("even");   }else if((temp&1)==1 && (count&1)==0){   count=1;   System.out.println("odd");   }else{   if((count&1)==1){    System.out.println("odd");   }else{   System.out.println("even");   }   }  } } }
2	public class Main {  public static void main (String[] args) throws java.lang.Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());   long n = Long.parseLong(st.nextToken()),    s = Long.parseLong(st.nextToken());   long m = s;   while (m-f(m)<s && m<=n) m++;   System.out.println(Math.max(n-m+1, 0));  }   public static int f(long n) {   int sum = 0;   for (long i=0, j=1L ; i<(int)Math.log10(n)+1 ; i++, j*=10) {    sum += (n/j)%10;   }   return sum;  }  }
4	public class Def {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);  int t = s.nextInt();  while (t-->0) {    int n = s.nextInt();  int[] arr = new int[n];  for (int i=0; i<n; i++) {   arr[i] = s.nextInt();  }    List<Integer> al = new ArrayList<>();  al.add(1);  System.out.println(1);  for(int i=1; i<n;i++) {   int len = al.size();     if (arr[i] == 1) {   for(int j=0; j<len; j++) {    System.out.print(al.get(j)+".");   }   System.out.println(1);   al.add(1);   }else if (arr[i] == arr[i-1] && arr[i]==1) {      for(int j=0; j<len; j++) {    System.out.print(al.get(j)+".");   }   System.out.println(1);   al.add(1);   }else {   for (int j=len-1; j>-1; j--) {    if (al.get(j)+1 == arr[i]) {    for(int k=0; k<j; k++) {     System.out.print(al.get(k)+".");    }    System.out.println(arr[i]);    al.set(j, al.get(j)+1);    al.subList(j+1, len).clear();    break;    }   }   }  }    }  s.close();   } }
2	public class C { FastScanner in; PrintWriter out; boolean systemIO = true;  public static class Pair implements Comparable<Pair> {  int x;  int y;  public Pair(int x, int y) {  super();  this.x = x;  this.y = y;  }  @Override  public int compareTo(Pair o) {  return x - o.x;  }   }  public static void quickSort(long[] a, int from, int to) {  if (to - from <= 1) {  return;  }  int i = from;  int j = to - 1;  long x = a[from + (new Random()).nextInt(to - from)];  while (i <= j) {  while (a[i] < x) {   i++;  }  while (a[j] > x) {   j--;  }  if (i <= j) {   long t = a[i];   a[i] = a[j];   a[j] = t;   i++;   j--;  }  }  quickSort(a, from, j + 1);  quickSort(a, j + 1, to); }  public static long check(long x) {  long sum = 0;  long k = x;  while (x > 0) {  sum += x % 10;  x /= 10;  }  return k - sum; }  public void solve() throws IOException {  long n = in.nextLong();  long s = in.nextLong();  long ans = 0;  for (long i = s; i <= Math.min(n, s + 10000L); i++) {  if (check(i) >= s) {   ans++;  }  }  ans += (n - Math.min(n, s + 10000L));  System.out.println(ans); }  public void run() throws IOException {  if (systemIO) {  in = new FastScanner(System.in);  out = new PrintWriter(System.out);  } else {  in = new FastScanner(new File("input.txt"));  out = new PrintWriter(new File("output.txt"));  }  solve();  out.close(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  FastScanner(InputStream f) {  br = new BufferedReader(new InputStreamReader(f));  }  String nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] arg) throws IOException {  new C().run(); } }
4	@SuppressWarnings("unused") public class C{  static long inf = (long)1e15;   public static void main(String[] args) throws IOException {      FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);    int tt = fs.nextInt();  outer:  while(tt-->0) {     int n = fs.nextInt();   int[] a = fs.readArray(n);     ArrayList<Integer>[] l = new ArrayList[n];   for(int i=0;i<n;i++) l[i] = new ArrayList<Integer>();     l[0].add(1);     for(int i=1;i<n;i++) {   if(a[i]==1) {    for(int j=0;j<l[i-1].size();j++) l[i].add(l[i-1].get(j));    l[i].add(1);   }   else {    int ind = -1;    for(int j=l[i-1].size()-1;j>=0;j--) {    if(l[i-1].get(j)+1==a[i]) {     ind = j; break;    }    }    for(int j=0;j<ind;j++) l[i].add(l[i-1].get(j));    l[i].add(a[i]);   }   }     for(int i=0;i<n;i++) {   out.print(l[i].get(0));   for(int j=1;j<l[i].size();j++) out.print("."+l[i].get(j));   out.println();   }            }    out.close();        }         static final Random random=new Random();   static <T> void shuffle(T[] arr) {  int n = arr.length;  for(int i=0;i<n;i++ ) {   int k = random.nextInt(n);   T temp = arr[k]; arr[k] = arr[i]; arr[i] = temp;  }  }     static void ruffleSort(int[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); int temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }   static void ruffleSort(long[] a) {  int n=a.length;  for (int i=0; i<n; i++) {   int oi=random.nextInt(n); long temp=a[oi];   a[oi]=a[i]; a[i]=temp;  }  Arrays.sort(a);  }      static void reverse(int[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   int temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }   static void reverse(long[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++){   long temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }     static <T> void reverse(T[] arr, int l, int r) {  for(int i=l;i<l+(r-l)/2;i++) {   T temp = arr[i]; arr[i] = arr[r-i+l-1]; arr[r-i+l-1] = temp;  }  }      static class FastScanner{  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer("");    public String next(){   while(!st.hasMoreElements()){   try{    st = new StringTokenizer(br.readLine());   } catch(IOException e){    e.printStackTrace();   }   }   return st.nextToken();  }     public String nextLine() throws IOException {   return br.readLine();  }     public int nextInt(){   return Integer.parseInt(next());  }    public int[] readArray(int n){   int[] a = new int[n];   for(int i=0;i<n;i++)   a[i] = nextInt();   return a;  }     public long nextLong() {   return Long.parseLong(next());  }    public double nextDouble() {   return Double.parseDouble(next());  }     public char nextChar() {   return next().toCharArray()[0];  }      }   }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int digitsum(long n) {    int ans = 0;    while (n > 0) {     ans += n % 10;     n /= 10;    }    return ans;   }   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    long s = in.nextLong();    if (s >= n) {     out.println(0);     return;    }    long ans = s;    while (ans < s + digitsum(ans)) {     ans++;    }    if (n >= ans) {     out.println(n - ans + 1);    } else {     out.println(0);    }    }  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }  } }
6	public class LookingForOrder { static final int INF = (int)1e9; static Point a[]; static Point o; static int n; static int dp[]; static PrintWriter out;  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  out = new PrintWriter(System.out);  o = new Point(sc.nextInt(), sc.nextInt());  n = sc.nextInt();  a = new Point[n];  for (int i = 0; i < n; i++)  a[i] = new Point(sc.nextInt(), sc.nextInt());   dp = new int[(1 << n) + 5];  Arrays.fill(dp, -1);  out.println(rec(0));  out.print(0 + " ");  path(0);  out.println();   out.flush();  out.close(); }  static void path(int msk) {  if (msk == (1 << n) - 1) return;   int optimal = rec(msk);  for (int i = 0; i < n; i++) {  if ((msk & (1 << i)) == 0) {   if (rec(msk | (1 << i)) + 2 * o.dist(a[i]) == optimal) {   out.print((i + 1) + " " + 0 + " ");   path(msk | (1 << i));   return;   }     for (int j = 0; j < n; j++)    if (rec(msk | (1 << i) | (1 << j)) + o.dist(a[i]) + a[i].dist(a[j]) + a[j].dist(o) == optimal) {    out.print((i + 1) + " " + (j + 1) + " " + 0 + " ");    path(msk | (1 << i) | (1 << j));    return;   }   break;  }  } }  static int rec(int msk) {  if (msk == (1 << n) - 1) return 0;  if (dp[msk] != -1) return dp[msk];   int ans = INF;  for (int i = 0; i < n; i++) {  if ((msk & (1 << i)) == 0) {   ans = Math.min(ans, rec(msk | (1 << i)) + 2 * o.dist(a[i]));   for (int j = 0; j < n; j++) {   if (i == j) continue;   if ((msk & (1 << j)) == 0)    ans = Math.min(ans, rec(msk | (1 << i) | (1 << j)) + o.dist(a[i]) + a[i].dist(a[j]) + a[j].dist(o));   }   break;  }  }   return dp[msk] = ans; }  static class Point {  int x, y;  public Point(int x, int y) {  this.x = x;  this.y = y;  }  public int dist(Point p) {  return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);  } }  static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(FileReader f) {  br = new BufferedReader(f);  }  public Scanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(in));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public String nextLine() throws IOException {  return br.readLine();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean Ready() throws IOException {  return br.ready();  }  public void waitForInput(long time) {  long ct = System.currentTimeMillis();  while(System.currentTimeMillis() - ct < time) {};  }  } }
3	public class CE35D { public static void main(String[] args) throws NumberFormatException, IOException {   BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(sc.readLine());  String[] t = sc.readLine().split(" ");  int[] list = new int[n];  for(int x=0; x<n; x++){  list[x] = Integer.parseInt(t[x]);  }   boolean even = true;   int[] indList = new int[n+1];     for(int x=0; x<n; x++){  indList[list[x]] = x;  }   for(int x=1; x<=n; x++){  int theIndex = indList[x];  int other = list[x-1];  if(theIndex != x-1){   even = !even;   list[x-1] = x;   list[theIndex] = other;     indList[x] = x-1;   indList[other] = theIndex;  }  }      int numQ = Integer.parseInt(sc.readLine());  for(int x=0; x<numQ; x++){  String[] dir = sc.readLine().split(" ");  int l = Integer.parseInt(dir[0]);  int r = Integer.parseInt(dir[1]);  int diff = r - l + 1;  if(diff%4 > 1){   even = !even;  }  if(even){   System.out.println("even");  }  else{   System.out.println("odd");  }  } } }
0	public class Task5d {   public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  double a = sc.nextDouble();  double v = sc.nextDouble();  double l = sc.nextDouble();  double d = sc.nextDouble();  double w = sc.nextDouble();  double t = 0;  if (w >= v) {  double t1 = v / a;  double s1 = a * t1 * t1 / 2;  if (s1 > l) {   t = Math.sqrt(2 * l / a);  } else {   t = t1 + (l - s1) / v;  }  } else {  double t2 = Math.sqrt(2 * d / a);  if (a * t2 <= w) {   double t1 = v / a;   double s1 = a * t1 * t1 / 2;   if (s1 > l) {   t = Math.sqrt(2 * l / a);   } else {   t = t1 + (l - s1) / v;   }  } else {   double tup = v / a;   double tdown = (v - w) / a;   double sup = a * tup * tup / 2;   double sdown = v * tdown - a * tdown * tdown / 2;   if (sup + sdown <= d) {   double tmax = (d - sup - sdown) / v;   t = tup + tmax + tdown;     } else {   double tw = w / a;   double sw = a * tw * tw / 2;   double sl = (d - sw) / 2;   double dis = w * w + 2 * a * sl;   double tu1 = (- w - Math.sqrt(dis)) / a;   if (tu1 < 0) {    tu1 = (- w + Math.sqrt(dis)) / a;   }   t = tw + 2 * tu1;   }   double sreup = w * tdown + a * tdown * tdown / 2;   if (sreup <= l - d) {   t += tdown;   t += (l - d - sreup) / v;   } else {   double dis = w * w - 2 * a * (d - l);   double tu1 = (- w - Math.sqrt(dis)) / a;   if (tu1 < 0) {    tu1 = (- w + Math.sqrt(dis)) / a;   }   t += tu1;   }  }  }  System.out.println(t); } }
5	public class A {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void solve() throws IOException {  int n = readInt();  int m = readInt();  int k = readInt();  int[] a = readArr(n);  Arrays.sort(a);  for(int i = 0; i <= n; i++){  int curR = k;  for(int j = n-1; j >= n-i; j--){   curR += a[j];  }  curR -= i;  if(curR >= m){   out.println(i);   return;  }  }  out.println(-1); }  void init() throws FileNotFoundException {  if (ONLINE_JUDGE) {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  } else {  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter("output.txt");  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  long readLong() throws IOException {  return Long.parseLong(readString()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  int[] readArr(int n) throws IOException {  int[] res = new int[n];  for (int i = 0; i < n; i++) {  res[i] = readInt();  }  return res; }  long[] readArrL(int n) throws IOException {  long[] res = new long[n];  for (int i = 0; i < n; i++) {  res[i] = readLong();  }  return res; }  public static void main(String[] args) {  new A().run(); }  public void run() {  try {  long t1 = System.currentTimeMillis();  init();  solve();  out.close();  long t2 = System.currentTimeMillis();  System.err.println("Time = " + (t2 - t1));  } catch (Exception e) {  e.printStackTrace(System.err);  System.exit(-1);  } } }
6	public class B {  static int[][] dist;  static int[] dist1;  static int [] dp;  static int [] path;  static int end,x,y;  static Point[] a;  public static int doit(int mask) {   if(mask==end) return 0;   if(dp[mask]!=-1) return dp[mask];   int min=Integer.MAX_VALUE;   int t;   int i;   for(i=0;i<dist.length;i++)    if(((1<<i)|mask)!=mask) break;    t=2*dist1[i]+doit(mask|(1<<i));    if(t<min) {     min=t;     path[mask]=(1<<i);    }       for(int j=i+1;j<dist.length;j++) {     if(((1<<j)|mask)==mask) continue;     t=dist[i][j]+doit(mask|(1<<i)|(1<<j));     if(t<min) {      min=t;      path[mask]=(1<<i)|(1<<j);     }    }     return dp[mask]=min;  }  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);   x=sc.nextInt();y=sc.nextInt();   a=new Point[sc.nextInt()];   for(int i=0;i<a.length;i++) {    a[i]=new Point(sc.nextInt(), sc.nextInt());   }   end=(1<<a.length)-1;   dp=new int[1<<a.length];   Arrays.fill(dp, -1);   dist=new int[a.length][a.length];   dist1=new int[a.length];   for(int i=0;i<a.length;i++) {    dist1[i]=(a[i].x-x)*(a[i].x-x)+(a[i].y-y)*(a[i].y-y);    for(int j=i+1;j<a.length;j++) {         dist[i][j]=dist1[i]+     (a[j].x-a[i].x)*(a[j].x-a[i].x)+(a[j].y-a[i].y)*(a[j].y-a[i].y)+     (a[j].x-x)*(a[j].x-x)+(a[j].y-y)*(a[j].y-y);        }   }   path=new int[dp.length];   System.out.println(doit(0));   int e=0;   int cur=path[e];   StringBuffer bf=new StringBuffer();   bf.append(0+" ");   int count=0;   for(int i=0;count<a.length;i++) {       for(int j=0;j<a.length;j++) {     if(((1<<j)|cur)==cur) {      bf.append((j+1)+" "); count++;     }    }    e|=cur;    cur=path[e];    bf.append(0+" ");   }   System.out.println(bf);  } }
0	public final class FollowTrafficRules {  private static double[] acce(double i, double a, double v) {   double[] r = new double[2];   r[0] = (v - i)/a;   r[1] = 1d/2d * a * pow(r[0], 2) + i * r[0];   return r;  }  private static double solve(double i, double a, double l) {   double e = sqrt(pow(i, 2) + 2d * a * l);   e = a > 0 ? e : -1d * e;   return (e - i)/a;  }  private static double time(double i, double a, double v, double l) {   double[] r = acce(i, a, v);   if (r[1] >= l) return solve(i, a, l);   return r[0] + (l - r[1])/v;  }  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   double a = sc.nextDouble();   double v = sc.nextDouble();   double l = sc.nextDouble();   double d = sc.nextDouble();   double w = sc.nextDouble();   double t = 0d;   double[] r = acce(0, a, w);   if (v <= w || r[1] >= d) t = time(0, a, v, l);   else {    t += r[0];    t += 2d * time(w, a, v, (d - r[1])/2d);    t += time(w, a, v, l - d);   }   System.out.println(t);  } }
1	public class BB { public static void main(String[] args) {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int k=sc.nextInt();  int a[]=new int[n+1];  boolean used[]=new boolean[100009];  for (int i = 1; i <=n; i++) {   a[i]=sc.nextInt();  }  int cnt=0;  int id=0;  for (int i = 1; i <=n; i++) {   if(!used[a[i]]){    cnt++;   used[a[i]]=true;   }   if(cnt==k){    id=i;    break;   }  }  boolean x[]=new boolean[100005];  int y=0;  int id1=0;  if(id==0){   System.out.println(-1+" "+-1);    return;  }  for (int i =id; i >=1; i--) {   if(!x[a[i]]){    y++;    x[a[i]]=true;   }   if(y==k){    id1=i;    break;   }  }  System.out.println(id1+" "+id); } }
2	public class c {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  scan.close();  long start = s - s % 10;  while (start <= n && !isBig(start, s)) {  start += 10;  }  if (start > n) {  System.out.println(0);  } else {  System.out.println(n - start + 1);  } }  private static boolean isBig(long a, long s) {  char[] digits = ("" + a).toCharArray();  int counter = 0;  for (int i = 0; i < digits.length; i++) {  counter += digits[i] - '0';  }  return a - counter >= s; } }
5	public class A { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; String FInput="";  void openInput(String file) {  if(file==null)is = new BufferedReader(new InputStreamReader(System.in));  else  {  try{      fstream = new FileInputStream(file);  in = new DataInputStream(fstream);  is = new BufferedReader(new InputStreamReader(in));  }catch(Exception e)  {   System.err.println(e);  }  }  }  void readNextLine() {  try {  line = is.readLine();  inputParser = new StringTokenizer(line, " ");    } catch (IOException e) {  System.err.println("Unexpected IO ERROR: " + e);  }  catch (NullPointerException e)  {  line=null;    }   }  int NextInt() {  String n = inputParser.nextToken();  int val = Integer.parseInt(n);     return val; }  long NextLong() {  String n = inputParser.nextToken();  long val = Long.parseLong(n);     return val; }  String NextString() {  String n = inputParser.nextToken();  return n; }  void closeInput() {  try {  is.close();  } catch (IOException e) {  System.err.println("Unexpected IO ERROR: " + e);  }   }   public static void main(String [] argv) {      String filePath=null;  if(argv.length>0)filePath=argv[0];  new A(filePath); }  public void readFInput() {  for(;;)  {  try  {   readNextLine();   FInput+=line+" ";  }  catch(Exception e)  {   break;  }  }  inputParser = new StringTokenizer(FInput, " "); }   public A(String inputFile) {  openInput(inputFile);  readNextLine();  int N=NextInt(), M=NextInt(), K=NextInt();  int [] v = new int[N];  readNextLine();  for(int i=0; i<N; i++)  {    v[i]=NextInt();    }  Arrays.sort(v);  M-=(K-1);  int id=N-1;  int ret=0;  while(M>1&&id>=0)  {  M++;  M-=v[id--];  ret++;  }  if(id<0&&M>1)ret=-1;  System.out.println(ret);  closeInput();   }   public static void out(Object s) {  try  {   FileWriter fstream = new FileWriter("output.txt");  BufferedWriter out = new BufferedWriter(fstream);  out.write(s.toString());  out.close();  }catch (Exception e){  System.err.println("Error: " + e.getMessage());  } }  }
5	public class A implements Runnable{  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException{  if (ONLINE_JUDGE){  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  }else{  in = new BufferedReader(new FileReader("input.txt"));  out = new PrintWriter("output.txt");  } }  String readString() throws IOException{  while(!tok.hasMoreTokens()){  try{   tok = new StringTokenizer(in.readLine());  }catch (Exception e){   return null;  }  }  return tok.nextToken(); }  int readInt() throws IOException{  return Integer.parseInt(readString()); }  long readLong() throws IOException{  return Long.parseLong(readString()); }  double readDouble() throws IOException{  return Double.parseDouble(readString()); }  public static void main(String[] args){  new Thread(null, new A(), "", 128 * (1L << 20)).start(); }  long timeBegin, timeEnd;  void time(){  timeEnd = System.currentTimeMillis();  System.err.println("Time = " + (timeEnd - timeBegin)); }  long memoryTotal, memoryFree;   void memory(){  memoryFree = Runtime.getRuntime().freeMemory();  System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10) + " KB"); }  void debug(Object... objects){  if (DEBUG){  for (Object o: objects){   System.err.println(o.toString());  }  } }  public void run(){  try{  timeBegin = System.currentTimeMillis();  memoryTotal = Runtime.getRuntime().freeMemory();  init();  solve();  out.close();  time();  memory();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }  boolean DEBUG = false;  void solve() throws IOException{  int n = readInt();   int[] a = new int[n];  Integer[] b = new Integer[n];  for (int i = 0; i < n; ++i){  a[i] = readInt();  b[i] = a[i];  }   Arrays.sort(b);  int count = 0;  for (int i = 0; i < n; ++i){  if (a[i] != b[i]){   count++;  }  }   if (count == 2 || count == 0){  out.println("YES");  }else{  out.println("NO");  } } }
1	public class b { public static void main(String[] args) throws IOException {  input.init(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = input.nextInt(), a = input.nextInt(), b = input.nextInt();  Num[] data = new Num[n];  for(int i = 0; i<n; i++) data[i] = new Num(input.nextInt(), i);  int[] res = new int[n];  Arrays.fill(res,-1);  Arrays.sort(data);  HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();  for(int i = 0; i<n; i++)   map.put(data[i].x, data[i].i);  boolean good = true;  for(int i = 0; i<n; i++)  {   if(res[data[i].i] != -1) continue;   int val = data[i].x;   if(!map.containsKey(a-val) && !map.containsKey(b-val))   {    good = false;    break;   }   if(!map.containsKey(a-val))   {    int other = map.get(b-val);    if(res[other] == 0)    {     good = false;     break;    }    res[other] = res[data[i].i] = 1;   }   else if(!map.containsKey(b-val))   {    int other = map.get(a-val);    if(res[other] == 1)    {     good = false;     break;    }    res[other] = res[data[i].i] = 0;   }   else   {    int cur = data[i].i;    int otherB = map.get(b-val), otherA = map.get(a-val);    if(b > a && res[otherB] != 0)    {     res[cur] = res[otherB] = 1;    }    else if(a>b && res[otherA] != 1)    {     res[cur] = res[otherA] = 0;    }    else if(b > a && res[otherA] != 1)    {     res[cur] = res[otherA] = 0;    }    else if(a > b && res[otherB] != 0)    {     res[cur] = res[otherB] = 1;    }    else if(b == a)    {     res[cur] = res[otherA] = 0;    }    else    {     good = false;     break;    }   }  }  if(good)  {   out.println("YES");   for(int x: res) out.print(x+" ");  }  else   out.println("NO");   out.close(); } static class Num implements Comparable<Num> {  int x, i;  public Num(int xx, int ii)  {   x = xx; i = ii;  }  @Override  public int compareTo(Num o) {     return x - o.x;  } } public static class input {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {   reader = new BufferedReader(      new InputStreamReader(input) );   tokenizer = new StringTokenizer("");  }    static String next() throws IOException {   while ( ! tokenizer.hasMoreTokens() ) {       tokenizer = new StringTokenizer(      reader.readLine() );   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt( next() );  }   static double nextDouble() throws IOException {   return Double.parseDouble( next() );  }  static long nextLong() throws IOException {   return Long.parseLong( next() );  } } }
6	public class CodeD { static class Scanner {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer("");   public String nextLine()  {  try  {   return br.readLine();  }  catch(Exception e)  {   throw(new RuntimeException());  }  }   public String next()  {  while(!st.hasMoreTokens())  {   String l = nextLine();   if(l == null)   return null;   st = new StringTokenizer(l);  }  return st.nextToken();  }   public int nextInt()  {  return Integer.parseInt(next());  }   public long nextLong()  {  return Long.parseLong(next());  }   public double nextDouble()  {  return Double.parseDouble(next());  }   public int[] nextIntArray(int n)  {  int[] res = new int[n];  for(int i = 0; i < res.length; i++)   res[i] = nextInt();  return res;  }   public long[] nextLongArray(int n)  {  long[] res = new long[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }   public double[] nextDoubleArray(int n)  {  double[] res = new double[n];  for(int i = 0; i < res.length; i++)   res[i] = nextLong();  return res;  }  public void sortIntArray(int[] array)  {  Integer[] vals = new Integer[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortLongArray(long[] array)  {  Long[] vals = new Long[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  }   public void sortDoubleArray(double[] array)  {  Double[] vals = new Double[array.length];  for(int i = 0; i < array.length; i++)   vals[i] = array[i];  Arrays.sort(vals);  for(int i = 0; i < array.length; i++)   array[i] = vals[i];  } } static final Scanner sc; static final int n; static final int[][] distancias; static final int[] distancia; static final int[] dp; static final int[] dpNext; static final int X; static final int Y;  static {  sc = new Scanner();  X = sc.nextInt();  Y = sc.nextInt();  n = sc.nextInt();  distancias = new int[n][n];  distancia = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  dpNext = new int[1 << n]; }   static int dp(int mascara) {  if(dp[mascara] != -1)  return dp[mascara];  int highest = -1;  for(int i = 0, tmp = mascara; tmp != 0; i++, tmp >>= 1)  {  if((tmp & 1) == 1)   highest = i;  }  if(highest == -1)  return 0;  int nextMsc = mascara ^ (1 << highest);  int costHighest = distancia[highest];  int best = (costHighest << 1) + dp(nextMsc);  int bestNext = nextMsc;  for(int i = 0, tmp = nextMsc, iC = 1; tmp != 0; i++, tmp >>= 1, iC <<= 1)  {  if((tmp & 1) == 1)  {   int msc = nextMsc ^ iC;   int possibleA = costHighest + distancias[highest][i] + distancia[i] + dp(msc);   if(possibleA < best)   {   best = possibleA;   bestNext = msc;   }  }  }  dpNext[mascara] = bestNext;  return dp[mascara] = best;   } public static void main(String[] args) {  int[][] objetos = new int[n][2];  for(int i = 0; i < n; i++)  {  objetos[i][0] = sc.nextInt();  objetos[i][1] = sc.nextInt();  distancia[i] = (X - objetos[i][0]) * (X - objetos[i][0]) + (Y - objetos[i][1]) * (Y - objetos[i][1]);  }  for(int i = 0; i < n; i++)  for(int j = 0; j < n; j++)   distancias[i][j] = (objetos[i][0] - objetos[j][0]) * (objetos[i][0] - objetos[j][0]) + (objetos[i][1] - objetos[j][1]) * (objetos[i][1] - objetos[j][1]);  int ans = dp((1 << n) - 1);  System.out.println(ans);  int current = (1 << n) - 1;  while(current != 0)  {  int next = dpNext[current];  int differents = next ^ current;  System.out.print("0 ");  for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   System.out.print((i + 1) + " ");  current = next;  }  System.out.println("0"); } }
1	public class B { BufferedReader in; PrintStream out; StringTokenizer tok; public B() throws NumberFormatException, IOException {  in = new BufferedReader(new InputStreamReader(System.in));   out = System.out;  run(); } void run() throws NumberFormatException, IOException {  int n = nextInt();  int k = nextInt();  int[] num = new int[n];  for(int i = 0; i < n; i++)  num[i] = nextInt();  int[] cant = new int[100001];  int cnt = 0;  int r = 0;  for(; r < n; r++)  {  if(cant[num[r]]==0)cnt++;  cant[num[r]]++;  if(cnt==k) break;  }  if(cnt<k)  {  out.println("-1 -1");  return;  }  int l = 0;  for(; l < r; l++)  {  cant[num[l]]--;  if(cant[num[l]]==0)cnt--;  if(cnt<k) break;  }  out.println((l+1)+" "+(r+1)); } public static void main(String[] args) throws NumberFormatException, IOException  {  new B(); } String nextToken() throws IOException {  if(tok ==null || !tok.hasMoreTokens()) tok = new StringTokenizer(in.readLine());  return tok.nextToken(); } int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); } long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); } double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); } }
3	public class P911D { public static void main(String[] args) {  FastScanner scan = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = scan.nextInt();  int[] arr = new int[n];  for (int i = 0; i < n; i++)  arr[i] = scan.nextInt();  int inv = 0;  for (int i = 0; i < n; i++)  {  for (int j = i+1; j < n; j++)  {   if (arr[i] > arr[j])   inv++;  }  }  inv &= 1;   int[] cumul = new int[n+1];  for (int i = 2; i < cumul.length; i++)  {  cumul[i] = cumul[i-1] + i-1;  }  int q = scan.nextInt();  for (int i = 0; i < q; i++)  {  int a = scan.nextInt()-1;  int b = scan.nextInt()-1;  inv += cumul[b-a+1];  inv &= 1;  if (inv == 0)   pw.println("even");  else   pw.println("odd");  }  pw.flush(); }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner()  {  try  {   br = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(br.readLine());  } catch (Exception e)  {   e.printStackTrace();  }  }  public String next()  {  if (st.hasMoreTokens())   return st.nextToken();  try  {   st = new StringTokenizer(br.readLine());  } catch (Exception e)  {   e.printStackTrace();  }  return st.nextToken();  }  public int nextInt()  {  return Integer.parseInt(next());  }  public long nextLong()  {  return Long.parseLong(next());  }  public String nextLine()  {  String line = "";  try  {   line = br.readLine();  } catch (Exception e)  {   e.printStackTrace();  }  return line;  } } }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastScanner in = new FastScanner(inputStream);   FastPrinter out = new FastPrinter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, FastScanner in, FastPrinter out) {    int n = in.nextInt();    int k = in.nextInt();    char[] c = in.next().toCharArray();    NavigableSet<Integer> ones = new TreeSet<>();    NavigableSet<Integer> zeros = new TreeSet<>();    for (int i = 0; i < n; i++) {     if (c[i] == '0') zeros.add(i);     else ones.add(i);    }    if (ones.isEmpty() || zeros.isEmpty() || ones.last() - ones.first() + 1 <= k || zeros.last() - zeros.first() + 1 <= k) {     out.println("tokitsukaze");     return;    }    if (check(ones, n, k) && check(zeros, n, k)) {     out.println("quailty");     return;    }    out.println("once again");   }   private boolean check(NavigableSet<Integer> ones, int n, int k) {    for (int i = 0; i + k <= n; i++) {     int left = ones.first();     int right = ones.last();     if (left >= i) {      left = ones.higher(i + k - 1);     }     if (right < i + k) {      right = ones.lower(i);     }     if (right - left + 1 > k) {      return false;     }    }    return true;   }  }  static class FastPrinter extends PrintWriter {   public FastPrinter(OutputStream out) {    super(out);   }   public FastPrinter(Writer out) {    super(out);   }  }  static class FastScanner extends BufferedReader {   public FastScanner(InputStream is) {    super(new InputStreamReader(is));   }   public int read() {    try {     int ret = super.read();       return ret;    } catch (IOException e) {     throw new InputMismatchException();    }   }   public String next() {    StringBuilder sb = new StringBuilder();    int c = read();    while (isWhiteSpace(c)) {     c = read();    }    if (c < 0) {     return null;    }    while (c >= 0 && !isWhiteSpace(c)) {     sb.appendCodePoint(c);     c = read();    }    return sb.toString();   }   static boolean isWhiteSpace(int c) {    return c >= 0 && c <= 32;   }   public int nextInt() {    int c = read();    while (isWhiteSpace(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int ret = 0;    while (c >= 0 && !isWhiteSpace(c)) {     if (c < '0' || c > '9') {      throw new NumberFormatException("digit expected " + (char) c        + " found");     }     ret = ret * 10 + c - '0';     c = read();    }    return ret * sgn;   }   public String readLine() {    try {     return super.readLine();    } catch (IOException e) {     return null;    }   }  } }
2	public class C_Edu_Round_23 {  public static long MOD = 1000000007;  static long[][][][] dp;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   long n = in.nextLong();   long s = in.nextLong();   if (s == 0) {    out.println(n);   } else {    String N = "" + n;    dp = new long[N.length()][163][2][2];    long re = 0;    for (int i = 1; i < 163 && i <= n; i++) {     long tmp = s + i;     if (tmp <= n) {      String S = "" + tmp;      while(S.length() < N.length()){       S = '0' + S;      }      for (long[][][] a : dp) {       for (long[][] b : a) {        for (long[] c : b) {         Arrays.fill(c, -1);        }       }      }      re += cal(0, i, 0, 0, N, S);     }    }    out.println(re);   }   out.close();  }  public static long cal(int index, int left, int lessThanN, int largerThanS, String n, String s) {   if (index == n.length()) {    if (left == 0) {     return 1;    }    return 0;   }   if (dp[index][left][lessThanN][largerThanS] != -1) {    return dp[index][left][lessThanN][largerThanS];   }   int x = n.charAt(index) - '0';   int y = s.charAt(index) - '0';   long re = 0;   for (int i = 0; i < 10 && i <= left; i++) {    if (i <= x || lessThanN == 1) {     if (i >= y || largerThanS == 1) {      re += cal(index + 1, left - i, i < x ? 1 : lessThanN, i > y ? 1 : largerThanS, n, s);     }    }   }   return dp[index][left][lessThanN][largerThanS] = re;  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   long[] data;   FT(int n) {    data = new long[n];   }   public void update(int index, long value) {    while (index < data.length) {     data[index] += value;     index += (index & (-index));    }   }   public long get(int index) {    long result = 0;    while (index > 0) {     result += data[index];     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, long MOD) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2, MOD);   if (b % 2 == 0) {    return val * val % MOD;   } else {    return val * (val * a % MOD) % MOD;   }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() throws FileNotFoundException {       br = new BufferedReader(new InputStreamReader(System.in));      }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
4	public class C {  public static void main(String[] args) throws Exception  {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int i,N;   int T=Integer.parseInt(br.readLine().trim());   StringBuilder sb=new StringBuilder();   while (T-->0)   {    N=Integer.parseInt(br.readLine().trim());    int[] a=new int[N];    for(i=0;i<N;i++) a[i]=Integer.parseInt(br.readLine().trim());    int end=1;    int[][] ans=new int[N][N+10];    ans[0][0]=1;    for(i=1;i<N;i++)    {     while (true)     {      if(ans[i-1][end]==a[i]-1) break;      end--;     }     for(int j=0;j<end;j++) ans[i][j]=ans[i-1][j];     ans[i][end]=a[i];     end++;    }    for(i=0;i<N;i++)    {     for(int j=0;j<N&&ans[i][j]!=0;j++)     {      sb.append(ans[i][j]);      if(ans[i][j+1]!=0) sb.append('.');     }     sb.append("\n");    }   }   System.out.println(sb);  } }
6	public class B {  final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  final PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  StringTokenizer tokenizer;  final int[][] d;  final int n;  final int[] time;  final Action[] actions;  private static final class Action {   int a;   int b;   public Action(int a) {    this.a = this.b = a;   }   public Action(int a, int b) {    this.a = a;    this.b = b;   }   @Override   public String toString() {    if (a == b)     return " " + (a+1);    return " " + (a+1) + " " + (b+1);   }  }  private static final int dist(int x1, int y1, int x2, int y2) {   return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);  }  private final boolean in(int x, int set) {   return ((1 << x) & set) != 0;  }  private final int off(int x, int set) {   return (set ^ (set & (1 << x)));  }  private final int solve(int set) {   if (time[set] > 0)    return time[set];   int min = Integer.MAX_VALUE;   if (set == 0)    min = 0;   else {    int a;    for (a = 0; a < n; a++)     if (in(a, set))      break;    int subset = off(a, set);    int aux = 2 * d[a][a] + solve(subset);    if (aux < min) {     min = aux;     actions[set] = new Action(a);    }    for (int b = a + 1; b < n; b++)     if (in(b, subset)) {      aux = d[a][a] + d[b][b] + d[a][b] + solve(off(b, subset));      if (aux < min) {       min = aux;       actions[set] = new Action(a, b);      }     }   }   time[set] = min;   return min;  }  private B() throws IOException {   int bx = nextInt();   int by = nextInt();   n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = nextInt();    y[i] = nextInt();   }   reader.close();   d = new int[n][n];   for (int i = 0; i < n; i++) {    d[i][i] = dist(bx, by, x[i], y[i]);    for (int j = i + 1; j < n; j++)     d[i][j] = dist(x[i], y[i], x[j], y[j]);   }   int set = 1 << n;   time = new int[set];   actions = new Action[set];   set--;   printer.println(solve(set));   printer.print("0");   while (set != 0) {    solve(set);    Action action = actions[set];    printer.print(action);    printer.print(" 0");    set = off(action.a, set);    set = off(action.b, set);   }   printer.println();   printer.close();  }  private final int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private final String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  }  public static void main(String[] args) throws IOException {   new B();  } }
3	public class InversionCounting { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);   int n = Integer.parseInt(sc.nextLine());  int inversions = 0;  int[] data = new int[n];   StringTokenizer st = new StringTokenizer(sc.nextLine());  for(int i = 0; i < n; i ++) {  data[i] = Integer.parseInt(st.nextToken());  }   for(int i = 0; i < n; i++) {  for(int j = i + 1; j < n; j++) {   if(data[i] > data[j])   inversions++;  }  }   boolean inversiontype = (inversions % 2 == 1);   int n2 = Integer.parseInt(sc.nextLine());  for(int i = 0; i < n2; i++) {  st = new StringTokenizer(sc.nextLine());  int a = Integer.parseInt(st.nextToken());  int b = Integer.parseInt(st.nextToken());    int parity = (b-a)*(b - a + 1)/2;  if(parity % 2 == 0) {   if(inversiontype)   pw.println("odd");   else   pw.println("even");  } else {   inversiontype = !inversiontype;   if(inversiontype)   pw.println("odd");   else   pw.println("even");  }  }  pw.close(); } }
6	public class C {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int xs = sc.nextInt();  int ys = sc.nextInt();  int n = sc.nextInt();  int[]x = new int[n], y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  int[]single = new int[n];  int[][]pair = new int[n][n];  for (int i = 0; i < n; i++) {  single[i] = 2*((x[i]-xs)*(x[i]-xs)+(y[i]-ys)*(y[i]-ys));  }  for (int i = 0; i < n; i++) {  for (int j = i+1; j < n; j++) {   pair[i][j] = (x[i]-xs)*(x[i]-xs)+(y[i]-ys)*(y[i]-ys)+(x[j]-xs)*(x[j]-xs)+(y[j]-ys)*(y[j]-ys)+(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);  }  }  int[]best = new int[1 << n], prev = new int[1 << n];  for (int mask = 1; mask < (1 << n); mask++) {  int i = 0;  while ((mask & (1 << i))==0)   i++;  best[mask] = best[mask ^ (1 << i)]+single[i];  prev[mask] = i+1;  for (int j = i+1; j < n; j++) {   if ((mask & (1 << j)) != 0) {   int temp = best[mask ^ (1 << i) ^ (1 << j)]+pair[i][j];   if (temp < best[mask]) {    best[mask] = temp;    prev[mask] = (i+1)*100+(j+1);   }   }  }  }  System.out.println(best[(1 << n) - 1]);  System.out.print("0 ");  int cur = (1 << n) - 1;  while (cur > 0) {  int a = prev[cur] % 100;  int b = prev[cur] / 100;  if (a > 0) {   System.out.print(a+" ");   cur ^= 1 << (a-1);  }  if (b > 0) {   System.out.print(b+" ");   cur ^= 1 << (b-1);  }  System.out.print(0+" ");  } } }
6	public class LookingForOrder {  static int[] dp = new int[(int) (1 << 24)]; static int[][] points; static int[] sol = new int[1<<24]; static int sx = 0, sy = 0;  public static void main(String[] args) {  sx = in.nextInt();  sy = in.nextInt();  Arrays.fill(dp, -2);  int n = in.nextInt();  points = new int[n][3];  for (int i = 0; i < n; i++) {  points[i][0] = in.nextInt();  points[i][1] = in.nextInt();  points[i][2] = (sx - points[i][0]) * (sx - points[i][0]) + (sy - points[i][1]) * (sy - points[i][1]);  }    System.out.println(solve(0));   int mask=0;  while(true){  System.out.print(0+" ");  if (mask==(1<<n)-1) break;  int x = sol[mask];  int count=0;  for(int i=0; i<n; i++){   if ((x&(1<<i))!=0) {   count++;   System.out.print((i+1)+" ");   mask|=(1<<i);   }   if (count==2) break;     }  }  System.out.println();  }  public static int solve(int mask) {   if (dp[mask]!=-2) return dp[mask];   int n = points.length;  if (mask == ((1 << n)-1)) {  return dp[mask]=0;  }  int here = -1;  for (int i = 0; i < n; i++) {  if ((mask & (1<<i)) == 0) {   here = i;   break;  }  }    int ans = 2*points[here][2]+solve(mask | (1 << here));  sol[mask] = 1<<here;  int x1 = points[here][0];  int y1 = points[here][1];  for (int i = here + 1; i < n; i++) {  if ((mask & (1 << i)) == 0) {   int x2 = points[i][0];   int y2 = points[i][1];   int p = mask|(1<<here);   p = p|(1<<i);   if (ans>points[here][2] + points[i][2] + (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)    + solve(p)){   ans=points[here][2] + points[i][2] + (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)    + solve(p);   sol[mask]=(1<<here)|(1<<i);   }  }  }  return dp[mask]=ans; }  public static class MyScanner {  BufferedReader br;  StringTokenizer st;  public MyScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  static MyScanner in = new MyScanner(); }
0	public class TaskA {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   PrintWriter writer = new PrintWriter(System.out);   String[] input = reader.readLine().split(" ");   long l = Long.parseLong(input[0]);   long r = Long.parseLong(input[1]);   if (l % 2 == 0) {    if (r >= l + 2) {     writer.println(l + " " + (l + 1) + " " + (l + 2));    } else {     writer.println(-1);    }   } else {    if (r >= l + 3) {     writer.println((l + 1) + " " + (l + 2) + " " + (l + 3));    } else {     writer.println(-1);    }   }   writer.close();  } }
2	public class ReallyBigNumbers817c {  static long sd(String s) {   long c = 0;   for (int i = 0; i < s.length(); i++) {    c += s.charAt(i);   }   return c - s.length() * 0x30;  }    public static void main(String[] args) {   Scanner in = new Scanner(System.in);   long n = in.nextLong();   long s = in.nextLong();      long i = (s/10+1)*10 ;   if (n<10||n-sd(n+"")<s) {    System.out.println(0);    return;   }   while(!(i-sd(i+"")>=s)){   i+=10;     }   System.out.println(n-i+1);    }   }
6	public class C { public static void main(String[] args){  Scanner sc = new Scanner(System.in);  hx = sc.nextInt();  hy = sc.nextInt();  N = sc.nextInt();  X = new int[N];  Y = new int[N];  for(int i = 0; i < N;i++){  X[i] = sc.nextInt();  Y[i] = sc.nextInt();  }  DP = new int[1<<N];  Arrays.fill(DP,-1);  int ans = recur(0);  ArrayList<Integer> aa = new ArrayList<Integer>();  int U = 0;  aa.add(0);  int test = 0;  while(U != (1<<N)-1){  int a = 0;  for(int i = 0; i < N;i++)   if(((1<<i)&U) == 0){   a = i;   break;   }   int ans2 = recur(U|(1<<a))+2*(pw(X[a]-hx)+pw(Y[a]-hy));  int temp = 2*(pw(X[a]-hx)+pw(Y[a]-hy));  int best = -1;  for(int i = a+1;i<N;i++){   if(((1<<i)&U) == 0){   int ans3 = pw(X[a]-X[i])+pw(Y[a]-Y[i])+pw(X[a]-hx)+pw(Y[a]-hy)+pw(X[i]-hx)+pw(Y[i]-hy)+recur(U|(1<<a)|(1<<i));   if(ans3 < ans2){    ans2 = ans3;    best = i;    temp = pw(X[a]-X[i])+pw(Y[a]-Y[i])+pw(X[a]-hx)+pw(Y[a]-hy)+pw(X[i]-hx)+pw(Y[i]-hy);   }   }  }  if(best == -1){   aa.add(a+1);   aa.add(0);   U |= (1<<a);  }else{   aa.add(a+1);   aa.add(best+1);   aa.add(0);   U |= (1<<a) | (1<<best);  }  test += temp;  }  if(test != ans)  throw new RuntimeException();  System.out.println(ans);  for(int i = 0; i < aa.size();i++)  System.out.print(aa.get(i)+(i == aa.size()-1?"":" "));  System.out.println(); } private static int recur(int U) {  if(DP[U] != -1)  return DP[U];  if(U == (1<<N)-1)  return 0;  int a = 0;  for(int i = 0; i < N;i++)  if(((1<<i)&U) == 0){   a = i;   break;  }   int ans = recur(U|(1<<a))+2*(pw(X[a]-hx)+pw(Y[a]-hy));  for(int i = a+1;i<N;i++){  if(((1<<i)&U) == 0){   ans = min(ans,pw(X[a]-X[i])+pw(Y[a]-Y[i])+pw(X[a]-hx)+pw(Y[a]-hy)+pw(X[i]-hx)+pw(Y[i]-hy)+recur(U|(1<<a)|(1<<i)));  }  }  DP[U] = ans;  return ans; } static int pw(int a){  return a*a; } static int hx,hy; static int[] X,Y; static int N; static int[] DP; }
6	public final class LookingForOrder {  private static Map<Integer, Integer> es = new HashMap<Integer, Integer>();  private static void init() { for (int i = 0; i <= 24; i++) es.put(1 << i, i); }  private static int x, y;  private static int[] xs, ys;  private static int sqr(int i) { return i * i; }  private static int dist(int i, int j) {   return sqr(x - xs[i]) + sqr(y - ys[i]) +    sqr(xs[i] - xs[j]) + sqr(ys[i] - ys[j]) +    sqr(x - xs[j]) + sqr(y - ys[j]);  }  private static int n;  private static int[] tb, prevs;  private static int recur(int j) {   if (j == 0 || es.get(j) != null || tb[j] != 0) return tb[j];   int bl = j & -j;   int b = j ^ bl;   tb[j] = recur(bl) + recur(b);   prevs[j] = bl;   for (int i = es.get(bl) + 1; i <25; i++) {    if (((1 << i) & b) == 0) continue;    int k = bl | 1 << i;    int v = dist(es.get(bl), es.get(1 << i)) + recur(j ^ k);    if (v >= tb[j]) continue;    tb[j] = v;    prevs[j] = k;   }   return tb[j];  }  public static void main(String[] args) {   init();   Scanner s = new Scanner(System.in);   x = s.nextInt(); y = s.nextInt();   n = s.nextInt();   xs = new int[n]; ys = new int[n];   tb = new int[1 << n]; prevs = new int[1 << n];   for (int i = 0; i < n; i++) {    xs[i] = s.nextInt(); ys[i] = s.nextInt();    tb[1 << i] = sqr(x - xs[i]) + sqr(y - ys[i]) << 1;   }   int all = (1 << n) - 1;   out.println(recur(all));   StringBuilder sb = new StringBuilder();   int p = prevs[all];   int c = all;   while(p != 0 && p != c) {    if ((p ^ (p & -p)) == 0) sb.append("0 " + (es.get(p & -p) + 1) + " ");    else sb.append("0 " + (es.get(p & -p) + 1) + " " + (es.get(p ^ (p & -p)) + 1) + " ");    c = c ^ p;    p = prevs[c];   }   if ((c ^ (c & -c)) == 0) sb.append("0 " + (es.get(c & -c) + 1) + " 0");   else sb.append("0 " + (es.get(c & -c) + 1) + " " + (es.get(c ^ (c & -c)) + 1) + " 0");   out.println(sb);  } }
1	public class Main implements Runnable {   final String filename="";   public void solve() throws Exception {   int n = iread(), k = iread();   boolean[] f = new boolean[10000];   int prev = -1;   cycle:for (int i=2; i<=n; i++)   {    for (int j=2; j*j<=i; j++)     if (i%j==0)      continue cycle;    if (prev!=-1)     f[i+prev+1] = true;    if (f[i])     k--;    prev = i;   }   if (k<=0)    out.write("YES\n");   else out.write("NO\n");  }   public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new BufferedWriter(new OutputStreamWriter(System.out));     solve();    out.flush();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }   public int iread() throws Exception {   return Integer.parseInt(readword());  }  public double dread() throws Exception {   return Double.parseDouble(readword());  }  public long lread() throws Exception {   return Long.parseLong(readword());  }  BufferedReader in;  BufferedWriter out;  public String readword() throws IOException {   StringBuilder b = new StringBuilder();   int c;   c = in.read();   while (c >= 0 && c <= ' ')    c = in.read();   if (c < 0)    return "";   while (c > ' ') {    b.append((char) c);    c = in.read();   }   return b.toString();  }  public static void main(String[] args) {   try{    Locale.setDefault(Locale.US);   } catch (Exception e)   {      }   new Thread(new Main()).start();    } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int m = in.nextInt();    int count = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (a[i] > a[j]) count = (count + 1) % 2;     }    }    StringBuilder res = new StringBuilder();    int l, r, temp;    while (m-- > 0) {     l = in.nextInt() - 1;     r = in.nextInt() - 1;     for (int i = 0; i < (r - l + 1) / 2; i++) {      temp = a[l + i];      a[l + i] = a[r - i];      a[r - i] = temp;     }     count = count ^ (((r - l + 1) * (r - l) / 2) % 2);     res.append(count == 1 ? "odd" : "even").append('\n');    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public int[] nextIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; ++i) {     array[i] = nextInt();    }    return array;   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     tokenizer = new StringTokenizer(readLine());    }    return tokenizer.nextToken();   }   public String readLine() {    String line;    try {     line = reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    return line;   }  } }
6	public class cf8c { static int n; static int[] bb; static int[] memo; static int[][] cost; static FastIO in = new FastIO(), out = in; public static void main(String[] args) {  vec2 cen = new vec2(in.nextInt(),in.nextInt());  n = in.nextInt();  cost = new int[n][n];  vec2[] v = new vec2[n];  for(int i=0; i<n; i++)  v[i] = new vec2(in.nextInt(),in.nextInt());  for(int i=0; i<n; i++)  for(int j=0; j<n; j++)   cost[i][j] = v[i].dist(cen) + v[i].dist(v[j]) + v[j].dist(cen);  memo = new int[1<<n];  bb = new int[1<<n];  Arrays.fill(memo,-1);  out.println(go(0));  build(0);  out.close(); } static void build(int mask) {  if(mask == (1<<n)-1) {  out.println(0);  return;  }  int first = 0;  while((mask & (1<<first)) != 0) first++;  int second = bb[mask];  out.print("0 " + (first+1) + " ");  if(second != first)  out.print((second+1)+" ");  build(mask|(1<<first)|(1<<second)); } static int go(int mask) {  if(mask == (1<<n)-1) return 0;  if(memo[mask] != -1) return memo[mask];  int first = 0;  int ans = Integer.MAX_VALUE;  while((mask & (1<<first)) != 0) first++;  for(int second = first; second < n; second++) {  if((mask & (1<<second)) != 0) continue;  int tans = cost[first][second] + go(mask|(1<<first)|(1<<second));  if(tans < ans) {   ans = tans;   bb[mask] = second;  }  }  return memo[mask] = ans; } static class vec2 {  int x, y;  vec2(int a, int b) {  x = a; y = b;  }  vec2 sub(vec2 v) {  return new vec2(x-v.x,y-v.y);  }  int dist(vec2 v) {  return sub(v).mag2();  }  int mag2() {  return x*x+y*y;  } } static class FastIO extends PrintWriter {  BufferedReader br;  StringTokenizer st;   public FastIO() {  this(System.in,System.out);  }  public FastIO(InputStream in, OutputStream out) {  super(new BufferedWriter(new OutputStreamWriter(out)));  br = new BufferedReader(new InputStreamReader(in));  scanLine();  }  public void scanLine() {  try {   st = new StringTokenizer(br.readLine().trim());  } catch(Exception e) {   throw new RuntimeException(e.getMessage());  }  }  public int numTokens() {  if(!st.hasMoreTokens()) {   scanLine();   return numTokens();  }  return st.countTokens();  }  public String next() {  if(!st.hasMoreTokens()) {   scanLine();   return next();  }  return st.nextToken();  }  public double nextDouble() {  return Double.parseDouble(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
1	public class B { static Vector<Integer> primes;  public static void main(String[] args) throws IOException {  InputReader myScanner = new InputReader();  int n = myScanner.nextInt(), k = myScanner.nextInt();  myScanner.hasNext();  int all[] = new int[n];  boolean numbers[] = new boolean[100100];  int diff[] = new int[n];  all[0] = myScanner.nextInt();  diff[0] = 1;  numbers[all[0]] = true;  int r = -1;  if (k == 1)  r = 1;  for (int i = 1; i < all.length; i++) {  all[i] = myScanner.nextInt();  diff[i] = diff[i - 1];  if (!numbers[all[i]]) {   if (r == -1 && diff[i] + 1 == k)   r = i + 1;   numbers[all[i]] = true;   diff[i]++;  }  }  if (r == -1)  System.out.println(-1 + " " + -1);  else {  numbers = new boolean[100010];  int l = 0, cnt = 1;  numbers[all[r - 1]] = true;  if (k == 1)   System.out.println(1 + " " + 1);  else {   for (int i = r - 2; i >= 0; i--) {   if (!numbers[all[i]]) {    numbers[all[i]] = true;    cnt++;   }   if (cnt == k) {    l = i + 1;    break;   }   }   System.out.println(l + " " + r);  }  } }  static class InputReader {  BufferedReader buff;  StringTokenizer tok;  String cur;  public InputReader() throws IOException {  buff = new BufferedReader(new InputStreamReader(System.in));  tok = new StringTokenizer(cur = buff.readLine());  }  public boolean hasNext() throws IOException {  if (!tok.hasMoreElements()) {   cur = buff.readLine();   if (cur == null)   return false;   tok = new StringTokenizer(cur);  }  return true;  }  public String next() throws IOException {  while (!tok.hasMoreElements())   tok = new StringTokenizer(cur = buff.readLine());   return tok.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next());  }  public long nextLong() throws NumberFormatException, IOException {  while (!tok.hasMoreElements())   tok = new StringTokenizer(cur = buff.readLine());   return Long.parseLong(next());  } } }
5	public class Main {   public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);     int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) a[i] = in.nextInt();   Arrays.sort(a);   int ans = 0, r = k, p = n-1;   while (r < m && p >= 0) {    r = r - 1 + a[p];    p--;    ans++;   }   if (r < m) out.println("-1");   else out.println(ans);     out.flush();  }  }
5	public class a { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt(), m = input.nextInt(), k = input.nextInt();  int[] data = new int[n];  for(int i = 0; i<n; i++)   data[i] = input.nextInt();  Arrays.sort(data);  m -= k;  int at = n-1;  int count = 0;  while(at>=0 && m>0)  {   count++;   m++;   m -= data[at];   at--;  }  if(m>0)   System.out.println(-1);  else   System.out.println(count); } }
1	public class B {  public static void main(String[] args) throws IOException {   InputReader in = new InputReader();   int n = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.nextInt();   if (k > n) {    System.out.println(-1 + " " + -1);    return;   }   int[] v = new int[100010];   int cnt = 0;   for (int i = 0; i < k; i++) {    if (v[a[i]] == 0) {     cnt++;    }    v[a[i]]++;   }   int i = k;   while (cnt < k && i < n) {    if (v[a[i]] == 0) {     cnt++;    }    v[a[i]]++;    i++;   }   if (cnt != k) {    System.out.println(-1 + " " + -1);   } else {    int st = 0;    while (st < n && st < i && v[a[st]] > 1) {     v[a[st]]--;     st++;    }    System.out.println((st+1) + " " + (i));   }  }  static class InputReader {   BufferedReader in;   StringTokenizer st;   public InputReader() throws IOException {    in = new BufferedReader(new InputStreamReader(System.in));    st = new StringTokenizer(in.readLine());   }   public String next() throws IOException {    while (!st.hasMoreElements())     st = new StringTokenizer(in.readLine());    return st.nextToken();   }   public int nextInt() throws NumberFormatException, IOException {    return Integer.parseInt(next());   }   public long nextLong() throws NumberFormatException, IOException {    return Long.parseLong(next());   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, OutputWriter out) {    final int SIZE = 256;    final int UNDEF = -1;    int nPixels = in.nextInt();    int groupSize = in.nextInt();    int[] a = in.nextIntArray(nPixels);    boolean[] exists = new boolean[SIZE];    int[] left = new int[SIZE];    int[] right = new int[SIZE];    int[] ret = new int[nPixels];    Arrays.fill(ret, UNDEF);    for (int i = 0; i < nPixels; i++) {     for (int p = 0; p < SIZE; p++) {      if (exists[p] && left[p] <= a[i] && a[i] <= right[p]) {       ret[i] = left[p];       left[a[i]] = left[p];       right[a[i]] = right[p];       break;      }     }     if (ret[i] == UNDEF) {      int l = Math.max(a[i] - groupSize + 1, 0);      int r = l + groupSize - 1;      for (int p = a[i] - 1; p >= 0; p--) {       if (exists[p]) {        if (p >= l) {         int d = p - l;         l = p + 1;         r += d + 1;        }        if (right[p] >= l) {         right[p] = l - 1;        }       }      }      for (int p = a[i] + 1; p < SIZE; p++) {       if (exists[p] && left[p] <= r) {        r = left[p] - 1;       }      }      left[a[i]] = l;      right[a[i]] = r;      ret[i] = l;     }     exists[a[i]] = true;    }      out.print(ret);   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void print(int[] array) {    for (int i = 0; i < array.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(array[i]);    }   }   public void close() {    writer.close();   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int nextInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; ++i) array[i] = nextInt();    return array;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
6	public class Main {  public static void main(String[] args) {   InputReader in = new StreamInputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   run(in, out);  }  public static void run(InputReader in, PrintWriter out) {   Solver solver = new Sellerman();   solver.solve(1, in, out);   Exit.exit(in, out);  } } class StreamInputReader extends InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar, numChars;  public StreamInputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  @Override  public void close() {   try {    stream.close();   } catch (IOException ignored) {   }  } } abstract class InputReader {  private boolean finished = false;  public abstract int read();  public int nextInt() {   return Integer.parseInt(nextToken());  }   public String nextToken() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public void setFinished(boolean finished) {   this.finished = finished;  }  public abstract void close(); } interface Solver {  public void solve(int testNumber, InputReader in, PrintWriter out); } class Exit {  private Exit() {  }  public static void exit(InputReader in, PrintWriter out) {   in.setFinished(true);   in.close();   out.close();  } } class Sellerman implements Solver {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int x0 = in.nextInt();   int y0 = in.nextInt();   int n = in.nextInt() + 1;   int[] x = new int[n];   int[] y = new int[n];   x[n - 1] = x0;   y[n - 1] = y0;   for (int i = 0; i < n - 1; ++i) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int [][] g = new int[n][n];   for(int i = 0; i < n; ++i)    for (int j = 0; j < n; ++j) {     g[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);    }   -- n;   int[] dm = new int[1 << n];   int[] prev = new int[1 << n];   byte [] bit = new byte[1 << n];   byte [] item0 = new byte[1 << n];   byte [] item1 = new byte[1 << n];   for (int i = 0; i < n; ++i) {    bit[1 << i] = (byte) i;   }   Arrays.fill(dm, -1);   dm[0] = 0;   int tt[][] = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j =0 ; j < n; ++j) {     tt[i][j] = Math.min(g[n][i] + g[i][j] + g[j][n],          g[n][j] + g[i][j] + g[i][n]);    }   for (int i = 0; i < (1 << n); ++i) {    if (dm[i] == -1)continue;    int t = (i ^ ((1 << n) - 1));    int left = bit[t - (t & (t - 1))];    for (int j = left; j < n; ++j) {     if ((i & (1 << j)) > 0) continue;     int nm = i | (1 << left) | (1 << j);     if (dm[nm] == -1 || dm[nm] > dm[i] + tt[left][j]) {      dm[nm] = dm[i] + tt[left][j];      prev[nm] = i;      item0[nm] = (byte)left;      item1[nm] = (byte)j;     }    }   }   out.println(dm[(1 << n) - 1]);   Vector<Vector<Integer>> path = new Vector<Vector<Integer>> () ;   int cmask = (1 << n) - 1;   while (cmask > 0) {    int p = prev[cmask];    Vector<Integer> tmp = new Vector<Integer> () ;    tmp.add(0);    tmp.add(item0[cmask] + 1);    tmp.add(item1[cmask] + 1);    cmask = prev[cmask];    path.add(tmp);   }   Collections.reverse(path);   int len = 0;   for (Vector<Integer> vec : path)    len += vec.size();   int ans[] = new int[len];   boolean[] valid = new boolean[len];   Arrays.fill(valid, true);   len = 0;   for (Vector<Integer> vec : path) {    for (int ttt : vec) {     ans[len ++] = ttt;    }   }   for (int i = 0; i < len - 1; ++i) {    if (ans[i] == ans[i + 1])     valid[i] = false;   }   for (int i = 0; i < len; ++i) {    if (valid[i]) {     out.print(ans[i] + " ");    }   }   out.print("0");  } }
1	public class A{  public static void main(String args[]){   FastScanner in = new FastScanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   boolean change = false;   if(a > b){    int t = a;    a = b;    b = t;    change = true;   }   boolean[] inb = new boolean[n];   int[] numbers = new int[n];   TreeMap<Integer, Integer> num = new TreeMap<Integer, Integer>();   for(int i = 0; i < n; i++){    num.put(in.nextInt(), i);   }   boolean hasAns = true;   while(!num.isEmpty()){    Entry<Integer, Integer> last = num.lastEntry();    int key = last.getKey();    if(num.containsKey(a - key)){     num.remove(key);     num.remove(a - key);    } else if(num.containsKey(b - key)){     inb[num.get(key)] = true;     inb[num.get(b - key)] = true;     num.remove(key);     num.remove(b - key);    } else{     hasAns = false;     break;    }   }   if(hasAns){    out.println("YES");    for(int i = 0; i < n && !change; i++){     if(inb[i]){      out.print("1");     } else{      out.print("0");     }     if(i != n - 1){      out.print(" ");     }    }    for(int i = 0; i < n && change; i++){     if(inb[i]){      out.print("0");     } else{      out.print("1");     }     if(i != n - 1){      out.print(" ");     }    }   } else{    out.println("NO");   }   out.close();  }  static class FastScanner{   private BufferedReader reader;   private StringTokenizer tokenizer;   public FastScanner(InputStream stream){    reader = new BufferedReader(new InputStreamReader(stream));    tokenizer = null;   }   public String nextLine(){    try{     return reader.readLine();    } catch(IOException e){     e.printStackTrace();     return null;    }   }   public String next(){    while(tokenizer == null || !tokenizer.hasMoreTokens()){     try{      tokenizer = new StringTokenizer(reader.readLine());     } catch(IOException e){      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt(){    return Integer.parseInt(next());   }   public long nextLong(){    return Long.parseLong(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }  } }
2	public class ER23C {  static long s;  public static void main (String[] args) throws java.lang.Exception {   InputReader in = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);   long n = in.nextLong();   s = in.nextLong();   long l = 0, h = n;   while (l < h) {    long mid = (l + h ) / 2;              if (Ok(mid))     h = mid;    else     l = mid + 1;   }   if (Ok(h))    w.println(n - h + 1);   else    w.println(n - h);   w.close();  }  static boolean Ok(long n) {   int sum = 0;   long temp = n;   while (n > 0) {    sum += (n % 10);    n = n / 10;   }     return (temp - sum >= s);  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1)     throw new UnknownError();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new UnknownError();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public int peek() {    if (numChars == -1)     return -1;    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      return -1;     }     if (numChars <= 0)      return -1;    }    return buf[curChar];   }   public void skip(int x) {    while (x-- > 0)     read();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public String nextString() {    return next();   }   public String next() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuffer res = new StringBuffer();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   public String nextLine() {    StringBuffer buf = new StringBuffer();    int c = read();    while (c != '\n' && c != -1) {     if (c != '\r')      buf.appendCodePoint(c);     c = read();    }    return buf.toString();   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public int[] nextIntArray(int n) {    int[] a = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }   public long[] nextLongArray(int n) {    long[] a = new long[n];    for (int i = 0; i < n; i++)     a[i] = nextLong();    return a;   }   public boolean hasNext() {    int value;    while (isSpaceChar(value = peek()) && value != -1)     read();    return value != -1;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
5	public class A {  public void run() throws IOException {   final int n = IOFast.nextInt();   int[] xs = new int[n];   for(int i = 0; i < n; i++) {    xs[i] = IOFast.nextInt();   }   int[] ys = xs.clone();   Random random = new Random();   for(int i = 0; i < n; i++) {    final int j = random.nextInt(i + 1);    final int t = ys[j]; ys[j] = ys[i]; ys[i] = t;   }   Arrays.sort(ys);     int diff = 0;   for(int i = 0; i < ys.length; i++) {    if(xs[i] != ys[i]) {     diff++;    }   }     IOFast.out.println(diff > 2 ? "NO" : "YES");  }   public static void main(String[] args) throws IOException {   new A().run();   IOFast.out.flush();  }  static public class IOFast {   private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   private static PrintWriter out = new PrintWriter(System.out);    private static int pos, readLen;   private static final char[] buffer = new char[1024 * 8];   private static final StringBuilder buf = new StringBuilder();   private static boolean[] isDigit = new boolean[256];   private static boolean[] isSpace = new boolean[256];   static {    for(int i = 0; i < 10; i++) {     isDigit['0' + i] = true;    }    isDigit['-'] = true;    isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;   }     static boolean endInput;     private static int read() throws IOException {    if(readLen == -1) {     return -1;    }       if(pos >= readLen) {     readLen = in.read(buffer);     pos = 0;         if(readLen <= 0) {      return -1;     }    }       return buffer[pos++];   }   private static int nextInt() throws IOException {    boolean plus = false;    int ret = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return Integer.MIN_VALUE;     }         if(isDigit[c]) {      if(c != '-') {       plus = true;       ret = c - '0';      }      break;     }    }       while(true) {     final int c = read();     if(c == -1 || !isDigit[c]) {      break;     }     ret = ret * 10 + c - '0';    }       return plus ? ret : -ret;   }     private static long nextLong() throws IOException {    boolean plus = false;    long ret = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return Integer.MIN_VALUE;     }         if(isDigit[c]) {      if(c != '-') {       plus = true;       ret = c - '0';      }      break;     }    }       while(true) {     final int c = read();     if(c == -1 || !isDigit[c]) {      break;     }     ret = ret * 10 + c - '0';    }       return plus ? ret : -ret;   }   private static char nextChar() throws IOException {    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return '\0';     }         if(!isSpace[c]) {      return (char)c;     }    }   }   private static int next(char[] cs) throws IOException {    int n = 0;    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return n;     }         if(!isSpace[c]) {      cs[n++] = (char)c;      break;     }    }       while(true) {     final int c = read();         if(c == -1 || isSpace[c]) {      break;     }     cs[n++] = (char)c;    }       return n;   }   private static String next() throws IOException {    buf.setLength(0);    while(true) {     final int c = read();         if(c == -1) {      endInput = true;      return "-1";     }         if(!isSpace[c]) {      buf.append((char)c);      break;     }    }       while(true) {     final int c = read();         if(c == -1 || isSpace[c]) {      break;     }     buf.append((char)c);    }    return buf.toString();   }   private static double nextDouble() throws IOException {    return Double.parseDouble(next());   }  } }
1	public class BT {  static BufferedReader in = new BufferedReader(new InputStreamReader(    System.in));  static StringTokenizer str;  static String SK;  static String next() throws IOException {   while ((str == null) || (!str.hasMoreTokens())) {    SK = in.readLine();    if (SK == null)     return null;    str = new StringTokenizer(SK);   }   return str.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static void main(String[] args) throws IOException {   int n, k;   n = nextInt();   k = nextInt();   HashSet<Integer> hs = new HashSet<Integer>();   HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();   int[] ar = new int[n];   int ii = 0, jj = -1;   for (int i = 0; i < n; i++) {    ar[i] = nextInt();    Integer iii = hm.get(ar[i]);    if(iii!=null)    hm.put(ar[i], ++iii); else hm.put(ar[i], 1);    hs.add(ar[i]);    if (hs.size() == k) {     jj = i;     break;    }   }   if (jj == -1) {    System.out.println(-1 + " " + (-1));    System.exit(0);   }   for (int i = 0; i < ar.length; i++) {    Integer iii = hm.get(ar[i]);    if (iii != null && iii - 1 > 0) {     hm.put(ar[i], --iii);     ii++;    } else {     break;    }   }   System.out.println((ii+1) + " " + (jj+1));  } }
6	public class Main {  static int hx, hy; static int[] X, Y; static int N; static int[] DP;  static int pw(int a) {  return a * a; }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  hx = sc.nextInt();  hy = sc.nextInt();  N = sc.nextInt();  X = new int[N];  Y = new int[N];  for (int i = 0; i < N; ++i) {  X[i] = sc.nextInt();  Y[i] = sc.nextInt();  }  DP = new int[1 << N];  Arrays.fill(DP, -1);  int ans = recur(0);  ArrayList<Integer> aa = new ArrayList<Integer>();  int U = 0;  aa.add(0);  int test = 0;  while (U != (1 << N) - 1) {  int a = 0;  for (int i = 0; i < N; ++i) {   if (((1 << i) & U) == 0) {   a = i;   break;   }  }  int ans2 = recur(U | (1 << a)) + 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  int temp = 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  int best = -1;  for (int i = a + 1; i < N; ++i) {   if (((1 << i) & U) == 0) {   int ans3 = recur(U|(1<<a)|(1<<i)) + pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy);   if (ans3 < ans2) {    ans2 = ans3;    ans2 = ans3;    best = i;    temp = pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy);   }   }  }  if (best == -1) {   aa.add(a + 1);   aa.add(0);   U |= (1 << a);  } else {   aa.add(a + 1);   aa.add(best + 1);   aa.add(0);   U |= (1 << a) | (1 << best);  }  }  System.out.println(ans);  for (int i = 0; i < aa.size(); ++i) {  System.out.print(aa.get(i) + " ");  } }  private static int recur(int U) {  if (DP[U] != -1) {  return DP[U];  }  if (U == (1 << N) - 1) {  return 0;  }  int a = 0;  for (int i = 0; i < N; ++i) {  if (((1 << i) & U) == 0) {   a = i;   break;  }  }  int ans = recur(U | (1 << a)) + 2 * (pw(X[a] - hx) + pw(Y[a] - hy));  for (int i = a + 1; i < N; ++i) {  if (((1 << i) & U) == 0) {   ans = min(ans, recur(U|(1<<a)|(1<<i)) + pw(X[a]-X[i])+pw(Y[a]-Y[i]) + pw(X[a]-hx)+pw(Y[a]-hy) + pw(X[i]-hx)+pw(Y[i]-hy));  }  }  DP[U] = ans;  return ans; } }
4	public class C_CF {  public static void main(String[] args) {   FastScanner57 fs = new FastScanner57();   PrintWriter pw = new PrintWriter(System.out);   int t = fs.ni();     for (int tc = 0; tc < t; tc++) {    int n = fs.ni();    int[] q = new int[n+5];    int ind = 0;    q[0] = 1;    for (int i = 0; i < n; i++) {     int a = fs.ni();     while (q[ind]!=a) ind--;     StringBuilder sb = new StringBuilder();     for (int j = 0; j < ind; j++) {      sb.append(q[j]-1);      sb.append(".");     }      sb.append(a);      q[ind]++;      q[ind+1] = 1;      ind++;      pw.println(sb);    }   }   pw.close();  }  static class BIT18 {   int[] bit;   public BIT18(int size) {    bit = new int[size];   }   public void update(int ind, int delta) {    while (ind < bit.length) {     bit[ind] += delta;     ind = ind + (ind & (-1 * ind));    }   }   public int sum(int ind) {    int s = 0;    while (ind > 0) {     s += bit[ind];     ind = ind - (ind & (-1 * ind));    }    return s;   }   public int query(int l, int r) {    return sum(r) - sum(l);   }  }     public static long recur(int ind, int p, int prev, long[] v, Long[][] dp, long[][] lr, List<List<Integer>> list) {   long last = v[0];   long ls = 0L;   long rs = 0L;   if (p == 1) {    last = v[1];   }   if (ind != 0) {    ls += (long) Math.abs(last - lr[ind][0]);   }   if (ind != 0) {    rs += (long) Math.abs(last - lr[ind][1]);   }   if (dp[ind][p] != null) {    return dp[ind][p];   }   long[] cur = lr[ind];   List<Integer> temp = list.get(ind);   for (int val : temp) {    if (prev == val) {     continue;    }    ls += recur(val, 0, ind, cur, dp, lr, list);    rs += recur(val, 1, ind, cur, dp, lr, list);   }   return dp[ind][p] = Math.max(ls, rs);  }  public static void sort(long[] a) {   List<Long> list = new ArrayList();   for (int i = 0; i < a.length; i++) {    list.add(a[i]);   }   Collections.sort(list);   for (int i = 0; i < a.length; i++) {    a[i] = list.get(i);   }  }  public static long gcd(long n1, long n2) {   if (n2 == 0) {    return n1;   }   return gcd(n2, n1 % n2);  } } class UnionFind16 {  int[] id;  public UnionFind16(int size) {   id = new int[size];   for (int i = 0; i < size; i++) {    id[i] = i;   }  }  public int find(int p) {   int root = p;   while (root != id[root]) {    root = id[root];   }   while (p != root) {    int next = id[p];    id[p] = root;    p = next;   }   return root;  }  public void union(int p, int q) {   int a = find(p), b = find(q);   if (a == b) {    return;   }   id[b] = a;  } } class FastScanner57 {  BufferedReader br;  StringTokenizer st;  public FastScanner57() {   br = new BufferedReader(new InputStreamReader(System.in), 32768);   st = null;  }  String next() {   while (st == null || !st.hasMoreElements()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     e.printStackTrace();    }   }   return st.nextToken();  }  int ni() {   return Integer.parseInt(next());  }  int[] intArray(int N) {   int[] ret = new int[N];   for (int i = 0; i < N; i++) {    ret[i] = ni();   }   return ret;  }  long nl() {   return Long.parseLong(next());  }  long[] longArray(int N) {   long[] ret = new long[N];   for (int i = 0; i < N; i++) {    ret[i] = nl();   }   return ret;  }  double nd() {   return Double.parseDouble(next());  }  String nextLine() {   String str = "";   try {    str = br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }
2	public class Main {  class IO {  BufferedReader reader;  PrintWriter writer;  StringTokenizer tokenizer;  IO() {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(new BufferedOutputStream(System.out));  tokenizer = new StringTokenizer("");  }  IO(String file) throws FileNotFoundException {  reader = new BufferedReader(new FileReader(file));  writer = new PrintWriter(new BufferedOutputStream(System.out));  tokenizer = new StringTokenizer("");  }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   String line = reader.readLine();   if (line == null)   return null;   tokenizer = new StringTokenizer(line);  }  return tokenizer.nextToken();  }  public Integer nextInt() throws IOException {  return Integer.parseInt(next());  }  public Long nextLong() throws IOException {  return Long.parseLong(next());  }  public Double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public void write(Object obj) {  writer.print(obj.toString());  }  public void writeSpace(Object obj) {  writer.print(obj.toString() + " ");  }  public void writeLine(Object obj) {  writer.println(obj.toString());  }  public void close() {  writer.close();  } }  IO io;  Main() {  io = new IO(); }  Main(String file) throws FileNotFoundException {  io = new IO(file); }  void solve() throws IOException {  long n = io.nextLong(), s = io.nextLong();  long min = s;  while (true) {  min++;  long sum = 0, tem = min;  while (tem > 0) {   sum += tem % 10;   tem /= 10;  }  if (min - sum >= s) break;  }  io.write(Math.max(0, n - min + 1)); }  void close() {  io.close(); }  public static void main(String args[]) throws IOException {   Main solver = new Main();  solver.solve();  solver.close(); } }
4	public class teama {  static int mod = 2_000_000_007;  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int T = Integer.parseInt(br.readLine());   for (int t = 0; t < T; t++) {    int N = Integer.parseInt(br.readLine());    Stack<Integer> stack = new Stack();    for (int i = 0; i < N; i++) {     int a = Integer.parseInt(br.readLine());     if (a != 1) {      while (stack.peek() + 1 != a) {       stack.pop();      }      stack.pop();     }     stack.push(a);     boolean dummy = false;     for (int j : stack) {      if (dummy) {       pw.print(".");      }      pw.print(j);      dummy = true;     }     pw.println();    }   }   pw.close();   br.close();  } }
1	public class B {  static Scanner in;  static void put(TreeMap<Integer, Integer> m, int key) {   if (m.containsKey(key)) {    m.put(key, m.get(key) + 1);   } else {    m.put(key, 1);   }  }  static void remove(TreeMap<Integer, Integer> m, int key) {   if (!m.containsKey(key))    return;   m.put(key, m.get(key) - 1);   if (m.get(key) == 0) {    m.remove(key);   }  }  public static void main(String[] args) {   in = new Scanner(System.in);   int n = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   int i = 0;   while (i + 1 < n && a[i + 1] == a[0]) {    i++;   }   int left = i;   TreeMap<Integer, Integer> used = new TreeMap<Integer, Integer>();   for (; i < n; i++) {    put(used, a[i]);    if (used.size() == k) {     while (used.get(a[left]) > 1) {      remove(used, a[left]);      left++;     }     System.out.println(left + 1 + " " + (i + 1));     return;    }   }   System.out.println("-1 -1");  } }
0	public class CodeForce275A {   public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer token = new StringTokenizer(in.readLine());   long l = Long.parseLong(token.nextToken());   long r = Long.parseLong(token.nextToken());        if(r-l<2) {    System.out.println(-1);    return;   }   if(l%2==1&&r-l<3) {    System.out.println(-1);    return;   }   if(l%2==0) {    System.out.println(l+" "+(l+1)+" "+(l+2));    return;   }   if(l%2==1) {    System.out.println((l+1)+" "+(l+2)+" "+(l+3));   }  } }
6	public class Main {  static Scanner cin = new Scanner(System.in);  private int xs, ys, n;  private int[] x, y;  public static void main(String[] args) throws Exception {   new Main().run();  }  class Item implements Comparable<Item> {   int w, h, idx;   Item(int w, int h, int idx) {    this.w = w;    this.h = h;    this.idx = idx;   }   @Override   public int compareTo(Item o) {    if (this.w == o.w) {     return this.h - o.h;    }    return this.w - o.w;   }  }  private void run() throws Exception {   xs = cin.nextInt();   ys = cin.nextInt();   n = cin.nextInt();   x = new int[n + 1];   y = new int[n + 1];   for (int i = 0; i < n; i++) {    x[i] = cin.nextInt();    y[i] = cin.nextInt();   }   int[] res = new int[1 << n];   Arrays.fill(res, Integer.MAX_VALUE);   int[] ds = new int[n];   for (int i = 0; i < n; i++) {    ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);   }   int[][] d = new int[n + 1][n + 1];   int[] tr = new int[1 << n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);    }   }     res[0] = 0;   for (int i = 1; i < (1 << n); i++) {    for (int j = 0; j < n; j++) {     if (((i >> j) & 1) != 0) {      if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {       res[i] = res[i - (1 << j)] + 2 * ds[j];       tr[i] = i - (1 << j);      }      for (int k = j + 1; k < n; k++) {       if (((i >> k) & 1) != 0) {        if (res[i - (1 << j) - (1 << k)] + ds[k] + ds[j] + d[k][j] < res[i]) {         res[i] = res[i - (1 << j) - (1 << k)] + ds[k] + ds[j] + d[k][j];         tr[i] = i - (1 << j) - (1 << k);        }       }      }      break;     }    }   }   System.out.println(res[(1 << n) - 1]);   int now = (1 << n) - 1;   while (now != 0) {    System.out.print("0 ");    int dif = now - tr[now];    for (int i = 0; i < n && dif != 0; i++) {     if (((dif >> i) & 1) != 0) {      System.out.print((i + 1) + " ");      dif -= (1 << i);     }    }    now=tr[now];   }   System.out.print("0");  } }
0	public class KF {    public static void main(String[] args) throws IOException { B jk = new B();  } }  class B {  PrintWriter out = new PrintWriter(System.out);  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r=in.nextLong(); B(){ if(Math.abs(r-l)>=2){ if(l%2==0){ out.print(l+" "+(l+1)+" "+(l+2)); } else{ if(Math.abs(r-l)==2){ out.print("-1"); }else{ out.print((l+1)+" "+(l+2)+" "+(l+3)); } } }else{ out.print("-1"); } out.flush(); } }
5	public class Solution {  public static void main(String args[]) throws IOException {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; ++i)    a[i] = in.nextInt();   Arrays.sort(a);     int res = 0, p = n - 1;   while (k < m && p >= 0) {    ++res;    k += a[p] - 1;    --p;   }   if (k >= m)    System.out.println(res);   else    System.out.println("-1");  } }
0	public class A483 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   BigInteger l = sc.nextBigInteger();   BigInteger r = sc.nextBigInteger();     if (r.subtract(l).compareTo(new BigInteger("2")) == -1) {    System.out.println("-1");   } else if (r.subtract(l).compareTo(new BigInteger("2")) == 0 && l.mod(new BigInteger("2")) != BigInteger.ZERO) {    System.out.println("-1");   } else if (l.mod(new BigInteger("2")) != BigInteger.ZERO) {    System.out.println(l.add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE).add(BigInteger.ONE));   } else {    System.out.println(l + " " + l.add(BigInteger.ONE) + " " + l.add(BigInteger.ONE).add(BigInteger.ONE));   }  } }
4	public class CDS2021{   public static void main(String[] args)throws IOException{  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);    int t = Integer.parseInt(f.readLine());    for(int q = 1; q <= t; q++){    int n = Integer.parseInt(f.readLine());     int[] array = new int[n];   for(int k = 0; k < n; k++){    array[k] = Integer.parseInt(f.readLine());   }      StringJoiner sj = new StringJoiner("\n");   Stack<Entry> stack = new Stack<Entry>();         sj.add("1");   stack.push(new Entry("1",1));      for(int k = 1; k < n; k++){    if(array[k] == 1){         String s = stack.peek().s + ".1";     sj.add(s);     stack.push(new Entry(s,1));    } else {     while(!stack.isEmpty() && stack.peek().last != array[k]-1){     stack.pop();     }         if(stack.isEmpty()) break;             String s = "";     int index = stack.peek().s.lastIndexOf(".");     if(index == -1) s = "" + array[k];     else s = stack.peek().s.substring(0,index+1) + array[k];     sj.add(s);     stack.pop();     stack.push(new Entry(s,array[k]));    }   }      out.println(sj.toString());  }          out.close();  }   public static class Entry{  String s;  int last;  public Entry(String a, int b){   s = a;   last = b;  }  }   }
1	public class PrB {  public static long time;  public static void main(String[] args) throws Exception {  time = System.currentTimeMillis();  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  n = Integer.parseInt(st.nextToken());  k = Integer.parseInt(st.nextToken());  a = new int[n];  st = new StringTokenizer(br.readLine());  for(int i = 0; i < n; i++)   a[i] = Integer.parseInt(st.nextToken());  int end = end();  if(end < 0) System.out.println("-1 -1");  else System.out.println((start(end) + 1) + " " + (end + 1));  br.close();  System.exit(0); }  static int n, k; static int[] a;  public static int end() throws Exception {  boolean[] reached = new boolean[100002];  int rem = k;  for(int i = 0; i < n; i++) {  if(!reached[a[i]]) {   rem--;   if(rem == 0) return i;  }  reached[a[i]] = true;  }  return -1; }  public static int start(int end) throws Exception {  boolean[] reached = new boolean[100002];  int rem = k;  for(int i = end; i >= 0; i--) {  if(!reached[a[i]]) {   rem--;   if(rem == 0) return i;  }  reached[a[i]] = true;  }  return 0; }  public static void checkTime() {  System.out.println(System.currentTimeMillis() - time);  time = System.currentTimeMillis(); } }
6	public class Main {  static int n, memo[], dS[], dd[][];  static int dp(int idx, int msk) {  if(msk == (1 << n) - 1)  return 0;  if(memo[msk] != -1)  return memo[msk];  while((msk & 1 << idx) != 0)  ++idx;  int ret = dS[idx] * 2 + dp(idx + 1, msk | 1 << idx);  for(int i = 0; i < n; ++i)  if((msk & 1 << i) == 0)   ret = Math.min(ret, dS[i] + dS[idx] + dd[i][idx] + dp(idx + 1, msk | 1 << i | 1 << idx));  return memo[msk] = ret; }  static StringBuilder sb = new StringBuilder("0 ");  static void print(int idx, int msk) {  if(msk == (1 << n) - 1)  return;  int opt = dp(idx, msk);  while((msk & 1 << idx) != 0)  ++idx;  if(dS[idx] * 2 + dp(idx + 1, msk | 1 << idx) == opt)  {  sb.append((idx + 1) + " 0 ");  print(idx + 1, msk | 1 << idx);  return;  }  for(int i = 0; i < n; ++i)  if((msk & 1 << i) == 0)   if(opt == dS[i] + dS[idx] + dd[i][idx] + dp(idx + 1, msk | 1 << i | 1 << idx))   {   sb.append((idx + 1) + " " + (i + 1) + " 0 ");   print(idx + 1, msk | 1 << i | 1 << idx);   return;   } }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  Point s = new Point(sc.nextInt(), sc.nextInt());  n = sc.nextInt();  Point[] a = new Point[n];  for(int i = 0; i < n; ++i)  a[i] = new Point(sc.nextInt(), sc.nextInt());  dS = new int[n];  dd = new int[n][n];  for(int i = 0; i < n; ++i)  {  dS[i] = dist2(s, a[i]);  for(int j = 0; j < n; ++j)   dd[i][j] = dist2(a[i], a[j]);  }  memo = new int[1 << n];  Arrays.fill(memo, -1);  out.println(dp(0, 0));  print(0, 0);  out.println(sb);  out.flush();  out.close(); }  static int dist2(Point a, Point b) { return sq(a.x - b.x) + sq(a.y - b.y); }  static int sq(int x) { return x * x; }  static class Scanner  {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {return Integer.parseInt(next());}  public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
3	public class lc1 implements Runnable{     public void run() {   InputReader s = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);   int t = 1;   while(t-- > 0) {    int n = s.nextInt();    int[] a = new int[n + 1];    for(int i = 1; i <= n; i++)   a[i] = s.nextInt();    int curr = 0;    for(int i = 1; i <= n; i++)   for(int j = i + 1; j <= n; j++)   if(a[i] > a[j])    curr++;    curr = curr % 2;    int m = s.nextInt();    while(m-- > 0) {     int l = s.nextInt();   int r = s.nextInt();     int fact = (r - l) % 4;     if(fact == 1 || fact == 2)   curr = 1 - curr;     if(curr % 2 == 0)   w.println("even");   else   w.println("odd");  }  }   w.close(); }  static class InputReader {   private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;   public InputReader(InputStream stream)  {  this.stream = stream;  }   public int read()  {  if (numChars==-1)   throw new InputMismatchException();    if (curChar >= numChars)  {   curChar = 0;   try   {   numChars = stream.read(buf);   }   catch (IOException e)   {   throw new InputMismatchException();   }     if(numChars <= 0)     return -1;  }  return buf[curChar++];  }   public String nextLine()  {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new lc1(),"lc1",1<<26).start(); } }
3	public class Main {  InputStream is;  PrintWriter out;  String INPUT = "";   long MOD = 1_000_000_007;  int inf = Integer.MAX_VALUE;  void solve()  {   int n = ni();   int[] a = new int[n];   for(int i = 0; i < n; i++){    a[i] = ni();   }   long ans = 0;   for(int i = 0; i < n; i++){    for(int j = i+1; j < n; j++){     if(a[j]<a[i]) ans++;    }   }   if(ans%2==0) ans = 0;   else ans = 1;   int m = ni();   for(int i = 0; i < m; i++){    long s = nl();    long g = nl();    long sub = g-s;    long res = sub*(sub+1)/2;    if(res%2==1) ans = 1 - ans;    if(ans==0) out.println("even");    else out.println("odd");   }  }       void run() throws Exception  {   is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());   out = new PrintWriter(System.out);     long s = System.currentTimeMillis();   solve();   out.flush();   if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");  }   public static void main(String[] args) throws Exception { new Main().run(); }   private byte[] inbuf = new byte[1024];  private int lenbuf = 0, ptrbuf = 0;   private int readByte()  {   if(lenbuf == -1)throw new InputMismatchException();   if(ptrbuf >= lenbuf){    ptrbuf = 0;    try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }    if(lenbuf <= 0)return -1;   }   return inbuf[ptrbuf++];  }   private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }  private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }   private double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }   private String ns()  {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b) && b != ' ')){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }   private char[] ns(int n)  {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m)  {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }   private int[] na(int n)  {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }   private int ni()  {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private long nl()  {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }     while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }   private static void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }  }
6	public class Main implements Runnable { public static void main(String [] args) throws IOException {  new Thread(null, new Main(), "", 1 << 20).start(); }  String file = "input"; BufferedReader input; PrintWriter out;  public void run()  {  try  {    input = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(new BufferedOutputStream(System.out));  solve();  input.close();  out.close();  }  catch(Exception e)  {  e.printStackTrace();  System.exit(1);  } } int[] x = new int[25]; int[] y = new int[25]; int[][] dist = new int[25][25]; int[] single = new int[25]; int[] c = new int[25]; int INF = 1 << 30; void solve() throws IOException {  StringTokenizer st = tokens();  x[0] = nextInt(st);  y[0] = nextInt(st);  int n = nextInt();  for(int i = 1; i <= n; i++)  {  st = tokens();  x[i] = nextInt(st);  y[i] = nextInt(st);  }  for(int i = 1; i <= n; i++)  single[i] = 2 * ((x[i] - x[0]) * (x[i] - x[0]) + (y[i] - y[0]) * (y[i] - y[0]));  for(int i = 1; i <= n; i++)  for(int j = 1; j <= n; j++)   dist[i][j] = single[i] / 2 + single[j] / 2 + (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  int[] dp = new int[1 << n];  int[] prev = new int[1 << n];  fill(dp, INF);  dp[0] = 0;  for(int i = 1; i < 1 << n; i++)  {  for(int j = 0; j < n; j++)  {   if((i >> j & 1) != 0)   {   if(dp[i] > dp[i ^ (1 << j)] + single[j + 1])   {    dp[i] = dp[i ^ (1 << j)] + single[j + 1];    prev[i] = j + 1;   }     for(int k = j + 1; k < n; k++)    if((i >> k & 1) != 0)    {    if(dp[i] > dp[i ^ (1 << j) ^ (1 << k)] + dist[j + 1][k + 1])    {     dp[i] = dp[i ^ (1 << j) ^ (1 << k)] + dist[j + 1][k + 1];     prev[i] = (j + 1) * 100 + (k + 1);    }    }   break;   }  }  }  out.println(dp[(1 << n) - 1]);  out.print("0 ");  int mask = (1 << n) - 1;  while(mask > 0)  {  int s = prev[mask];  int x = s / 100;  int y = s % 100;  if(x == 0)  {   out.print(y + " " + 0 + " ");   mask -= 1 << (y - 1);  }  else  {   out.print(x + " " + y + " " + 0 + " ");   mask -= 1 << (y - 1);   mask -= 1 << (x - 1);  }  } }  StringTokenizer tokens() throws IOException {  return new StringTokenizer(input.readLine()); }  String next(StringTokenizer st) {  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(input.readLine()); }  int nextInt(StringTokenizer st) {  return Integer.parseInt(st.nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(input.readLine()); }  double nextDouble(StringTokenizer st) {  return Double.parseDouble(st.nextToken()); }  void print(Object... o) {  out.println(deepToString(o)); } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static  @SuppressWarnings("Duplicates")  class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int m = in.nextInt();    int count = 0;    for (int i = 0; i < n; i++) {     for (int j = i + 1; j < n; j++) {      if (a[i] > a[j]) count = (count + 1) % 2;     }    }    StringBuilder res = new StringBuilder();    int l, r;    while (m-- > 0) {     l = in.nextInt() - 1;     r = in.nextInt() - 1;     count = count ^ (((r - l + 1) * (r - l) / 2) % 2);     res.append(count == 1 ? "odd" : "even").append('\n');    }    out.print(res);   }  }  static class InputReader {   private final BufferedReader reader;   private StringTokenizer tokenizer;   public InputReader(InputStream in) {    reader = new BufferedReader(new InputStreamReader(in));   }   public int[] nextIntArray(int size) {    int[] array = new int[size];    for (int i = 0; i < size; ++i) {     array[i] = nextInt();    }    return array;   }   public int nextInt() {    return Integer.parseInt(next());   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     tokenizer = new StringTokenizer(readLine());    }    return tokenizer.nextToken();   }   public String readLine() {    String line;    try {     line = reader.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    return line;   }  } }
5	public class Main implements Runnable { private static String[] args;  public static void main(String[] args) {  Main.args = args;  new Thread(null, new Main(), "MyRunThread", 1 << 26).start(); }  @Override public void run() {  long time_beg = -1;  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  if (args.length > 0 && args[0].equals("outside")) {  time_beg = System.currentTimeMillis();  try {   inputStream = new FileInputStream("IO/in.txt");   } catch (Exception e) {   System.err.println(e);   System.exit(1);  }  } else {  try {   } catch (Exception e) {   System.err.println(e);   System.exit(1);  }  }  Solver s = new Solver();  s.in = new InputReader(inputStream);  s.out = new OutputWriter(outputStream);  if (args.length > 0 && args[0].equals("outside")) {  s.debug = new DebugWriter(s.out);  }  s.solve();  s.out.close();  if (args.length > 0 && args[0].equals("outside")) {  s.debug.close();  System.err.printf("*** Total time: %.3f ***\n", (System.currentTimeMillis() - time_beg) / 1000.0);  } } } final class Solver { InputReader in; OutputWriter out; DebugWriter debug;  public void solve() {  int n = in.readInt();  int[] mas = new int[n];  int[] sorted = new int[n];   for (int i = 0; i < n; ++i)  sorted[i] = mas[i] = in.readInt();  Random rnd = new Random(System.nanoTime());  for (int i = 1; i < n; ++i) {  int j = rnd.nextInt(i);  int tmp = sorted[j];  sorted[j] = sorted[i];  sorted[i] = tmp;  }  Arrays.sort(sorted);  int id1 = -1;  for (int i = 0; i < n; ++i)  if (mas[i] != sorted[i]) {   id1 = i;   break;  }  int id2 = -1;  for (int i = n - 1; i >= 0; --i)  if (mas[i] != sorted[i]) {   id2 = i;   break;  }  if (id1 != -1 && id2 != -1 && id1 != id2) {  int tmp = mas[id1];  mas[id1] = mas[id2];  mas[id2] = tmp;  }  for (int i = 0; i < n; ++i)  if (mas[i] != sorted[i]) {   out.printLine("NO");   return;  }  out.printLine("YES"); } } class InputReader { private boolean finished = false;  private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars;  public InputReader(InputStream stream) {  this.stream = stream; }  private int read() {  if (numChars == -1)  throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars <= 0)   return -1;  }  return buf[curChar++]; }  public int peek() {  if (numChars == -1)  return -1;  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   return -1;  }  if (numChars <= 0)   return -1;  }  return buf[curChar]; }  public int readInt() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public long readLong() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  long res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public String readString() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public static boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private String readLine0() {  StringBuilder buf = new StringBuilder();  int c = read();  while (c != '\n' && c != -1) {  if (c != '\r')   buf.appendCodePoint(c);  c = read();  }  return buf.toString(); }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)  s = readLine0();  return s; }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)  return readLine();  else  return readLine0(); }  public BigInteger readBigInteger() {  try {  return new BigInteger(readString());  } catch (NumberFormatException e) {  throw new InputMismatchException();  } }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))  c = read();  return (char) c; }  public double readDouble() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {  if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  }  if (c == '.') {  c = read();  double m = 1;  while (!isSpaceChar(c)) {   if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();  }  }  return res * sgn; }  public boolean isExhausted() {  int value;  while (isSpaceChar(value = peek()) && value != -1)  read();  return value == -1; } } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); }  public OutputWriter(Writer writer) {  this.writer = new PrintWriter(writer); }  public void print(Object... objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(Object... objects) {  print(objects);  writer.println(); }  public void printFormat(String format, Object... objects) {  writer.printf(format, objects); }  public void print(char[] objects) {  writer.print(objects); }  public void printLine(char[] objects) {  writer.println(objects); }  public void printLine(char[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void print(int[] objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(int[] objects) {  print(objects);  writer.println(); }  public void printLine(int[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void print(long[] objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(long[] objects) {  print(objects);  writer.println(); }  public void printLine(long[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void print(double[] objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(double[] objects) {  print(objects);  writer.println(); }  public void printLine(double[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void print(byte[] objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(byte[] objects) {  print(objects);  writer.println(); }  public void printLine(byte[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void print(boolean[] objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(boolean[] objects) {  print(objects);  writer.println(); }  public void printLine(boolean[][] objects) {  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]); }  public void close() {  writer.close(); }  public void flush() {  writer.flush(); } } class DebugWriter { private final OutputWriter writer;  public DebugWriter(OutputWriter writer) {  this.writer = writer; }  private void printDebugMessage() {  writer.print("debug:\t"); }  public void printLine(Object... objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printFormat(String format, Object... objects) {  flush();  printDebugMessage();  writer.printFormat(format, objects);  flush(); }  public void printLine(char[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(char[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void printLine(double[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(double[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void printLine(int[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(int[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void printLine(long[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(long[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void printLine(byte[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(byte[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void printLine(boolean[] objects) {  flush();  printDebugMessage();  writer.printLine(objects);  flush(); }  public void printLine(boolean[][] objects) {  flush();  for (int i = 0; i < objects.length; ++i)  printLine(objects[i]);  flush(); }  public void flush() {  writer.flush(); }  public void close() {  writer.close(); } }
5	public class Sockets {  BufferedReader in;  PrintWriter out;  StringTokenizer st;   String nextToken() throws Exception {   while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());   return st.nextToken();  }   int nextInt() throws Exception {   return Integer.parseInt(nextToken());  }   void solve() throws Exception {   int n = nextInt();   int m = nextInt();   int k = nextInt();   List<Integer> fs = new ArrayList<Integer>();   for (int i = 0; i < n; i++)    fs.add(nextInt());   Collections.sort(fs);   Collections.reverse(fs);   int c = k;   for (int i = 0; i < fs.size(); i++) {    if (c >= m) {     out.println(i);     return;    }    c += (fs.get(i)-1);   }   if (c>=m)    out.println(fs.size());   else    out.println(-1);  }   void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   } finally {    out.close();   }  }   public static void main(String[] args) {   new Sockets().run();  } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int m, n, k;   n = in.readInt();   m = in.readInt();   k = in.readInt();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = in.readInt() - 1;   Arrays.sort(a);   int ans = -1;   if (k >= m)    ans = 0;   else for (int i = 0; i < n; i++) {    k += a[n-i-1];    if (k >= m) {     ans = i + 1;     break;    }   }   System.out.println(ans);  } } class InputReader {  private boolean finished = false;  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    }    catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int peek() {   if (numChars == -1)    return -1;   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    }    catch (IOException e) {     return -1;    }    if (numChars <= 0)     return -1;   }   return buf[curChar];  }  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public long readLong() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   long res = 0L;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {   StringBuffer buf = new StringBuffer();   int c = read();   while (c != '\n' && c != -1) {    if (c != '\r')     buf.appendCodePoint(c);    c = read();   }   return buf.toString();  }  public String readLine() {   String s = readLine0();   while (s.trim().length() == 0)    s = readLine0();   return s;  }  public String readLine(boolean ignoreEmptyLines) {   if (ignoreEmptyLines)    return readLine();   else    return readLine0();  }  public BigInteger readBigInteger() {   try {    return new BigInteger(readString());   }   catch (NumberFormatException e) {    throw new InputMismatchException();   }  }  public char readCharacter() {   int c = read();   while (isSpaceChar(c))    c = read();   return (char) c;  }  public double readDouble() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   double res = 0;   while (!isSpaceChar(c) && c != '.') {    if (c == 'e' || c == 'E')     return res * Math.pow(10, readInt());    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   }   if (c == '.') {    c = read();    double m = 1;    while (!isSpaceChar(c)) {     if (c == 'e' || c == 'E')      return res * Math.pow(10, readInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     m *= 10;     res += (c - '0') * m;     c = read();    }   }   return res * sgn;  }  public boolean isExhausted() {   int value;   while (isSpaceChar(value = peek()) && value != -1)    read();   return value == -1;  }  public String next() {   return readString();  } } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object...objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.print(objects[i]);   }  }  public void printLine(Object...objects) {   print(objects);   writer.println();  }  public void printLine(char[] array) {   writer.print(array);  }  public void printFormat(String format, Object...objects) {   writer.printf(format, objects);  }  public void close() {   writer.close();  }  public void flush() {   writer.flush();  } }
5	public class CodeforcesRound159 {    public static void main(String[] args)  { Scanner kde = new Scanner(System.in); int n =kde.nextInt();  int m =kde.nextInt();  int k =kde.nextInt();  ArrayList<Integer> count = new ArrayList<Integer>(); for (int i=0; i<n; i++ ) {  count.add(kde.nextInt()) ;  }  Collections.sort(count); Collections.reverse(count); if(m<=k) {  System.out.println("0");   return; }  m=m-k+1;      int res=0; for(int i=0; i<n; i++ )  {  if(i!=0)  {  res+=count.get(i)-1;  }  else   {  res+=count.get(i);  }    if(res>=m)  {   System.out.println(i+1);   return;  }   }         System.out.println("-1");   } }
4	public class Main {  public static void process()throws IOException  {   int n=ni();   int[]A=new int[n];   int point = -1;   for(int _i=0;_i<n;_i++){    int x =ni();    if(x==1){     point++;     A[point]=1;    }    else{     while(x!=A[point]+1){      A[point]=0;      point--;     }    }    A[point]=x;    for(int i=0;i<point;i++)     p(A[i]+".");    pn(A[point]);   }  }   static AnotherReader sc;  static PrintWriter out;  public static void main(String[]args)throws IOException  {   boolean oj = System.getProperty("ONLINE_JUDGE") != null;   if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}   else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}   int t=1;   t=ni();   while(t-- > 0) {process();}   out.flush();out.close();  }  static void pn(Object o){out.println(o);}  static void p(Object o){out.print(o);}  static void pni(Object o){out.println(o);out.flush();}  static int ni()throws IOException{return sc.nextInt();}  static long nl()throws IOException{return sc.nextLong();}  static double nd()throws IOException{return sc.nextDouble();}  static String nln()throws IOException{return sc.nextLine();}  static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}  static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}  static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}  static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}   static class AnotherReader{BufferedReader br; StringTokenizer st;  AnotherReader()throws FileNotFoundException{  br=new BufferedReader(new InputStreamReader(System.in));}  AnotherReader(int a)throws FileNotFoundException{  br = new BufferedReader(new FileReader("input.txt"));}  String next()throws IOException{  while (st == null || !st.hasMoreElements()) {try{  st = new StringTokenizer(br.readLine());}  catch (IOException e){ e.printStackTrace(); }}  return st.nextToken(); } int nextInt() throws IOException{  return Integer.parseInt(next());}  long nextLong() throws IOException  {return Long.parseLong(next());}  double nextDouble()throws IOException { return Double.parseDouble(next()); }  String nextLine() throws IOException{ String str = ""; try{  str = br.readLine();} catch (IOException e){  e.printStackTrace();} return str;}}   }
4	public class uo{ public static void main(String[] args) throws IOException{  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int testcases = Integer.parseInt(st.nextToken());  for(int lmn=0;lmn<testcases;lmn++){  st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());      ArrayList<Integer> a = new ArrayList<>();  for(int lmn1 = 0;lmn1<n;lmn1++){   st = new StringTokenizer(br.readLine());   int a1 = Integer.parseInt(st.nextToken());   if(a.size()>0 && (a1==1)){      }   else if(a.size()>0){   if(a.size()==1){    a.remove(0);   }   else{    int i = a.size()-1;    while(a.size()>0 && i>=0 && a.get(i)+1 != a1){    a.remove(i);    i--;    }    a.remove(a.size()-1);       }   }          if(a.size()==0){   a.add(a1);   }   else{   a.add(a1);   }   if(a.size()==1){   System.out.println(a.get(0));   }   else{   for(int i=0;i<a.size()-1;i++){       System.out.print(a.get(i)+".");   }   System.out.println(a.get(a.size()-1));   }     }  }   } }
1	public class b { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int n = input.nextInt(), k = input.nextInt();  int[] data = new int[n];  for(int i = 0; i<n; i++)   data[i] = input.nextInt();  int[] freq = new int[100001];  int count = 0;  for(int i = 0; i<n; i++)  {   if(freq[data[i]] == 0)    count++;   freq[data[i]]++;  }  if(count<k)   System.out.println("-1 -1");   else  {   int start = 0;   for(int i = 0; i<n; i++)   {       if(count > k)    {     freq[data[i]]--;     if(freq[data[i]] == 0)      count--;    }    else    {     if(freq[data[i]] > 1)     {      freq[data[i]]--;     }     else     {      start = i;      break;     }    }   }   int end = n-1;   for(int i = n-1; i>=0; i--)   {    if(freq[data[i]] == 1)    {     end = i;     break;    }    else     freq[data[i]]--;   }   start++;   end++;   if(start<= end)   System.out.println(start + " " + end);   else    System.out.println(-1 + " " + -1);  } } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    long s = in.nextLong();    if (n - digitSum(n) < s) {     out.println(0);     return;    }    long left = 0;    long right = n;    while (left < right) {     long mid = left + (right - left) / 2;     if (mid - digitSum(mid) >= s) {      right = mid;     } else {      left = mid + 1;     }    }    out.println(n - left + 1);   }   long digitSum(long a) {    long result = 0;    while (a > 0) {     result += a % 10;     a /= 10;    }    return result;   }  }  static class InputReader {   private static BufferedReader in;   private static StringTokenizer tok;   public InputReader(InputStream in) {    this.in = new BufferedReader(new InputStreamReader(in));   }   public long nextLong() {    return Long.parseLong(next());   }   public String next() {    try {     while (tok == null || !tok.hasMoreTokens()) {      tok = new StringTokenizer(in.readLine());          }    } catch (IOException ex) {     System.err.println("An IOException was caught :" + ex.getMessage());    }    return tok.nextToken();   }  } }
1	public class A { public static void main(String[] args) throws Exception {  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt()-1;  PrimeGen p = new PrimeGen(n);  List<Integer> prims = new ArrayList<Integer>();  for(int i = 2; i <= n; i++){  if(p.isPrime(i)>0){   prims.add(i);  }  }  int sum = 0;  for(int i = 0; i < prims.size() - 1; i++){  int c = prims.get(i) + prims.get(i+1) + 1;  if(c <= n && p.isPrime(c)>0){   sum ++;  }  }  System.out.println(sum>=k?"YES":"NO"); }  static int sum(List<Integer> is) {  int c = 0;  for (int i : is)  c += i;  return c; }  static class PrimeGen {  public PrimeGen(int m) {  m = (int) Math.sqrt(m);  double max = 0;  int r = 1;  for (int i = 0; i < 4;) {   max += r * m / Math.pow(Math.log1p(m), ++i);   r *= i;  }  p = new int[(int) max];  for (int i = 0, e = 2; i < p.length; i++) {   for (; isPrime(e) < 1; e++)   ;   p[i] = e++;  }  this.m = p[p.length - 1];  this.m = this.m * this.m;  }  int isPrime(int n) {  for (int e : p)   if (e < 1)   break;   else if (n != e && n % e < 1)   return 0;  return 1;  }  int max() {  return m;  }  int[] p;  int m; } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   int INF = 1000 * 1000 * 1000;   public void solve(int testNumber, InputReader in, OutputWriter out) {    int x0 = in.readInt();    int y0 = in.readInt();    int n = in.readInt();    int[] xs = new int[n + 1], ys = new int[n + 1];    xs[0] = x0;    ys[0] = y0;    for (int i = 1; i <= n; i++) {     xs[i] = in.readInt();     ys[i] = in.readInt();    }    int[] one = new int[n];    for (int i = 0; i < n; i++) one[i] = dist(0, i + 1, xs, ys) * 2;    int[][] two = new int[n][n];    for (int i = 0; i < n; i++) {     for (int j = 0; j < n; j++) {      two[i][j] = dist(0, i + 1, xs, ys) + dist(0, j + 1, xs, ys) + dist(i + 1, j + 1, xs, ys);     }    }    int[] dp = new int[(1 << n)];    Arrays.fill(dp, INF);    dp[0] = 0;    int[] prev = new int[(1 << n)];    for (int mask = 0; mask < (1 << n); mask++) {     for (int i = 0; i < n; i++) {      if (((mask >> i) & 1) != 0) continue;      ;      int nmask = mask | (1 << i);      int cost = one[i] + dp[mask];      if (cost < dp[nmask]) {       dp[nmask] = cost;       prev[nmask] = i;      }      for (int j = i + 1; j < n; j++) {       if (((mask >> j) & 1) != 0) continue;       int nnmask = nmask | (1 << j);       cost = two[i][j] + dp[mask];       if (cost < dp[nnmask]) {        dp[nnmask] = cost;        prev[nnmask] = n + i * n + j;       }      }      break;     }    }    int mask = (1 << n) - 1;    out.printLine(dp[mask]);    ArrayList<Integer> res = new ArrayList<>();    res.add(0);    while (mask > 0) {     if (prev[mask] < n) {      res.add(prev[mask] + 1);      mask &= ~(1 << prev[mask]);     } else {      int ii = (prev[mask] - n) / n;      int jj = (prev[mask] - n) % n;      int i = Math.max(ii, jj);      int j = Math.min(ii, jj);      res.add(i + 1);      res.add(j + 1);      mask &= ~(1 << i);      mask &= ~(1 << j);     }     res.add(0);    }    Collections.reverse(res);    for (int val : res) out.print(val + " ");    out.printLine();   }   int dist(int i, int j, int[] xs, int[] ys) {    return (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int readInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(objects[i]);    }   }   public void printLine() {    writer.println();   }   public void close() {    writer.close();   }   public void printLine(int i) {    writer.println(i);   }  } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  } } class TaskC {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int xs = in.readInt();   int ys = in.readInt();   int n = in.readInt();   int[] x = new int[n];   int[] y = new int[n];   IOUtils.readIntArrays(in, x, y);   int[] res = new int[1 << n];   int[] last = new int[1 << n];   Arrays.fill(res, Integer.MAX_VALUE);   int[] ds = new int[n];   for (int i = 0; i < n; i++) {    ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);   }   int[][] d = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++)     d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);   }   res[0] = 0;   for (int i = 1; i < (1 << n); i++) {    for (int j = 0; j < n; j++) {     if (((i >> j) & 1) != 0) {      if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {       res[i] = res[i - (1 << j)] + 2 * ds[j];       last[i] = i - (1 << j);      }      for (int k = j + 1; k < n; k++) {       if (((i >> k) & 1) != 0) {        if (res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k] < res[i]) {         res[i] = res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k];         last[i] = i - (1 << j) - (1 << k);        }       }      }      break;     }    }   }   int cur = (1 << n) - 1;   out.printLine(res[cur]);   while (cur != 0) {    out.print("0 ");    int dif = cur - last[cur];    for (int i = 0; i < n && dif != 0; i++) {     if (((dif >> i) & 1) != 0) {      out.print((i + 1) + " ");      dif -= (1 << i);     }    }    cur = last[cur];   }   out.printLine("0");  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public boolean isSpaceChar(int c) {   if (filter != null)    return filter.isSpaceChar(c);   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  }  } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object...objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.print(objects[i]);   }  }  public void printLine(Object...objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  } } class IOUtils {  public static void readIntArrays(InputReader in, int[]... arrays) {   for (int i = 0; i < arrays[0].length; i++) {    for (int j = 0; j < arrays.length; j++)     arrays[j][i] = in.readInt();   }  }  }
0	public class D {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  double f(int dist, double initSp, int a, int maxSp) {  double distToReachMaxSpeed = 0.5 * (maxSp * maxSp - initSp * initSp)   / a;  if (dist > distToReachMaxSpeed)  return 1d * (maxSp - initSp) / a + (dist - distToReachMaxSpeed)   / maxSp;  return (Math.sqrt(initSp * initSp + 2 * a * dist) - initSp) / a; }  void solve() throws IOException {  int a = nextInt();  int maxSp = nextInt();  int len = nextInt();  int signX = nextInt();  int signSp = nextInt();  if (maxSp <= signSp) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachSignSp = 0.5 * signSp * signSp / a;  if (distToReachSignSp >= signX) {  double t = Math.sqrt(2d * signX / a);  out.printf("%.9f\n", t + f(len - signX, t * a, a, maxSp));  return;  }  double distToReachMaxThenSign = 0.5   * (maxSp * maxSp + maxSp * maxSp - signSp * signSp) / a;  if (distToReachMaxThenSign <= signX) {  double t = 1d * (2 * maxSp - signSp) / a   + (signX - distToReachMaxThenSign) / maxSp   + f(len - signX, signSp, a, maxSp);  out.printf("%.9f\n", t);  return;  }   double xSp = Math.sqrt(a * signX + signSp * signSp * 0.5);  double xTime = (2 * xSp - signSp) / a;  out.printf("%.9f\n", xTime + f(len - signX, signSp, a, maxSp)); }  void inp() throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  public static void main(String[] args) throws IOException {  new D().inp(); }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return null;  }  }  return st.nextToken(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
3	public class D { public static void main(String[] args) throws Exception {  new D().run(); } int[] BIT; public void run() throws Exception {  FastScanner f = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = f.nextInt();  int[] arr = new int[n];  BIT = new int[n+10];  int inv = 0;  for(int i = 0; i < n; i++) {  arr[i] = f.nextInt();  inv ^= (i-query(arr[i])) & 1;  add(arr[i]);  }  int k = f.nextInt();  while(k-->0) {  int diff = -f.nextInt()+f.nextInt()+1;  inv ^= (diff*(diff-1)/2) & 1;  out.println(inv == 1 ? "odd" : "even");  }  out.flush(); }  public int query(int i) {  i++;  int res = 0;  while(i > 0) {  res += BIT[i];  i -= i & -i;  }  return res; } public void add(int i) {  i++;  while(i < BIT.length) {  BIT[i]++;  i += i & -i;  } }     static class FastScanner {   public BufferedReader reader;   public StringTokenizer tokenizer;   public FastScanner() {    reader = new BufferedReader(new InputStreamReader(System.in), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {   return Long.parseLong(next());   }   public double nextDouble() {   return Double.parseDouble(next());   }   public String nextLine() {   try {    return reader.readLine();   } catch(IOException e) {    throw new RuntimeException(e);   }   }   } }
1	public class A {  BufferedReader in;  StringTokenizer st;  PrintWriter out;  void solve() throws IOException {   int n = nextInt();   int k = nextInt();   boolean[] sieve = new boolean[n + 1];   List<Integer> primes = new ArrayList<Integer>();   for (int i = 2; i <= n; ++i) {    if (!sieve[i]) {     primes.add(i);     for (int j = 2 * i; j <= n; j += i) {      sieve[j] = true;     }    }   }   int count = 0;   for (int i = 0; i + 1 < primes.size(); ++i) {    int v = primes.get(i) + primes.get(i + 1) + 1;    if (v <= n && !sieve[v]) {     ++count;    }   }   out.println(count >= k ? "YES" : "NO");  }  public void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   eat("");   solve();   out.close();   in.close();  }  void eat(String s) {   st = new StringTokenizer(s);  }  String next() throws IOException {   while (!st.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    eat(line);   }   return st.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(next());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }  double nextDouble() throws IOException {   return Double.parseDouble(next());  }  public static void main(String[] args) throws IOException {   new A().run();  } }
4	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  CCompressionAndExpansion solver = new CCompressionAndExpansion();  int testCount = Integer.parseInt(in.next());  for (int i = 1; i <= testCount; i++)  solver.solve(i, in, out);  out.close(); }  static class CCompressionAndExpansion {  public final void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.nextInt();   ArrayList<ArrayList<Integer>> ans = new ArrayList<>();  ArrayList<Integer> start = new ArrayList<>();  start.add(in.nextInt());  ans.add(start);  out.println("1");  for (int i = 1; i < n; i++) {   ArrayList<Integer> lastList = ans.get(ans.size() - 1);   ArrayList<Integer> curList = (ArrayList<Integer>) lastList.clone();   ans.add(curList);   int curLast = in.nextInt();   for (int j = lastList.size() - 1; j >= 0; j--) {   int last = lastList.get(j);   if (curLast == 1) {    curList.add(1);    break;   } else if (curLast == last + 1) {    curList.set(j, curLast);    break;   } else {    curList.remove(j);   }   }   for (int j = 0; j < curList.size(); j++) {   if (j > 0) out.print(".");   out.print(curList.get(j));   }   out.println();  }  }  }  static final class InputReader {  private final InputStream stream;  private final byte[] buf = new byte[1 << 18];  private int curChar;  private int numChars;  public InputReader() {  this.stream = System.in;  }  public InputReader(final InputStream stream) {  this.stream = stream;  }  private int read() {  if (this.numChars == -1) {   throw new UnknownError();  } else {   if (this.curChar >= this.numChars) {   this.curChar = 0;    try {    this.numChars = this.stream.read(this.buf);   } catch (IOException ex) {    throw new InputMismatchException();   }    if (this.numChars <= 0) {    return -1;   }   }   return this.buf[this.curChar++];  }  }  public final int nextInt() {  int c;  for (c = this.read(); isSpaceChar(c); c = this.read()) {  }   byte sgn = 1;  if (c == 45) {   sgn = -1;   c = this.read();  }   int res = 0;   while (c >= 48 && c <= 57) {   res *= 10;   res += c - 48;   c = this.read();   if (isSpaceChar(c)) {   return res * sgn;   }  }   throw new InputMismatchException();  }  public final String next() {  int c;  while (isSpaceChar(c = this.read())) {  }   StringBuilder result = new StringBuilder();  result.appendCodePoint(c);   while (!isSpaceChar(c = this.read())) {   result.appendCodePoint(c);  }   return result.toString();  }  private static boolean isSpaceChar(final int c) {  return c == 32 || c == 10 || c == 13 || c == 9   || c == -1;  }  } }
5	public class Main {  public static void main(String[] args) throws IOException  {  new Main().run();  }  StreamTokenizer in;  PrintWriter out;  int nextInt() throws IOException  {  in.nextToken();  return (int)in.nval;  }  long nextLong() throws IOException  {  in.nextToken();  return (long)in.nval;  }  void run() throws IOException  {      in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));  solve();  out.flush();  }  void solve() throws IOException  {  int N=nextInt();  int m=nextInt();  int k=nextInt();    ArrayList<Integer> ts= new ArrayList<Integer>();   for (int i = 0; i < N; i++) {    ts.add(nextInt());   }   int count=0,pos=0;   Collections.sort(ts);   int jj=ts.size()-1;  while(m>k){     if((jj<0)||(k==0))  {pos=1;break;}  else{     k+=ts.get(jj) -1;  jj--;  count++;  }    }  if(pos==0)    out.println(count);  else    out.println("-1");    } }
4	public class Main{  static InputReader sc;  static PrintWriter pw;  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   sc = new InputReader(inputStream);   pw = new PrintWriter(outputStream);   solve();   pw.close();  }      static int time;   static BigInteger min(BigInteger a, BigInteger b){     if(a.compareTo(b)<0)    return a;   return b;  }  public static void solve(){     int t=1;   t=s(0);   u:while(t-->0){    int n=s(0);    int []arr=new int [n];    feedArr(arr);    Stack<Pair> stk=new Stack<>();    stk.push(new Pair("",1));    pln(1);    Pair pr;    for(int i=1;i<n;i++){     if(arr[i]==1){      pr=stk.peek();      stk.push(new Pair(pr.s+(pr.s.length()==0?"":".")+pr.i,1));      pln(stk.peek().s+"."+stk.peek().i);     }     else if(stk.peek().i==arr[i]-1){      pr=stk.pop();      pln(pr.s+(pr.s.length()==0?"":".")+arr[i]);      pr.i++;      stk.push(pr);     }     else{      stk.pop();      i--;     }    }   }    }    static long fact(long p){   long ans=1l;   for(long i=2;i<=p;i++)    ans*=i;   return ans;  }   static int find(int j, List<Integer> B, List<Integer> A, int i){     int l=j,r=B.size()-1,m;     while(l<=r){    m=(r-l)/2+l;    if(A.size()-i-1<=B.size()-m-1)     l=m+1;    else     r=m-1;   }     return r;  }  static int find2(List<Integer> B, int x){   int l=0,r=B.size()-1,m;        while(l<=r){       m=(r-l)/2+l;       if(B.get(m)-x<=0)     l=m+1;    else     r=m-1;   }     return r;    }  static long nPr(long n, long r){   long ans=1;   for(long i=1;i<=r;i++)    ans*=(n-i+1);   return ans;  }  static long nCr(long n, long r){   long ans=1;   for(long i=1;i<=r;i++){    ans*=(n-i+1);    ans/=i;   }   return ans;  }  static void update_DAG(int cur,int val, int []graph, int n)  {   if(val>maxx[cur])   {    int x=graph[cur];    if(x!=-1)     update_DAG(x,val+1,graph,n);    maxx[cur]=val;    update(cur,val,n);   }  }  static int []bit, maxx;  static void update(int i,int val, int n)  {   while(i<=n)   {    bit[i]=Math.max(bit[i],val);    i=i+(i&(-i));   }  }  static int query(int i)  {   int ret=0;   while(i>0)   {    ret=Math.max(ret,bit[i]);    i=i-(i&(-i));   }   return ret;  }   public static int [][]dir=new int [][]{{1,0},{0,1},{-1,0},{0,-1}};    public static int find(List<Integer> list, int x){   int l=0,r=list.size()-1,m;   while(l<=r){    m=(r-l)/2+l;    if(list.get(m)<=x)     l=m+1;    else     r=m-1;   }   return r;  }  static class Node{   int val;   long cost;   Node next;   Node(int v,long c){    val=v;    next=null;    cost=c;   }  }   public static long sum(long n){   long val=0l;   while(n>0){    val+=n%10;    n/=10;   }   return val;  }                              public static int findDiameter(int r, List<List<Integer>>list){   return findFarthest(findFarthest(r,list)[0],list)[1];  }  public static int[] findFarthest(int u, List<List<Integer>>list){   int n=list.size();   boolean []vis=new boolean[n+1];   Queue<Integer>q=new LinkedList<>();   q.offer(u);   vis[u]=true;   int s,pr,cnt=0;   int []ar=new int[]{u,0};   while(q.size()>0){    s=q.size();    while(s-->0){     pr=q.poll();     if(ar[1]<cnt){      ar[1]=cnt;      ar[0]=pr;     }     for(int i:list.get(pr)){      if(!vis[i]){       vis[i]=true;       q.offer(i);      }     }    }    cnt++;   }   return ar;  }  public static long atMostK(char []chrr, int k){   if(k<0)    return 0;   int l=0,cnt=0;   long ans=0l;   for(int i=0;i<chrr.length;i++){    if(chrr[i]=='1')     cnt++;    while(cnt>k){     if(chrr[l++]=='1')      cnt--;    }    ans+=(long)(i-l)+1l;   }   return ans;  }  public static int ask(int l, int r){   System.out.println("? "+l+" "+r);   System.out.flush();   return sc.nextInt();  }  public static void sort(int []arr){   ArrayList<Integer> list=new ArrayList<>();   for(int i=0;i<arr.length;i++)    list.add(arr[i]);   Collections.sort(list);   for(int i=0;i<arr.length;i++)    arr[i]=list.get(i);  }  public static void sort(long []arr){   ArrayList<Long> list=new ArrayList<>();   for(int i=0;i<arr.length;i++)    list.add(arr[i]);   Collections.sort(list);   for(int i=0;i<arr.length;i++)    arr[i]=list.get(i);  }  public static void swap(char []chrr, int i, int j){   char temp=chrr[i];   chrr[i]=chrr[j];   chrr[j]=temp;  }  public static int countSetBits(long n){   int a=0;   while(n>0){    a+=(n&1);    n>>=1;   }   return a;  }  static class Pair{   String s;   int i;   Pair(String S, int I){    s=S;    i=I;   }    }   static boolean isPrime(long n) {   if (n <= 1)    return false;   if (n <= 3)    return true;   if (n % 2 == 0 || n % 3 == 0)    return false;   for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;   return true;  }  static long gcd(long a, long b) {   if (b == 0)    return a;   return a>b?gcd(b, a % b):gcd(a, b % a);  }  static long fast_pow(long base,long n,long M){   if(n==0)    return 1;   if(n==1)   return base;   long halfn=fast_pow(base,n/2,M);   if(n%2==0)    return ( halfn * halfn ) % M;   else    return ( ( ( halfn * halfn ) % M ) * base ) % M;  }  static long modInverse(long n,long M){   return fast_pow(n,M-2,M);  }  public static int s(int n){   return sc.nextInt();  }  public static long s(long n){   return sc.nextLong();  }  public static String s(String n){   return sc.next();  }  public static double s(double n){   return sc.nextDouble();  }  public static void p(int n){   pw.print(n);  }  public static void p(long n){   pw.print(n);  }  public static void p(String n){   pw.print(n);  }  public static void p(double n){   pw.print(n);  }  public static void pln(int n){   pw.println(n);  }  public static void pln(long n){   pw.println(n);  }  public static void pln(String n){   pw.println(n);  }  public static void pln(double n){   pw.println(n);  }  public static void feedArr(long []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextLong();  }  public static void feedArr(double []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextDouble();  }  public static void feedArr(int []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.nextInt();  }  public static void feedArr(String []arr){   for(int i=0;i<arr.length;i++)    arr[i]=sc.next();  }  public static String printArr(int []arr){   StringBuilder sbr=new StringBuilder();   for(int i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(long []arr){   StringBuilder sbr=new StringBuilder();   for(long i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(String []arr){   StringBuilder sbr=new StringBuilder();   for(String i:arr)    sbr.append(i+" ");   return sbr.toString();  }  public static String printArr(double []arr){   StringBuilder sbr=new StringBuilder();   for(double i:arr)    sbr.append(i+" ");   return sbr.toString();  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;    public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }   public long nextLong() {    return Long.parseLong(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }  } } class AncestorQuerier {  int [][]dp;  int N=200001;  int M=22;  int max;   public void preCompute(int []par){   for(int i=0;i<N;i++){    if(i>=2&&i<par.length)     dp[i][0]=par[i];    else     dp[i][0]=-1;   }   for(int j=1;j<M;j++){    for(int i=0;i<N;i++){     if(dp[i][j-1]!=-1)      dp[i][j]=dp[dp[i][j-1]][j-1];    }   }    }   public int getAncestor(int val, int k) {   if(k<0||val>max)    return -1;   if(k==0)    return val;   int t=(1<<(M-1));     for(int i=M-1;i>=0&&val!=-1;i--,t>>=1){    if(t<=k){     val=dp[val][i];     k-=t;    }   }   return val;   } }
0	public class A{ public static BufferedReader k; public static BufferedWriter z;    public static void main(String [] args)throws IOException{  k = new BufferedReader(new InputStreamReader(System.in));  z = new BufferedWriter(new OutputStreamWriter(System.out));      String[] dat = k.readLine().split(" ");    long l = Long.parseLong(dat[0]);   long r = Long.parseLong(dat[1]);    if(r-l<=1){   z.write(-1+"\n");  }  else if(r-l == 2){        if((l&1)!=0){   z.write(-1+"\n");   }   else{   z.write(l+" "+(l+1)+" "+r+"\n");   }     }  else{   if((l&1)==0){   z.write(l+" "+(l+1)+" "+(l+2)+"\n");   }   else{   z.write((l+1)+" "+(l+2)+" "+(l+3)+"\n");   }  }           z.flush();  } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.readInt();   int m = in.readInt();   int k = in.readInt();    int [] filters = new int[n];   for(int i = 0; i < n; ++i) filters[i] = in.readInt();   Arrays.sort(filters);   int nS = 0, tN = k;   while(tN < m && nS < n) {    tN += filters[n-1-nS] - 1;    nS++;   }   if(tN >= m) out.printLine(nS);   else out.printLine(-1);  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }   public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public boolean isSpaceChar(int c) {   if (filter != null)    return filter.isSpaceChar(c);   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  } } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object...objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.print(objects[i]);   }  }  public void printLine(Object...objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  } }
3	public class CF911D { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] aa = new int[n];  for (int i = 0; i < n; i++)  aa[i] = Integer.parseInt(st.nextToken());  boolean odd = false;  for (int i = 0; i < n; i++)  for (int j = i + 1; j < n; j++)   if (aa[i] > aa[j])   odd = !odd;  int m = Integer.parseInt(br.readLine());  while (m-- > 0) {  st = new StringTokenizer(br.readLine());  int l = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  int k = r - l + 1;  if ((long) k * (k - 1) / 2 % 2 != 0)   odd = !odd;  pw.println(odd ? "odd" : "even");  }  pw.close(); } }
1	public class Main implements Runnable {  public void _main() throws IOException {  int n = nextInt();  int k = nextInt();  boolean[] p = new boolean[n + 1];  Arrays.fill(p, true);  List<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= n; i++)  if (p[i]) {   primes.add(i);   for (int j = i + i; j <= n; j += i)   p[j] = false;  }  boolean[] ok = new boolean[n + 1];  for (int i = 0; i < primes.size() - 1; i++) {  int x = primes.get(i);  int y = primes.get(i + 1);  if (x + y + 1 <= n)   ok[x + y + 1] = true;  }  for (int i = 2; i <= n; i++)  if (p[i] && ok[i]) {   --k;    }   out.println(k <= 0 ? "YES" : "NO"); }  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  private String next() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String rl = in.readLine();  if (rl == null)   return null;  st = new StringTokenizer(rl);  }  return st.nextToken(); }  private int nextInt() throws IOException {  return Integer.parseInt(next()); }  private long nextLong() throws IOException {  return Long.parseLong(next()); }  private double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   _main();   out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(202);  } } }
3	public class D {  public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  int n=sc.nextInt();  int inv=0;  int []a=new int [n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  for(int j=0;j<n;j++)  for(int i=j+1;i<n;i++)   if(a[j]>a[i])   inv=1-inv;  int m=sc.nextInt();  StringBuilder sb=new StringBuilder();  while(m-->0)  {  int l=sc.nextInt();  int r=sc.nextInt();  int s=r-l+1;  if(s*(s-1)/2%2==1)   inv=1-inv;  if(inv==1)   sb.append("odd\n");  else   sb.append("even\n");  }  System.out.print(sb);  } static class Scanner  {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {return Integer.parseInt(next());}   public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}   public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if(x.charAt(0) == '-')  {   neg = true;   start++;  }  for(int i = start; i < x.length(); i++)   if(x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   }   else   {   sb.append(x.charAt(i));   if(dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg?-1:1);  }   public boolean ready() throws IOException {return br.ready();}  } }
5	public class Problem220A {  static int[] numbers;  static int[] numbersCopy;  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   int i = Integer.parseInt(in.readLine());   numbers = new int[i];   numbersCopy = new int[i];   StringTokenizer stringTokenizer = new StringTokenizer(in.readLine());   int numOutOfPlace = 0;   for (int j = 0; j < i; j++) {    numbers[j] = Integer.parseInt(stringTokenizer.nextToken());    numbersCopy[j] = numbers[j];   }   Arrays.sort(numbers);   for (int j = 0; j < i; j++) {    if (numbers[j] != numbersCopy[j]) {     numOutOfPlace++;     if (numOutOfPlace > 2) {      break;     }    }   }   if (numOutOfPlace == 0 || numOutOfPlace == 2) {    System.out.println("YES");   } else {    System.out.println("NO");   }  } }
3	public class D {  public void solve(Scanner in, PrintWriter out) {  int n = in.nextInt();  int[] a = new int[n + 1];  for(int i = 1; i <= n; ++i) a[i] = in.nextInt();   int[] rangeInv = new int[n + 1];  BIT bit = new BIT(n + 1);  for(int i = 1; i <= n; ++i) {  int cur = a[i];  int inv = (int) bit.sum(cur, n);  rangeInv[i] = rangeInv[i - 1] + inv;  bit.add(cur, 1);  }   int m = in.nextInt();  int curTotal = rangeInv[n];   for(int qq = 0; qq < m; ++qq) {  int l = in.nextInt();  int r = in.nextInt();    int N = r - l + 1;  int total = N * (N - 1) / 2;    int cur = rangeInv[r] - rangeInv[l - 1];    int newInv = total - cur;    curTotal -= cur;  curTotal += newInv;    if(curTotal % 2 == 0) {   out.println("even");  } else {   out.println("odd");  }  }   }  public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  new D().solve(in, out);  in.close();  out.close(); }  class BIT {   long[] tree;  int n;   public BIT(int n) {   this.n = n;   tree = new long[n + 1];  }   public void add(int i, long val)  {   while(i <= n)   {    tree[i] += val;    i += i & -i;   }  }   public long sum(int to)  {   long res = 0;   for(int i = to; i >= 1; i -= (i & -i))   {    res += tree[i];   }   return res;  }   public long sum(int from, int to) {   return sum(to) - sum(from - 1);  } } }
2	public class C {  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  long n = sc.nextLong();  Long S = sc.nextLong();   long l = 0;  long h = n;   long ans = n;   while(l <= h) {  long mid = (l + h) / 2;  long t = mid;  long sum = 0;    while(t > 0) {   sum += t % 10;   t /= 10;  }    if(mid - sum < S) {   ans = mid;   l = mid + 1;  }else   h = mid - 1;  }   out.println(n - ans);  out.flush();  out.close(); }   static class Scanner  {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream System){br = new BufferedReader(new InputStreamReader(System));}  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public String nextLine()throws IOException{return br.readLine();}  public int nextInt() throws IOException {return Integer.parseInt(next());}  public double nextDouble() throws IOException {return Double.parseDouble(next());}  public char nextChar()throws IOException{return next().charAt(0);}  public Long nextLong()throws IOException{return Long.parseLong(next());}  public boolean ready() throws IOException{return br.ready();}  public void waitForInput(){for(long i = 0; i < 3e9; i++);} }  }
4	public class C {  public static void main(String[] args) throws IOException{   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int t = Integer.parseInt(f.readLine());   while(t-->0){    int n = Integer.parseInt(f.readLine());    int[] arr = new int[n];    for(int i = 0; i < n; i++){     arr[i] = Integer.parseInt(f.readLine());    }    int[] levels = new int[n];    int curr_level = 0;    for(int i = 0; i < n; i++){     if(levels[curr_level] == arr[i]-1){      levels[curr_level]++;     }else if(arr[i] == 1){      curr_level++;      levels[curr_level]++;     }else if(arr[i] > 1){      while(curr_level > 0 && levels[curr_level] != arr[i]-1){       levels[curr_level] = 0;       curr_level--;      }      levels[curr_level]++;     }     StringBuilder ostring = new StringBuilder();     for(int level = 0; level <= curr_level; level++){      ostring.append(levels[level]);      if(level != curr_level) ostring.append(".");     }     out.println(ostring);    }   }   out.close();  } }
1	public class helloWorld { public static void main(String[] args)  {   Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  int[] ar = new int[200];   String str = in.next();  for(int i = 0; i < str.length(); i++)  ar[ str.charAt(i) ]++;    int ans = 100000;   for(int i = 'A'; i < 'A' + m; i++)  ans = Math.min(ans, ar[i]);  ans *= m;   System.out.println(ans);   in.close(); } }
1	public class A { public static void main(String args[]) {  boolean[] b = new boolean[11000];  Arrays.fill(b, true);  b[0] = b[1] = false;  for(int i=2;i < b.length;i++)  {  if(!b[i])   continue;   for(int j=2;i*j<b.length;j++)   b[i*j] = false;  }  int[] p = new int[11000];  int pn = 0;  for(int i=0;i < b.length;i++)  {  if(b[i])   p[pn++] = i;  }  Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt();  int rtn = 0;    for(int j=0;p[j] <= n;j++)  {    for(int h=0;h <= j;h++)  {   if(p[h] + p[h+1] + 1 == p[j])   {   rtn++;   break;   }  }  }  System.out.println(rtn >= k ? "YES" : "NO");   } }
1	public class Solution implements Runnable{  private static BufferedReader br = null;  private static PrintWriter out = null;  private static StringTokenizer stk = null;   public static void main(String[] args) {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   (new Thread(new Solution())).start();  }   private void loadLine() {   try {    stk = new StringTokenizer(br.readLine());   }   catch (IOException e) {    e.printStackTrace();   }  }   private String nextLine() {   try {    return br.readLine();   }   catch (IOException e) {    e.printStackTrace();   }   return null;  }   private Integer nextInt() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Integer.parseInt(stk.nextToken());  }   private Long nextLong() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Long.parseLong(stk.nextToken());  }   private String nextWord() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return (stk.nextToken());  }   private Double nextDouble() {   while (stk==null||!stk.hasMoreTokens()) loadLine();   return Double.parseDouble(stk.nextToken());  }   public void run() {   int n = nextInt();   int k = nextInt();     boolean[] isP = new boolean[2*n];   Arrays.fill(isP, true);   isP[0] = isP[1] = false;     for (int i = 0; i <= n; ++i) {    if (isP[i]) {     for (int j = i+i; j <= n; j+=i) {      isP[j] = false;     }    }   }     ArrayList<Integer> p = new ArrayList<Integer>();   for (int i = 0; i <= n; ++i) {    if (isP[i]) {     p.add(i);    }   }     int cnt = 0;   for (int i = 0; i < p.size(); ++i) {    int num = p.get(i) - 1;       for (int j = 0; j < p.size() - 1; ++j) {     if (p.get(j) + p.get(j+1) == num) {      ++cnt;      break;     }    }   }     if (cnt >= k) {    out.println("YES");   }   else {    out.println("NO");   }   out.flush();  } }
6	public class Task2 {  public static void main(String[] args) throws IOException {   new Task2().solve();  }    int mod = 1000000007;  PrintWriter out;  int n;  int m;      long base = (1L << 63);  long P = 31;  int[][] a;  void solve() throws IOException {        Reader in = new Reader();   PrintWriter out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );         int sx = in.nextInt();   int sy = in.nextInt();   int n = in.nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   int[] dp = new int[1 << n];   int[] p = new int[1 << n];   int inf = 1000000000;   Arrays.fill(dp, inf);   dp[0] = 0;   for (int mask = 0; mask < (1 << n) - 1; mask ++) {    int k = -1;    if (dp[mask] == inf)     continue;    for (int i = 0; i < n; i++) {     if ((mask & (1 << i)) == 0) {      k = i;      break;     }    }    for (int i = k; i < n; i++) {     if ((mask & (1 << i)) == 0) {      int val = dp[mask] + dist(sx, sy, x[i], y[i]) + dist(sx, sy, x[k], y[k]) + dist(x[i], y[i], x[k], y[k]);      if (val < dp[mask | (1 << i) | (1 << k)]) {       dp[mask | (1 << i) | (1 << k)] = val;       p[mask | (1 << i) | (1 << k)] = mask;      }     }    }   }   out.println(dp[(1 << n) - 1]);   int cur = (1 << n) - 1;   out.print(0+" ");   while (cur != 0) {    int prev = p[cur];    for (int i = 0; i < n; i++) {     if (((cur & (1 << i)) ^ (prev & (1 << i))) != 0)      out.print(i+1+" ");    }     out.print(0+" ");    cur = prev;   }   out.flush();   out.close();  }  int dist(int x1, int y1, int x2, int y2) {   return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);  }  long gcd(long a, long b) {   if (b == 0)    return a;   return gcd(b, a%b);  }  class Item {   int a;   int b;   int c;   Item(int a, int b, int c) {    this.a = a;    this.b = b;    this.c = c;   }  }  class Pair implements Comparable<Pair>{   int a;   int b;   Pair(int a, int b) {    this.a = a;    this.b = b;   }   public int compareTo(Pair p) {    if (b < p.b)     return 1;    if (b > p.b)     return -1;    return 0;   }                            }  class Reader {   BufferedReader br;   StringTokenizer tok;   Reader(String file) throws IOException {    br = new BufferedReader( new FileReader(file) );   }   Reader() throws IOException {    br = new BufferedReader( new InputStreamReader(System.in) );   }   String next() throws IOException {    while (tok == null || !tok.hasMoreElements())     tok = new StringTokenizer(br.readLine());    return tok.nextToken();   }   int nextInt() throws NumberFormatException, IOException {    return Integer.valueOf(next());   }   long nextLong() throws NumberFormatException, IOException {    return Long.valueOf(next());   }   double nextDouble() throws NumberFormatException, IOException {    return Double.valueOf(next());   }   String nextLine() throws IOException {    return br.readLine();   }  } }
4	public class C {  static HashMap<Integer, ArrayList<Integer>> tree = new HashMap<>();  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintStream out = System.out;   int t = Integer.parseInt(br.readLine());   for (int i = 0; i < t; i++) {    int n = Integer.parseInt(br.readLine());    ArrayList<Integer> depth = new ArrayList<>();    int y = 0;    String[] ans = new String[n];    for (int x = 0; x < n; x++) {     int in = Integer.parseInt(br.readLine());     if (in == 1) {      if (y == depth.size()) depth.add(1);      else depth.set(y, 1);      y++;      StringBuilder curr = new StringBuilder();      curr.append(depth.get(0));      for (int a = 1; a < y; a++) {       curr.append('.');       curr.append(depth.get(a));      }      ans[x] = curr.toString();      continue;     }     for (int d = y-1; d >= 0; d--) {      if (depth.get(d) == in-1) {       y = d+1;       depth.set(d, depth.get(d)+1);       StringBuilder curr = new StringBuilder();       for (int a = 0; a < d; a++) {        curr.append(depth.get(a));        curr.append('.');       }       curr.append(in);       ans[x] = curr.toString();       break;      }     }    }       for (String x : ans) out.println(x);   }   System.out.flush();  } }
4	public class Main {     static class Reader {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(     new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[64];    int cnt = 0, c;    while ((c = read()) != -1) {     if (c == '\n') {      if (cnt != 0) {       break;      }      else {       continue;      }     }     buf[cnt++] = (byte)c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ') {     c = read();    }    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (c == '.') {     while ((c = read()) >= '0' && c <= '9') {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0,         BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }               public static void main(String[] args) throws IOException{   Scanner sc=new Scanner(System.in);     PrintWriter out=new PrintWriter(System.out);   int t = sc.nextInt();  while(t-->0) {   int n=sc.nextInt();   ArrayList<Integer> al[]=new ArrayList[n+1];      for(int i=0;i<=n;i++)   al[i]=new ArrayList<>();     al[0].add(1);     int y;   y=sc.nextInt();   boolean flag=true;   for(int i=1;i<=n-1;i++) {    int x=sc.nextInt();    int idx=al[i-1].size()-1;    if(x!=1) {     while(flag) {      int ans=x-1;      if(al[i-1].get(idx)==ans) {       idx--;       break;      }      idx--;     }    }    for(int j=0;j<=idx;j++) {     al[i].add(al[i-1].get(j));    }    al[i].add(x);   }     for(int i=0;i<=n-1;i++) {    out.print(al[i].get(0));    for(int j=1;j<=al[i].size()-1;j++) {     out.print("."+al[i].get(j));    }    out.println();   }     }    out.flush();  out.close();          }      }
5	public class Solution {  private StringTokenizer st; private BufferedReader in; private PrintWriter out;  public void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; ++i) {  a[i] = nextInt();  }  int[] b = a.clone();  Arrays.sort(b);  int diff = 0;  for (int i = 0; i < n; ++i) {  if (a[i] != b[i]) {   diff++;  }  }  out.println(diff <= 2 ? "YES" : "NO"); }  public void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  eat("");   solve();   out.close(); }  void eat(String s) {  st = new StringTokenizer(s); }  String next() throws IOException {  while (!st.hasMoreTokens()) {  String line = in.readLine();  if (line == null) {   return null;  }  eat(line);  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  Locale.setDefault(Locale.US);  new Solution().run(); }  }
2	public class Test {  private static long sum(long value) {  long ans = 0;  while (value > 0) {  ans += value % 10;  value /= 10;  }  return ans; }  public static void main(String[] args) {   Scanner scan = new Scanner(System.in);  long n , s , ans = 0;  n = scan.nextLong();  s = scan.nextLong();  long current = s;  while (current <= n && current <= s + 20 * 9) {    long temp = sum(current);  if (current - temp >= s) {   ans ++;  }  current ++;  }  if (current <= n) {  ans += (n - current + 1);  }  System.out.println(ans);   }   }
5	public class CFTest6 {  static BufferedReader br;  public static void main(String[] args) {  br = new BufferedReader(new InputStreamReader(System.in));  try {   int[] a1 = readIntArr();  int[] a2 = readIntArr();  br.close();  int f = a1[0];  int d = a1[1];  int s = a1[2];  Arrays.sort(a2);   if (d <= s)   System.out.println(0);   else {   int cur = d - s + 1;      int num=0;   for(int i=0;i<f;i++){   num++;   cur-=a2[f-i-1];   if(cur<=0)break;   cur++;   }   if (cur > 0)   System.out.println(-1);   else{         System.out.println(num);   }  }  } catch (IOException e) {  e.printStackTrace();  }  }  static public String readLine() throws IOException {  return br.readLine();  }  static public String readString() throws IOException {  return br.readLine();  }  static public long readlong() throws IOException {  return Long.parseLong(br.readLine()); }  static public int readInt() throws IOException {  return Integer.parseInt(br.readLine()); }  static public int[] readIntArr() throws IOException {  String[] str = br.readLine().split(" ");  int arr[] = new int[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Integer.parseInt(str[i]);  return arr; }  static public double[] readDoubleArr() throws IOException {  String[] str = br.readLine().split(" ");  double arr[] = new double[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Double.parseDouble(str[i]);  return arr; }  static public long[] readLongArr() throws IOException {  String[] str = br.readLine().split(" ");  long arr[] = new long[str.length];  for (int i = 0; i < arr.length; i++)  arr[i] = Long.parseLong(str[i]);  return arr; }  static public double readDouble() throws IOException {  return Double.parseDouble(br.readLine()); } }
5	public class A implements Runnable {  final boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;  BufferedReader in; PrintWriter out; StringTokenizer tok;  public static void main(String[] args) {  new Thread(null, new A(), "", 256*1024*1024).start(); }  public void run() {  try {  long t1 = 0, t2 = 0, m1 = 0, m2 = 0;  if (LOCAL) {   t1 = System.currentTimeMillis();   m1 = Runtime.getRuntime().freeMemory();  }  Locale.setDefault(Locale.US);  if (LOCAL) {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter("output.txt");  } else {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  tok = new StringTokenizer("");  solve();  in.close();  out.close();  if (LOCAL) {   t2 = System.currentTimeMillis();   m2 = Runtime.getRuntime().freeMemory();   System.err.println("Time = " + (t2 - t1) + " ms.");   System.err.println("Memory = " + ((m1 - m2) / 1024) + " KB.");  }  } catch (Throwable e) {  e.printStackTrace(System.err);  throw new RuntimeException();  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  String line = in.readLine();  if (line == null) return null;  tok = new StringTokenizer(line);  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  long readLong() throws IOException {  return Long.parseLong(readString()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }  static class Mergesort {  private Mergesort() {}  public static void sort(int[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(long[] a) {  mergesort(a, 0, a.length - 1);  }  public static void sort(double[] a) {  mergesort(a, 0, a.length - 1);  }  private static final int MAGIC_VALUE = 42;  private static void mergesort(int[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(long[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void mergesort(double[] a, int leftIndex, int rightIndex) {  if (leftIndex < rightIndex) {   if (rightIndex - leftIndex <= MAGIC_VALUE) {   insertionSort(a, leftIndex, rightIndex);   } else {   int middleIndex = (leftIndex + rightIndex) / 2;   mergesort(a, leftIndex, middleIndex);   mergesort(a, middleIndex + 1, rightIndex);   merge(a, leftIndex, middleIndex, rightIndex);   }  }  }  private static void merge(int[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  int[] leftArray = new int[length1];  int[] rightArray = new int[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(long[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  long[] leftArray = new long[length1];  long[] rightArray = new long[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void merge(double[] a, int leftIndex, int middleIndex, int rightIndex) {  int length1 = middleIndex - leftIndex + 1;  int length2 = rightIndex - middleIndex;  double[] leftArray = new double[length1];  double[] rightArray = new double[length2];  System.arraycopy(a, leftIndex, leftArray, 0, length1);  System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);  for (int k = leftIndex, i = 0, j = 0; k <= rightIndex; k++) {   if (i == length1) {   a[k] = rightArray[j++];   } else if (j == length2) {   a[k] = leftArray[i++];   } else {   a[k] = leftArray[i] <= rightArray[j] ? leftArray[i++] : rightArray[j++];   }  }  }  private static void insertionSort(int[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   int current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(long[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   long current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  private static void insertionSort(double[] a, int leftIndex, int rightIndex) {  for (int i = leftIndex + 1; i <= rightIndex; i++) {   double current = a[i];   int j = i - 1;   while (j >= leftIndex && a[j] > current) {   a[j + 1] = a[j];   j--;   }   a[j + 1] = current;  }  }  }  void debug(Object... o) {  if (LOCAL) {  System.err.println(Arrays.deepToString(o));  } }    void solve() throws IOException {  int n = readInt();  int m = readInt();  int k = readInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = readInt();  }  Mergesort.sort(a);  for (int need = 0; need <= n; need++) {  int cnt = k;  for (int i = 0; i < need; i++) {   cnt += a[n - i - 1] - 1;  }  if (cnt >= m) {   out.println(need);   return;  }  }  out.println(-1); }  }
1	public class B {  void run(){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt(), k = sc.nextInt();   int[] a = new int[n+1];   for(int i=1;i<=n;i++)a[i]=sc.nextInt();   int[] c = new int[100001];   int num = 0;   int ri = -1, rj = -1;   int s = 1, t = 0;   while(t<n){    t++;    if(c[a[t]]==0){     num++;    }    c[a[t]]++;    for(;k<=num;s++){     if(ri==-1 || rj-ri+1>t-s+1){      ri = s; rj = t;     }     c[a[s]]--;     if(c[a[s]]==0){      num--;     }    }   }   System.out.println(ri+" "+rj);  }   void debug(Object...o){   System.out.println(Arrays.deepToString(o));  }   public static void main(String[] args) {   new B().run();  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB { public void solve(int testNumber, FastScanner in, PrintWriter out) {  int n = in.nextInt();  int a = in.nextInt();  int b = in.nextInt();  List<Clause> clauses = new ArrayList<Clause>();  int[] p = new int[n];  Map<Integer, Integer> id = new HashMap<>();  for (int i = 0; i < n; i++) {  p[i] = in.nextInt();  id.put(p[i], i);  }   for (int i = 0; i < n; i++) {  int x = p[i];  Integer j = id.get(a - x);  if (j == null) {     clauses.add(new Clause(i, i, true, false));  } else {   clauses.add(new Clause(i, j, true, true));   clauses.add(new Clause(j, i, false, false));  }   j = id.get(b - x);  if (j == null) {     clauses.add(new Clause(i, i, false, true));  } else {   clauses.add(new Clause(i, j, false, false));   clauses.add(new Clause(j, i, true, true));  }  }  SAT2Solver solver = new SAT2Solver(n);  if (!solver.solve(clauses)) {  out.println("NO");  return;  }  out.println("YES");  for (int i = 0; i < n; i++) {  if (i > 0) {   out.print(" ");  }  if (solver.isTrue[i]) {   out.print(0);  } else {   out.print(1);  }  }  out.println(); }  class Clause {  int v1, v2;  boolean neg1, neg2;    Clause(int v1, int v2, boolean pos1, boolean pos2) {  this.v1 = v1;  this.v2 = v2;  this.neg1 = !pos1;  this.neg2 = !pos2;  } }  class SAT2Solver {  List<Integer>[] g;  boolean[] isTrue;  int n;  int numComps;  int[] low;  int[] vis;  int[] comp;  boolean[] onStack;  int[] stack;  int sp;  int globalTime;  SAT2Solver(int n) {  this.n = n;  isTrue = new boolean[2 * n];  vis = new int[2 * n];  low = new int[2 * n];  stack = new int[2 * n];  comp = new int[2 * n];  onStack = new boolean[2 * n];  g = new List[2 * n];  }  public boolean solve(List<Clause> clauses) {  for (int i = 0; i < 2 * n; i++) {   g[i] = new ArrayList<Integer>();  }  for (Clause clause : clauses) {   int v1 = clause.v1;   int v2 = clause.v2;   boolean neg1 = clause.neg1;   boolean neg2 = clause.neg2;   if (neg1) {   v1 = negate(v1);   }   if (neg2) {   v2 = negate(v2);   }        g[v1].add(v2);  }  Arrays.fill(vis, -1);  Arrays.fill(onStack, false);  sp = 0;  globalTime = 0;  numComps = 0;  for (int i = 0; i < 2 * n; i++) {   if (vis[i] < 0) {   dfsTarjan(i);   }  }  int[] firstInComp = new int[numComps];  Arrays.fill(firstInComp, -1);  int[] nextSameComp = new int[2 * n];  for (int i = 0; i < 2 * n; i++) {   int c = comp[i];   nextSameComp[i] = firstInComp[c];   firstInComp[c] = i;  }  List<Integer>[] invertedCompEdges = new List[numComps];  for (int i = 0; i < numComps; i++) {   invertedCompEdges[i] = new ArrayList<Integer>();  }  for (int i = 0; i < 2*n; i++) {   for (int j : g[i]) {   invertedCompEdges[comp[j]].add(comp[i]);   }  }  boolean[] compIsTrue = new boolean[numComps];  Arrays.fill(compIsTrue, true);  for (int c = 0; c < numComps; c++) {   if (!compIsTrue[c]) {   continue;   }   for (int i = firstInComp[c]; i >= 0; i = nextSameComp[i]) {   int nc = comp[negate(i)];   if (c == nc) {    return false;   }   }   for (int i = firstInComp[c]; i >= 0; i = nextSameComp[i]) {   int nc = comp[negate(i)];   dfsReject(nc, invertedCompEdges, compIsTrue);   }  }  for (int i = 0; i < 2 * n; i++) {   isTrue[i] = compIsTrue[comp[i]];  }  for (int i = 0; i < n; i++) {   if (isTrue[i] && isTrue[negate(i)]) {   throw new AssertionError();   }   if (!isTrue[i] && !isTrue[negate(i)]) {   return false;   }  }  return true;  }  private int negate(int i) {  return i + (i < n ? n : -n);  }  private void dfsReject(int c, List<Integer>[] invertedCompEdges, boolean[] compIsTrue) {  if (!compIsTrue[c]) {   return;  }  compIsTrue[c] = false;  for (int p : invertedCompEdges[c]) {   dfsReject(p, invertedCompEdges, compIsTrue);  }  }  void dfsTarjan(int v) {  vis[v] = globalTime;  low[v] = globalTime;  ++globalTime;  stack[sp++] = v;  onStack[v] = true;  for (int u : g[v]) {   if (vis[u] < 0) {   dfsTarjan(u);   if (low[v] > low[u]) {    low[v] = low[u];   }   } else if (onStack[u] && low[v] > vis[u]) {   low[v] = vis[u];   }  }  if (low[v] == vis[v]) {   while (true) {   int u = stack[--sp];   onStack[u] = false;   comp[u] = numComps;   if (u == v) {    break;   }   }   ++numComps;  }  }  }  } class FastScanner {  private BufferedReader in; private StringTokenizer st;  public FastScanner(InputStream stream) {  in = new BufferedReader(new InputStreamReader(stream)); }  public String next() {  while (st == null || !st.hasMoreTokens()) {  try {   String rl = in.readLine();   if (rl == null) {   return null;   }   st = new StringTokenizer(rl);  } catch (IOException e) {   throw new RuntimeException(e);  }  }  return st.nextToken(); }  public int nextInt() {  return Integer.parseInt(next()); } }
3	public class Codeforces911D { public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] sp = br.readLine().split(" ");  int n = Integer.parseInt(sp[0]);  int[] a = new int[n];  sp = br.readLine().split(" ");  for (int i = 0; i < n; i++) {  a[i] = Integer.parseInt(sp[i]);  }  int inversions = 0;  for (int i = 0; i < n-1; i++) {  for (int j = i+1; j < n; j++) {   if (a[i] > a[j]) {   inversions++;   }  }  }  inversions = inversions%2;   sp = br.readLine().split(" ");  int m = Integer.parseInt(sp[0]);  for (int i = 0; i < m; i++) {  sp = br.readLine().split(" ");  int l = Integer.parseInt(sp[0]);  int r = Integer.parseInt(sp[1]);  if ((r-l+1)%4 == 2 || (r-l+1)%4 == 3) {   inversions = 1-inversions;  }  if (inversions == 1) {   System.out.println("odd");  }  else {   System.out.println("even");  }  } } }
1	public class Code implements Runnable {  public static void main(String[] args) throws IOException {   new Thread(new Code()).start();  }  private void solve() throws IOException {   taskB();  }  private void taskB() throws IOException {   int n = nextInt(), k = nextInt();   int[] arr = new int[n];   for(int i = 0; i < n; ++i) arr[i] = nextInt();   int i = 0;   while(i < n - 1 && arr[i] == arr[i + 1]) ++i;   if(k == 1)    writer.println(1 + " " + 1);   else if(k == 2 && i == n - 2)    writer.println(n - 1 + " " + n);   else {    if(i == n - 1)     writer.println(-1 + " " + -1);    else {     int l = i;     Map<Integer, Integer> set = new HashMap<Integer, Integer>(n);     while(i < n && set.size() < k) {      if(set.containsKey(arr[i])) set.put(arr[i], set.get(arr[i]) + 1);      else set.put(arr[i], 1);      i += 1;     }     if(set.size() < k) writer.println(-1 + " " + -1);     else {      while(l < i && i - l > k && set.get(arr[l]) > 1) {       set.put(arr[l], set.get(arr[l]) - 1);       l += 1;      }      writer.println((l + 1) + " " + i);     }    }   }  }  private class Pair<E extends Comparable, V extends Comparable> implements Comparable<Pair<E, V>> {   public Pair(E first, V second) {    this.first = first;    this.second = second;   }   @Override   public int compareTo(Pair<E, V> obj) {    if(first.equals(obj.first)) return second.compareTo(obj.second);    return first.compareTo(obj.first);   }   @Override   public boolean equals(Object obj) {    Pair other = (Pair)obj;    return first.equals(other.first) && second.equals(other.second);   }   public E first;   public V second;  }  @Override  public void run() {   try {    if(in.equals("")) reader = new BufferedReader(new InputStreamReader(System.in));    else reader = new BufferedReader(new FileReader(in));    if(out.equals("")) writer = new PrintWriter(new OutputStreamWriter(System.out));    else writer = new PrintWriter(new FileWriter(out));    solve();   } catch(IOException e) {    e.printStackTrace();   } finally {    try {     reader.close();     writer.close();    } catch(IOException e) {     e.printStackTrace();    }   }  }  private int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  private double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  private float nextFloat() throws IOException {   return Float.parseFloat(nextToken());  }  private String nextToken() throws IOException {   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(reader.readLine());   return st.nextToken();  }  private String in = "", out = "";  private BufferedReader reader;  private PrintWriter writer;  private StringTokenizer st; }
3	public class A { public static void main(String args[]) {  Scanner sc = new Scanner (System.in);  int n = sc.nextInt();  int a[] = new int[n+1];  for(int i=1 ; i<=n ; i++) a[i] = sc.nextInt();  int cnt = 0;  for(int i=1 ; i<=n ; i++) {  for(int j=i-1 ; j>=1 ; j--) {   if(a[i]<a[j])   ++cnt;  }  }   int q = sc.nextInt();  cnt = cnt % 2;  while(q-->0) {  int x = sc.nextInt();  int y = sc.nextInt();  int r = y-x+1;  long ok = (r*(r-1))/2;  if(ok%2==0) {     }  else {   cnt ^= 1 ;   }  System.out.println(cnt==0?"even":"odd");  } } }
1	public class Main {  Scanner cin;  int []prime;  int top;  void work()  {   cin=new Scanner(System.in);   int n=cin.nextInt();   int k=cin.nextInt();   top=0;   prime=new int[2000];   for(int i=2;i<=n;i++)   {   if(isprime(i))    prime[top++]=i;   }   int cnt=0;   for(int i=0;i<top;i++)   {   if(cando(prime[i]))    cnt++;   }   if(cnt>=k) System.out.println("YES");   else System.out.println("NO");  }  boolean cando(int n)  {  for(int i=0;i<top-1;i++)  {   if(prime[i]+prime[i+1]+1==n) return true;  }  return false;  }  boolean isprime(int n)  {  for(int i=2;i*i<=n;i++)   if(n%i==0)return false;  return true;  } public static void main(String args[]) throws Exception  {    new Main().work(); }  }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   final int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   final int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   final int[] best = new int[1 << n];   final int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    int bestC = best[set ^ (1 << i)] + single[i];    int prevC = 1 << i;    int nextSet = set ^ (1 << i);    int unoI = 1 << i;    for (int j = i + 1, unoJ = 1 << (i + 1); j < n; ++j, unoJ <<= 1)     if ((set & unoJ) != 0) {      int cur = best[nextSet ^ unoJ] + pair[i][j];      if (cur < bestC) {       bestC = cur;       prevC = unoI | unoJ;      }     }    best[set] = bestC;    prev[set] = prevC;   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
5	public class P220A {  public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int[] a = new int[n];   List<Integer> b = new ArrayList<Integer>(n);   for (int i = 0; i < n; i++)   {    a[i] = sc.nextInt();    b.add(a[i]);   }   Collections.sort(b);   int c = 0;   for (int i = 0; i < n; i++)   {    if (a[i] != b.get(i)) c++;   }   if (c == 0 || c == 2)   {    System.out.println("YES");   }   else   {    System.out.println("NO");   }  } }
4	public class Practice { public static long mod = (long) Math.pow(10, 9) + 7; public static long tt = 0;  public static void main(String[] args) throws Exception {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  int c = 1;  int t = Integer.parseInt(br.readLine());  while (t-- > 0) {  int n = Integer.parseInt(br.readLine());  HashMap<Integer, Integer> map = new HashMap<>();    int curr = 0;  for (int i = 0; i < n; i++) {   int tt = Integer.parseInt(br.readLine());   if (tt == 1) {   curr++;   map.put(curr, 1);   } else {   ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());   Collections.sort(list);   for (int a = list.size() - 1; a >= 0; a--) {    if (map.get(list.get(a)) == tt - 1) {    map.put(list.get(a), tt);    break;    } else {    curr--;    map.remove(list.get(a));    }   }   }   ArrayList<Integer> list = new ArrayList<Integer>(map.keySet());   Collections.sort(list);   StringBuilder str=new StringBuilder();   for(int a=0;a<list.size();a++) {   if(list.size()-1==a) {    str.append(map.get(list.get(a)));    continue;   }   str.append(map.get(list.get(a))+".");   }pw.println(str);   }  }  pw.close(); }        }
6	public class LookingForOrder { static int[][] pos; static int[] dp; static int[] nextstate; static int[][] dist; static int r; static int v;  static void print(int mask) {  if (mask < v) {  int c = 0;  int x = mask ^ nextstate[mask];  for (int i = 0; i < dist.length - 1; i++) {   if((x & (1<<i))>0) {   System.out.print(i+1 + " ");   c++;   }  }  System.out.print("0 ");  print(nextstate[mask]);  } }  static int distace(int x1, int x2, int y1, int y2) {  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); }  static int solve(int mask) {  if (mask == v) {  nextstate[mask] = r;   return 0;  }  if (nextstate[mask] != 0) {  return dp[mask];  }  dp[mask] = (int) 1e9;  for (int i = 1; i < pos.length; i++) {  int u = (1 << (i - 1));  int z = mask | u;  if ((mask & u) == 0) {   int x = 2 * dist[i][0] + solve(z);   if (dp[mask] > x) {   dp[mask] = x;   nextstate[mask] = z;   }   for (int j = 1; j < pos.length; j++) {   int m = (1 << j - 1);   int y = z | m;   if ((z & m) == 0) {    x = dist[i][0] + solve(y) + dist[i][j] + dist[j][0];    if (dp[mask] > x) {    dp[mask] = x;    nextstate[mask]= y;    }    }   }   break;  }  }  return dp[mask]; }  public static void main(String[] args) {  InputReader0 in = new InputReader0(System.in);  int x = in.nextInt(), y = in.nextInt();  int n = in.nextInt();  r = 1 << n;  v = r - 1;  dp = new int[r];  nextstate = new int[r];  pos = new int[n + 1][2];  pos[0][0] = x;  pos[0][1] = y;  for (int i = 1; i < pos.length; i++) {  pos[i][0] = in.nextInt();  pos[i][1] = in.nextInt();  }  dist = new int[n + 1][n + 1];  for (int i = 0; i < dist.length; i++) {  for (int j = i + 1; j < dist.length; j++) {   dist[i][j] = dist[j][i] = distace(pos[i][0], pos[j][0], pos[i][1], pos[j][1]);  }  }  System.out.println(solve(0));  System.out.print("0 ");  print(0); } } class InputReader0 { BufferedReader reader; StringTokenizer tokenizer;  public InputReader0(InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream));  tokenizer = null; }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {   tokenizer = new StringTokenizer(reader.readLine());  } catch (IOException e) {   throw new RuntimeException(e);  }  }  return tokenizer.nextToken(); }  public long nextLong() {  return Long.parseLong(next()); }  public int nextInt() {  return Integer.parseInt(next()); } }
4	public class Main {  public static void main(String args[])  {   FastReader input=new FastReader();   PrintWriter out=new PrintWriter(System.out);   int T=input.nextInt();   while(T-->0)   {    int n=input.nextInt();    int b[]=new int[n];    for(int i=0;i<n;i++)    {     b[i]=input.nextInt();    }    StringBuilder sb=new StringBuilder("");    int arr[]=new int[n+1];    out.println('1');    sb.append('1');    int size=1;    arr[size-1]=1;    for(int i=1;i<n;i++)    {     int a=b[i];     if(a==1)     {      size++;      arr[size-1]=1;      sb.append(".1");      out.println(sb.toString());     }     else     {      sb=new StringBuilder("");      int in=0;      for(int j=size-1;j>=0;j--)      {       if(arr[j]==a-1)       {        in=j;        break;       }      }      for(int j=0;j<in;j++)      {       sb.append(arr[j]+".");      }      sb.append(a);      size=in+1;      arr[size-1]=a;      out.println(sb.toString());     }    }   }   out.close();  }  static class FastReader  {   BufferedReader br;   StringTokenizer st;   public FastReader()   {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next()   {    while (st == null || !st.hasMoreElements())    {     try     {      st = new StringTokenizer(br.readLine());     }     catch (IOException e)     {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt()   {    return Integer.parseInt(next());   }   long nextLong()   {    return Long.parseLong(next());   }   double nextDouble()   {    return Double.parseDouble(next());   }   String nextLine()   {    String str="";    try    {     str=br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  } }
2	public class Main {  static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out);   public static void main(String[] args) {  long n = in.nextLong();  long s = in.nextLong();   if(diff(n) < s) {  System.out.println(0);  out.close();  return;  }   long lo = 1;  long hi = n;  while(lo < hi) {  long mid = lo + (hi - lo) / 2;  if(diff(mid) >= s)   hi = mid;  else   lo = mid + 1;  }  System.out.println(n - lo + 1);   out.close(); }  static long diff(long n) {  char[] ca = (n + "").toCharArray();  int sum = 0;  for(char c : ca)  sum += (c - '0');  return n - sum; } }  class InputReader {  private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars;  public InputReader(InputStream st) {  this.stream = st; }  public int read() {  if (snumChars == -1)  throw new InputMismatchException();  if (curChar >= snumChars) {  curChar = 0;  try {   snumChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (snumChars <= 0)   return -1;  }  return buf[curChar++]; }  public int nextInt() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public long nextLong() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  long res = 0;  do {  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public int[] nextIntArray(int n) {  int a[] = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  return a; }  public String readString() {  int c = read();  while (isSpaceChar(c)) {  c = read();  }  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public String nextLine() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isEndOfLine(c));  return res.toString(); }  public boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  private boolean isEndOfLine(int c) {  return c == '\n' || c == '\r' || c == -1; } }
5	public class Main { public static void main (String[] args) throws IOException {  BufferedReader reader = new BufferedReader (new InputStreamReader (System.in));  String[] splitted = reader.readLine().split(" ");  int n = Integer.parseInt(splitted[0]);  int m = Integer.parseInt(splitted[1]);  int k = Integer.parseInt(splitted[2]);  PriorityQueue<Integer> queue = new PriorityQueue<Integer> (1000, Collections.reverseOrder());  splitted = reader.readLine().split(" ");  for (int ii = 0; ii < splitted.length; ii++) {  queue.add(Integer.parseInt(splitted[ii]));  }   int counter = 0;  int spot = k;  while (spot < m && !queue.isEmpty()) {  spot = spot + queue.poll() - 1;  counter++;  }  if (spot < m) {  System.out.println("-1");  } else {  System.out.println(counter);  } } }
2	public class ReallyBigNumbers1 {   public static void main(String[] args) throws IOException  {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());   PrintWriter out = new PrintWriter(System.out);   long n = Long.parseLong(st.nextToken());   long s = Long.parseLong(st.nextToken());     int r = 0 ;     long l = 0L ;   long u = n ;     if( (l-sumDigits(l)< s ) && (u-sumDigits(u)< s ) )   {    out.println(0);    out.flush();    out.close();    return ;   }     long specified = 0L ;   while( true )   {    long m = (l + u) / 2L ;       if( ( m - sumDigits(m) ) >= s && ( (m-1) - sumDigits(m-1) ) < s )    {     specified = m ;     break ;    }       if( l > u )     break ;       else    {     if( ( m - sumDigits(m) ) >= s )      u = m-1 ;     else      l = m+1 ;    }   }     out.println( n-specified+1 );   out.flush();   out.close();    }   public static int sumDigits(long n)  {   char [] a = (n+"").toCharArray();   int sum = 0 ;   for(int k = 0 ; k < a.length ; k++)   {    sum += Integer.parseInt(a[k]+"") ;   }   return sum ;  }  }
0	public class D implements Runnable { public static void main(String[] args) {  new Thread(new D()).start(); }  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return "0";  }  }  return st.nextToken(); }  public void run() {  try {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  static final double EPS = 1e-9;  static double qEq(double a, double b, double c) {  double d = b * b - 4 * a * c;  if (d < -EPS) {  return Double.NaN;  }  return Math.max((-b + Math.sqrt(d)) / (2 * a), (-b - Math.sqrt(d))   / (2 * a)); }  static int compare(double a, double b) {  return Math.abs(a - b) < EPS ? 0 : Double.compare(a, b); }  void solve() {  double a = nextDouble();  double v = nextDouble();  double l = nextDouble();  double d = nextDouble();  double w = nextDouble();  if (compare(w, v) >= 0) {  double t1 = v / a;  double d1 = a * t1 * t1 * .5;  if (compare(d1, l) >= 0) {   out.println(Math.sqrt(2 * l / a));  } else {   out.println(t1 + (l - d1) / v);  }  return;  }  double t1 = w / a;  double d1 = a * t1 * t1 * .5;  if (compare(d1, d) >= 0) {  double t2 = v / a;  double d2 = a * t2 * t2 * .5;  if (compare(d2, l) >= 0) {   out.println(Math.sqrt(2 * l / a));  } else {   out.println(t2 + (l - d2) / v);  }  return;  }  double left = d - d1;  double timeToV = (v - w) / a;  double distToV = a * timeToV * timeToV * .5 + w * timeToV;     if (compare(distToV, left * .5) >= 0) {  double t2 = qEq(a * .5, w, -left * .5);    t2 += t1 + t2;  if (compare(distToV, l - d) >= 0) {   out.println(t2 + qEq(a * .5, w, d - l));  } else {   out.println(t2 + timeToV + (l - d - distToV) / v);  }  return;  }  double t2 = t1 + 2 * timeToV + (left - 2 * distToV) / v;  if (compare(distToV, l - d) >= 0) {  out.println(t2 + qEq(a * .5, w, d - l));  } else {  out.println(t2 + timeToV + (l - d - distToV) / v);  } } }
0	public class Main implements Runnable {   public static void main(String[] args) {  new Thread(new Main()).start(); }  public void run() {  Locale.setDefault(Locale.US);  try {  run1();  } catch (IOException e) {  throw new RuntimeException();  } }  int nextInt(StreamTokenizer st) throws IOException {  st.nextToken();  return (int) st.nval; }  double nextDouble(StreamTokenizer st) throws IOException {  st.nextToken();  return st.nval; }  String nextLine(StreamTokenizer st) throws IOException {  st.nextToken();  return st.sval; }  Map<String, BigInteger> map = new HashMap<String, BigInteger>();  public void run1() throws IOException {  Locale.setDefault(Locale.US);    Scanner sc = new Scanner(new InputStreamReader(System.in));           double a = sc.nextDouble();  double vmax = sc.nextDouble();  double l2 = sc.nextDouble();  double l1 = sc.nextDouble();  l2 -= l1;  double boundv = sc.nextDouble();  if (boundv >= vmax || boundv * boundv / a / 2 > l1) {  System.out.print(get(0, a, vmax, l1 + l2));  System.exit(0);  }  double tmplen = vmax * vmax / a / 2 + (vmax + boundv) / 2   * (vmax - boundv) / a;  if (tmplen < l1) {  System.out.print(get(boundv, a, vmax, l2) + vmax   / a + (vmax - boundv) / a + (l1 - tmplen) / vmax);  System.exit(0);  }  double v = Math.sqrt(l1 * a + boundv * boundv / 2);  System.out.print(get(boundv, a, vmax, l2) + v / a   + (v - boundv) / a); }  double get(double v0, double a, double vmax, double l) {  double tmplen = (vmax + v0) / 2 * (vmax - v0) / a;   if (l >= tmplen) {  return (vmax - v0) / a + (l - tmplen) / vmax;  }  return (-v0 + Math.sqrt(v0 * v0 + 2 * a * l)) / a; } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB { public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt();   int k = in.nextInt();   int[] a = in.nextIntArray(n);   if (k == 1) {    out.println("1 1");    return;   }   int left = -1, right = -1;   Counter<Integer> counter = new Counter<Integer>();   while (true) {    right++;    if (right == n) {     out.println("-1 -1");     return;    }    counter.add(a[right]);    if (counter.size() >= k)     break;   }   while (true) {    left++;    if (counter.get(a[left]) == 1)     break;    counter.add(a[left], -1);   }   out.printLine(left + 1, right + 1);  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1 << 16];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int nextInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c & 15;    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int[] nextIntArray(int count) {   int[] result = new int[count];   for (int i = 0; i < count; i++) {    result[i] = nextInt();   }   return result;  }  } class OutputWriter {  private PrintWriter writer;  public OutputWriter(OutputStream stream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object obj) {   writer.print(obj);  }  public void println() {   writer.println();  }  public void println(String x) {   writer.println(x);  }  public void print(char c) {   writer.print(c);  }  public void close() {   writer.close();  }  public void printItems(Object... items) {   for (int i = 0; i < items.length; i++) {    if (i != 0) {     print(' ');    }    print(items[i]);   }  }  public void printLine(Object... items) {   printItems(items);   println();  } } class Counter<T> extends HashMap<T, Long> {  public void add(T obj, long count) {   put(obj, get(obj) + count);  }  public void add(T obj) {   put(obj, get(obj) + 1L);  }  public Long get(Object key) {   return containsKey(key) ? super.get(key) : 0L;  } }
5	public class A {   public static void main(String Args[]) throws IOException{   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st;   st = new StringTokenizer(br.readLine());   int n=Integer.valueOf(st.nextToken());   int m=Integer.valueOf(st.nextToken());   int k=Integer.valueOf(st.nextToken());   st = new StringTokenizer(br.readLine());   int sock[] = new int[n];     for (int i=0;i<n;i++){    sock[i]= Integer.valueOf(st.nextToken());   }   Arrays.sort(sock);   m-=k;   int count=0;   int index=sock.length-1;   while(m>0){    if(index<0){     System.out.println("-1");     return;    }    m++;    m-=sock[index];    index--;    count++;   }   System.out.println(count);  }  }
0	public class Main {  private BufferedReader in; private BufferedWriter out;  double time(double a, double l, double v0, double v) {  double t = (v - v0) / a;  double s = a * t * t / 2 + v0 * t;  if (s <= l) {  return t + (l - s) / v;  }  double B = v0, C = -l;  double D = Math.sqrt(B * B - 2 * a * C);  return (-B + D) / a; }   public void solve() throws Exception {  StreamTokenizer st = new StreamTokenizer(in);  st.nextToken();  double a = st.nval;  st.nextToken();  double v = st.nval;  st.nextToken();  double l = st.nval;  st.nextToken();  double d = st.nval;  st.nextToken();  double w = st.nval;  double ttt = Math.sqrt(2 * d / a);  double ans = 0.0;  if (w > v || ttt * a < w) {  ans = time(a, l, 0, v);  } else {  double B = 2 * w / a, C = -w * w / (a * a) - 4 * d / a;  double D = Math.sqrt(B * B - 4 * C);  ans = (-B + D) / 2;  if ((a * ans + w) / 2.0 > v) {   double t1 = v / a;   double t2 = (v - w) / a;   double s = (a * t1 * t1 / 2.0) + (v * t2 - a * t2 * t2 / 2.0);   ans = t1 + t2 + (d - s) / v;  }  ans += time(a, l - d, w, v);  }  DecimalFormat df = new DecimalFormat("0.000000000");  out.write(df.format(ans) + "\n"); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new BufferedWriter(new OutputStreamWriter(System.out));  solve();  out.flush();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public static void main(String[] args) {  try {  Locale.setDefault(Locale.US);  } catch (Exception e) {  }  new Main().run(); } }
3	public class D {  static StringTokenizer st; static BufferedReader br; static PrintWriter pw; public static void main(String[] args) throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = nextInt();  int[]a = new int[n+1];  for (int i = 1; i <= n; i++) {  a[i] = nextInt();  }  int inv = 0;  for (int i = 1; i <= n; i++) {  for (int j = 1; j < i; j++) {   if (a[j] > a[i])   inv++;  }  }  int m = nextInt();  boolean odd = inv % 2==1;  for (int i = 0; i < m; i++) {  int left = nextInt();  int right = nextInt();  long k = right-left+1;  if (k*(k-1)/2 % 2==1)   odd = !odd;  if (odd)   pw.println("odd");  else   pw.println("even");  }  pw.close(); } private static int nextInt() throws IOException {  return Integer.parseInt(next()); } private static long nextLong() throws IOException {  return Long.parseLong(next()); } private static double nextDouble() throws IOException {  return Double.parseDouble(next()); } private static String next() throws IOException {  while (st==null || !st.hasMoreTokens())  st = new StringTokenizer(br.readLine());  return st.nextToken(); } }
0	public class D {  BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof;  double f(int dist, double initSp, int a, int maxSp) {  double distToReachMaxSpeed = 0.5 * (maxSp * maxSp - initSp * initSp)   / a;  if (dist > distToReachMaxSpeed)  return 1d * (maxSp - initSp) / a + (dist - distToReachMaxSpeed)   / maxSp;  return (Math.sqrt(initSp * initSp + 2 * a * dist) - initSp) / a; }  void solve() throws IOException {  int a = nextInt();  int maxSp = nextInt();  int len = nextInt();  int signX = nextInt();  int signSp = nextInt();  if (maxSp <= signSp) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachSignSp = 0.5 * signSp * signSp / a;  if (distToReachSignSp >= signX) {  out.printf("%.9f\n", f(len, 0, a, maxSp));  return;  }  double distToReachMaxThenSign = 0.5   * (maxSp * maxSp + maxSp * maxSp - signSp * signSp) / a;  if (distToReachMaxThenSign <= signX) {  double t = 1d * (2 * maxSp - signSp) / a   + (signX - distToReachMaxThenSign) / maxSp   + f(len - signX, signSp, a, maxSp);  out.printf("%.9f\n", t);  return;  }   double xSp = Math.sqrt(a * signX + signSp * signSp * 0.5);  double xTime = (2 * xSp - signSp) / a;  out.printf("%.9f\n", xTime + f(len - signX, signSp, a, maxSp)); }  void inp() throws IOException {  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close(); }  public static void main(String[] args) throws IOException {  new D().inp(); }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (Exception e) {   eof = true;   return null;  }  }  return st.nextToken(); }  String nextString() {  try {  return br.readLine();  } catch (IOException e) {  eof = true;  return null;  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
4	public class Main {  static final long MOD = 1000000007L;      static final int INF = 1000000005;  static final int NINF = -1000000005;   static FastScanner sc;  static PrintWriter pw;  static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}};   public static void main(String[] args) {   sc = new FastScanner();   pw = new PrintWriter(System.out);    int Q = sc.ni();   for (int q = 0; q < Q; q++) {    int N = sc.ni();    int[] nums = sc.intArray(N, 0);    pw.println(1);    ArrayDeque<Integer> ad = new ArrayDeque<Integer>();    ad.push(1);    for (int i = 1; i < N; i++) {     if (nums[i]==1) {      ad.push(1);     } else {      while (!ad.isEmpty()) {       int d = ad.pop();       if (d==nums[i]-1) {        ad.push(nums[i]);        break;       }      }     }     printAD(ad);    }   }   pw.close();  }  public static void printAD(ArrayDeque<Integer> v) {   Object[] arr = v.toArray();   for (int i = arr.length-1; i >= 0; i--) {    pw.print(arr[i]);    if (i>0) pw.print(".");   }   pw.println();  }   public static void sort(int[] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    int temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr);  }   public static void sort(long[] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    long temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr);  }    public static void sort(int[][] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    int[] temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr, new Comparator<int[]>() {    @Override    public int compare(int[] a, int[] b) {     return a[0]-b[0];    }   });  }   public static void sort(long[][] arr) {   Random rgen = new Random();   for (int i = 0; i < arr.length; i++) {    int r = rgen.nextInt(arr.length);    long[] temp = arr[i];    arr[i] = arr[r];    arr[r] = temp;   }   Arrays.sort(arr, new Comparator<long[]>() {    @Override    public int compare(long[] a, long[] b) {     if (a[0] > b[0])      return 1;     else if (a[0] < b[0])      return -1;     else      return 0;        }   });  }   static class FastScanner {   BufferedReader br;   StringTokenizer st;    public FastScanner() {    br = new BufferedReader(new InputStreamReader(System.in), 32768);    st = null;   }    String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }    int ni() {    return Integer.parseInt(next());   }    int[][] graph(int N, int[][] edges) {    int[][] graph = new int[N][];    int[] sz = new int[N];    for (int[] e: edges) {     sz[e[0]] += 1;     sz[e[1]] += 1;    }    for (int i = 0; i < N; i++) {     graph[i] = new int[sz[i]];    }    int[] cur = new int[N];    for (int[] e: edges) {     graph[e[0]][cur[e[0]]] = e[1];     graph[e[1]][cur[e[1]]] = e[0];     cur[e[0]] += 1;     cur[e[1]] += 1;    }    return graph;   }    int[] intArray(int N, int mod) {    int[] ret = new int[N];    for (int i = 0; i < N; i++)     ret[i] = ni()+mod;    return ret;   }    char[] charArray(int N) {    char[] ret = new char[N];    for (int i = 0; i < N; i++)     ret[i] = next().charAt(0);    return ret;   }    long nl() {    return Long.parseLong(next());   }    long[] longArray(int N, long mod) {    long[] ret = new long[N];    for (int i = 0; i < N; i++)     ret[i] = nl()+mod;    return ret;   }    double nd() {    return Double.parseDouble(next());   }    String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  } }
6	public class CF8C { FastScanner in; PrintWriter out;  int[] x, y; int[] av; int[][] d = new int[25][25];  int dist(int v, int u) {  if (u == v)  return 0;  return (d[v][u] == 0 ? d[v][u] = d[u][v] = (x[v] - x[u])   * (x[v] - x[u]) + (y[v] - y[u]) * (y[v] - y[u]) : d[v][u]); }  void add(int x) {  av[++av[0]] = x; }  int size() {  return av[0]; }  int get(int i) {  return av[i + 1]; }  int N = 24; int[] dp = new int[(1 << N)]; int[] dpFrom = new int[1 << N];  void solve() {  int x1 = in.nextInt();  int y1 = in.nextInt();  int n = in.nextInt();  x = new int[n + 1];  y = new int[n + 1];  for (int i = 1; i <= n; i++) {  x[i] = in.nextInt();  y[i] = in.nextInt();  }  x[0] = x1;  y[0] = y1;  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;  av = new int[n + 1];  for (int i = 0; i <= n; i++)  for (int j = 0; j <= n; j++)   dist(i, j);  for (int st = 0; st < (1 << n); st++) {  if (dp[st] == Integer.MAX_VALUE)   continue;  av[0] = 0;  for (int i = 0; i < n; i++)   if ((st & (1 << i)) == 0)   add(i);  if (av[0] == 0)   continue;  for (int i = 0; i < 1; i++)   for (int j = i + 1; j < av[0]; j++) {   int val = dp[st] + d[get(i) + 1][0]    + d[get(j) + 1][0]    + d[get(i) + 1][get(j) + 1];   if (dp[st | (1 << get(i)) | (1 << get(j))] > val) {    dp[st | (1 << get(i)) | (1 << get(j))] = val;    dpFrom[st | (1 << get(i)) | (1 << get(j))] = st;   }   }  for (int i = 0; i < 1; i++) {   int val = dp[st] + d[get(i) + 1][0] * 2;   if (dp[st | (1 << get(i))] > val) {   dp[st | (1 << get(i))] = val;   dpFrom[st | (1 << get(i))] = st;   }  }  }  out.println(dp[(1 << n) - 1]);  int nowSt = (1 << n) - 1;  ArrayList<Integer> ans = new ArrayList<Integer>();  ans.add(0);  while (nowSt != 0) {  int newSt = dpFrom[nowSt];  for (int i = 0; i < n; i++)   if (((1 << i) & nowSt) == (1 << i))   if (((1 << i) & newSt) == 0)    ans.add(i + 1);  ans.add(0);  nowSt = newSt;  }  for (int i = ans.size() - 1; i >= 0; i--)  out.print(ans.get(i) + " "); }  void run() {  try {  in = new FastScanner(new File("object.in"));  out = new PrintWriter(new File("object.out"));   solve();   out.close();  } catch (FileNotFoundException e) {  e.printStackTrace();  } }  void runIO() {  in = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  out.close(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  public FastScanner(InputStream f) {  br = new BufferedReader(new InputStreamReader(f));  }  String next() {  while (st == null || !st.hasMoreTokens()) {   String s = null;   try {   s = br.readLine();   } catch (IOException e) {   e.printStackTrace();   }   if (s == null)   return null;   st = new StringTokenizer(s);  }  return st.nextToken();  }  boolean hasMoreTokens() {  while (st == null || !st.hasMoreTokens()) {   String s = null;   try {   s = br.readLine();   } catch (IOException e) {   e.printStackTrace();   }   if (s == null)   return false;   st = new StringTokenizer(s);  }  return true;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  } }  public static void main(String[] args) {  new CF8C().runIO(); } }
1	public class B {  public static PrintStream out = System.out;  public static InputReader in = new InputReader(System.in);  static class Node implements Comparable<Node> {   int res;   Node(int pp) {    p = pp;   }   int p;   @Override   public int compareTo(Node n) {    return Integer.compare(p, n.p);   }   @Override   public boolean equals(Object o) {    return p == ((Node) o).p;   }  }  public static void main(String args[]) {   int N, a, b;   N = in.nextInt();   int[] label;   a = in.nextInt();   b = in.nextInt();   if (a < b) {    label = new int[] {0, 1};   } else {    int tmp = a;    a = b;    b = tmp;    label = new int[] {1, 0};   }   Node[] nodes = new Node[N];   for (int i = 0; i < N; i++) {    nodes[i] = new Node(in.nextInt());   }   TreeSet<Node> ts = new TreeSet<>();   for (int i = 0; i < N; i++) {    ts.add(nodes[i]);   }   while (!ts.isEmpty()) {    Node n = ts.first();    Node an = new Node(a - n.p);    Node bn = new Node(b - n.p);    SortedSet<Node> ats = ts.tailSet(an);    SortedSet<Node> bts = ts.tailSet(bn);    Node an2 = ats.isEmpty() ? null : ats.first();    Node bn2 = bts.isEmpty() ? null : bts.first();    Node n2 = null;    int l = 0;    if (bn2 != null && bn2.equals(bn)) {     n2 = bn2;     l = label[1];    } else if (an2 != null && an2.equals(an)) {     n2 = an2;     l = label[0];    } else {     NO();    }    if (!n.equals(n2)) {     ts.remove(n);     n.res = l;    }    ts.remove(n2);    n2.res = l;   }   out.println("YES");   for (int i = 0; i < nodes.length; i++) {    if (i != 0) out.print(" ");    out.print(nodes[i].res);   }   out.println();  }  static void NO() {   out.println("NO");   System.exit(0);  } } class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null;  }  public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {  tokenizer = new StringTokenizer(reader.readLine());  } catch (IOException e) {  throw new RuntimeException(e);  } } return tokenizer.nextToken();  }  public double nextDouble() { return Double.parseDouble(next());  }  public long nextLong() { return Long.parseLong(next());  }  public int nextInt() { return Integer.parseInt(next());  } }
1	public class C {  public static void main(String[] args) throws Exception {   BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));     PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int n = Integer.parseInt(bf.readLine());   int counter = 0;   for(int i=0; i<2*n/3; i++) System.out.println("0 " + i);   for(int i=0; i<n-2*n/3; i++) System.out.println("3 " + (2*i+1));  } }
1	public class AB {  private InputStream input;  private PrintStream output;  private Scanner inputSc;  public AB(InputStream input, PrintStream output) {   this.input = input;   this.output = output;   init();  }  private void init() {   inputSc = new Scanner(input);  }  static int lineToInt(String line) {   return Integer.parseInt(line);  }  static long lineToLong(String line) {   return Long.parseLong(line);  }  static double lineToDouble(String line) {   return Double.parseDouble(line);  }   public void solve()  {    solveTestCase();  }   HashMap<Integer,Integer> mat ; long dist[] ; int vec[] ; int ar[] ; Set<Integer> st ; boolean isDone[] ; final long INF = 100000000000000000L ; @SuppressWarnings("unchecked")  private void solveTestCase()  {  int i , j , k , n , m , d , l ,b , p , q , r;  long N , M, K;  int x1 , y1 , x2 , y2 ,x;  int a1,a2,b1,b2,a ;  DecimalFormat df = new DecimalFormat("#,###,##0.00");   String str = inputSc.nextLine();   String delims = "[ ]+";  String tokens[] = str.split(delims);  n = lineToInt(tokens[0]);  a = lineToInt(tokens[1]);  b = lineToInt(tokens[2]);  mat = new HashMap<Integer,Integer>() ;  st = new TreeSet<Integer>();  ar = new int[n+4] ;  vec = new int[n+4] ;  str = inputSc.nextLine();  tokens = str.split(delims);  for( i = 1 ; i <= n ; i++ )  {  ar[i] = lineToInt(tokens[i-1]);  mat.put(ar[i],i) ;  st.add(ar[i]);  vec[i] = i ;  }  vec[n+1] = n+1 ;  vec[n+2] = n+2 ;  for( i = 1 ; i <= n ; i++ )  {  x= ar[i];    if(st.contains(a-x))  {   Bing(mat.get(x),mat.get(a-x));  }  else   Bing(n+1 , mat.get(x));  if(st.contains(b-x))  {   Bing(mat.get(x),mat.get(b-x));  }  else   Bing(n+2 , mat.get(x));  }  if(find(n+1)==find(n+2))  {  output.println("NO");  return ;  }  output.println("YES");  for( i =1 ; i<= n ; i ++ )  {  if(find(i)==find(n+1))   output.print("1 ");  else   output.print("0 ");  }  output.println();   } int find(int x) { if(x==vec[x]) return x; return vec[x]=find(vec[x]); } void Bing(int a,int b) { int A=find(a);int B=find(b); if(A==B) return ; vec[B]=A; }    public static void main(String[] args)  {  FileInputStream in = null;   FileOutputStream out = null;  PrintStream ps = null ;  InputStream is = null ;  try  {    is = new FileInputStream("file.in");    out = new FileOutputStream("file.out");  ps = new PrintStream(out);   }  catch ( Exception e )  {}   AB sd = new AB(System.in, System.out);   sd.solve();  try  {   if (is != null)  {   is.close();  }   if (out != null) {    out.close();   }  if (ps != null) {    ps.close();   }   }catch (Exception e){}      } }
1	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  int n = nextInt();  int k = nextInt();  ArrayList<Integer> ps = new ArrayList<Integer>();  boolean[] prime = new boolean[n + 1];  Arrays.fill(prime, true);  prime[0] = prime[1] = false;  for (int i = 2; i <= n; ++i) {  if (prime[i]) {   ps.add(i);   for (int j = 2 * i; j <= n; j += i) {   prime[j] = false;   }  }  }  for (int i = 0; i < ps.size() - 1; ++i) {  int t = ps.get(i) + ps.get(i + 1) + 1;  if (t <= n && prime[t]) {   --k;  }  }  out.println(k <= 0 ? "YES" : "NO"); }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   solve();   in.close();  out.close(); }  private void eat(String str) {  st = new StringTokenizer(str); }  String next() throws IOException {  while (!st.hasMoreTokens()) {  String line = in.readLine();  if (line == null) {   return null;  }  eat(line);  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  new Solution(); } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) {        int n = in.nextInt();   int a[] = in.nextIntArray(n);   int i,j,k;   int b[] = a.clone();   ArrayUtils.randomShuffle(a);   Arrays.sort(a);     int c[] = new int[n];   k=0;   for(i=0;i<n;++i) if(a[i]!=b[i]) c[k++] = i;     String res = "NO";   if(k==0){    res = "YES";   }else   if(k==1){      }else   if(k==2){    i = c[0]; j = c[1];    if(a[i]==b[j] && a[j]==b[i]) res = "YES";   }     out.writeln(res); } } class InputReader{  private BufferedReader reader;  private StringTokenizer tokenizer;   public InputReader(InputStream stream){   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }   public String next(){   while(tokenizer==null || !tokenizer.hasMoreTokens()){    try{     tokenizer = new StringTokenizer(reader.readLine());    }catch(Exception e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }   public int nextInt(){   return Integer.parseInt(next());  }  public int[] nextIntArray(int size){   int array[] = new int[size];   for(int i=0; i<size; ++i) array[i] = nextInt();   return array;  } } class OutputWriter{  private PrintWriter out;   public OutputWriter(Writer out){   this.out = new PrintWriter(out);  }  public OutputWriter(OutputStream out){   this.out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)));  }   public void close(){   out.flush();   out.close();  }  public void writeln(Object ... o){   for(Object x : o) out.print(x);   out.println();  } } class ArrayUtils{  private final static Random random = new Random(System.nanoTime());   public static void randomShuffle(int a[]){   int n = a.length;   for(int i=0;i<n;++i){    int j = random.nextInt(n-i);    int t = a[i]; a[i] = a[j]; a[j] = t;   }  } }
0	public class Main {  public static void main(String[] args) {   Scanner sc =new Scanner(System.in);   long r,l;   r = sc.nextLong();   l = sc.nextLong();     if ((r+2)>l) { System.out.print("-1"); return;}    if ((r % 2) == 0) {    System.out.print(r);     System.out.print(" ");     System.out.print(r+1);     System.out.print(" ");     System.out.print(r+2);return; }     if((r+3)<=l )     { System.out.print(r+1);     System.out.print(" ");     System.out.print(r+2);     System.out.print(" ");     System.out.print(r+3);return; }    System.out.print("-1");   } }
6	public class Main { public static void main(String[] args) throws IOException {  new Thread(null, new Runnable() {  public void run() {   try {   long prevTime = System.currentTimeMillis();   new Main().run();   System.err.println("Total time: "    + (System.currentTimeMillis() - prevTime) + " ms");   System.err.println("Memory status: " + memoryStatus());   } catch (IOException e) {   e.printStackTrace();   }  }  }, "1", 1L << 24).start(); }  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  Object o = solve();  if (o != null)  out.println(o);  out.close();  in.close(); }  int n; Point[] ps; int[] dp;  private Object solve() throws IOException {  int o_x = ni();  int o_y = ni();  n = ni();  ps = new Point[n];  for (int i = 0; i < n; i++)  ps[i] = new Point(ni() - o_x, ni() - o_y);  dp = new int[1 << n];  Arrays.fill(dp, Integer.MAX_VALUE);  dp[0] = 0;  int[] path_x = new int[1 << n];  int[] path_y = new int[1 << n];   for (int mask = 1; mask < (1 << n); mask++) {  int i = min(mask);  int min_val = dp[mask - (1 << i)] + 2 * ps[i].norm;  if (min_val < dp[mask]) {   dp[mask] = min_val;   path_x[mask] = i;   path_y[mask] = i;     }  for (int j = i + 1; j < n; j++)   if ((mask & (1 << j)) != 0) {   int newMask = mask - (1 << i) - (1 << j);   int val = dp[newMask] + ps[i].norm + ps[j].norm    + ps[i].dist(ps[j]);   if (val < dp[mask]) {    dp[mask] = val;    path_x[mask] = i;    path_x[mask] = j;       }   }  }  pln(dp[(1 << n) - 1]);  int maskPath = (1 << n) - 1;  LinkedList<Long> list = new LinkedList<Long>();  while (maskPath != 0) {  long x = path_x[maskPath];  long y = path_y[maskPath];    list.addFirst(0L);  list.addFirst(y + 1);  maskPath -= (1 << y);  if (x != y) {   list.addFirst(x + 1);   maskPath -= 1 << x;  }  }  list.addFirst(0L);  show(list);  return null; }  private int min(int mask) {  int ret = 0;  while (mask % 2 == 0) {  mask /= 2;  ret++;  }  return ret; }  private void show(LinkedList<Long> list) {  int index = 0;  for (long a : list) {  if (index == 0) {   p(a);  } else {   p(" " + a);  }  index++;  }  pln(); }  class Point {  int x;  int y;  int norm;  public Point(int x, int y) {  this.x = x;  this.y = y;  this.norm = x * x + y * y;  }  public int dist(Point other) {  int dx = (x - other.x);  int dy = (y - other.y);   return dx * dx + dy * dy;  }  @Override  public String toString() {  return "Point [x=" + x + ", y=" + y + ", norm=" + norm + "]";  }  }  BufferedReader in; PrintWriter out; StringTokenizer strTok = new StringTokenizer("");  String nextToken() throws IOException {  while (!strTok.hasMoreTokens())  strTok = new StringTokenizer(in.readLine());  return strTok.nextToken(); }  int ni() throws IOException {  return Integer.parseInt(nextToken()); }  long nl() throws IOException {  return Long.parseLong(nextToken()); }  double nd() throws IOException {  return Double.parseDouble(nextToken()); }  int[] nia(int size) throws IOException {  int[] ret = new int[size];  for (int i = 0; i < size; i++)  ret[i] = ni();  return ret; }  long[] nla(int size) throws IOException {  long[] ret = new long[size];  for (int i = 0; i < size; i++)  ret[i] = nl();  return ret; }  double[] nda(int size) throws IOException {  double[] ret = new double[size];  for (int i = 0; i < size; i++)  ret[i] = nd();  return ret; }  String nextLine() throws IOException {  strTok = new StringTokenizer("");  return in.readLine(); }  boolean EOF() throws IOException {  while (!strTok.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  strTok = new StringTokenizer(s);  }  return false; }  void printRepeat(String s, int count) {  for (int i = 0; i < count; i++)  out.print(s); }  void printArray(int[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(long[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.print(array[i]);  }  out.println(); }  void printArray(double[] array, String spec) {  for (int i = 0; i < array.length; i++) {  if (i > 0)   out.print(' ');  out.printf(Locale.US, spec, array[i]);  }  out.println(); }  void printArray(Object[] array) {  boolean blank = false;  for (Object x : array) {  if (blank)   out.print(' ');  else   blank = true;  out.print(x);  }  out.println(); }  @SuppressWarnings("rawtypes") void printCollection(Collection collection) {  boolean blank = false;  for (Object x : collection) {  if (blank)   out.print(' ');  else   blank = true;  out.print(x);  }  out.println(); }  static String memoryStatus() {  return (Runtime.getRuntime().totalMemory()   - Runtime.getRuntime().freeMemory() >> 20)   + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB"; }  public void pln() {  out.println(); }  public void pln(int arg) {  out.println(arg); }  public void pln(long arg) {  out.println(arg); }  public void pln(double arg) {  out.println(arg); }  public void pln(String arg) {  out.println(arg); }  public void pln(boolean arg) {  out.println(arg); }  public void pln(char arg) {  out.println(arg); }  public void pln(float arg) {  out.println(arg); }  public void pln(Object arg) {  out.println(arg); }  public void p(int arg) {  out.print(arg); }  public void p(long arg) {  out.print(arg); }  public void p(double arg) {  out.print(arg); }  public void p(String arg) {  out.print(arg); }  public void p(boolean arg) {  out.print(arg); }  public void p(char arg) {  out.print(arg); }  public void p(float arg) {  out.print(arg); }  public void p(Object arg) {  out.print(arg); } }
1	public class Main { int work(int x){  if(x%2==0)return x+1;  else return x-1; } static int N = 200050; class Node implements Comparable <Node>{  int x, id;  Node(int x, int id){  this.x = x; this.id = id;  }  public int compareTo(Node o){  return Integer.compare(x, o.x);  }  public String toString(){  return id + "=" + x;  } } class Edge{  int from, to, nex;  Edge (int from, int to, int nex){  this.from = from;  this.to = to;  this.nex = nex;  } } Edge[] edge = new Edge[N*10]; int[] head = new int[N]; int edgenum;  void addedge(int u, int v){   Edge E = new Edge(u, v, head[u]);   edge[edgenum] = E;   head[u] = edgenum ++;  }   int n; int[] p = new int[N], ans = new int[N]; int a, b, max;  Map<Integer, Integer> map = new HashMap();  boolean match(int x, int y, int col){  int P = map.get(x);  if(map.containsKey(y-x) == false)   return false;  int Q = map.get(y - x);  if(ans[Q] == -1 || x * 2 == y){   ans[Q] = ans[P] = col;  }  else {   if(match(a+b-2*y+x, y, col))   ans[Q] = ans[P] = col;    else return false;  }  return true;  }  boolean solve(){  if(max >= a && max >= b)return false;  for(int i = 1; i <= n; i++)   if(ans[i] == -1)   {   if(match(p[i], a, 0)==false && match(p[i], b, 1) == false)    return false;   }    return true;  } void init(){  n = cin.nextInt();  a = cin.nextInt(); b = cin.nextInt();  max = 0;  for(int i = 1; i <= n; i++){  ans[i] = -1;  p[i] = cin.nextInt();  map.put(p[i], i);  if(p[i] > max) max = p[i];  } } public void work(){  init();  if(solve()){  out.println("YES");  for(int i = 1; i <= n; i++)out.print(ans[i]+" "); out.println();  }  else   out.println("NO"); } Main() {   cin = new Scanner(System.in);   out = new PrintWriter(System.out);  }  public static void main(String[] args) {   Main e = new Main();   e.work();   out.close();  }  public Scanner cin;  public static PrintWriter out; }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.readIntArray(n);    long count = 0;    for (int i = 1; i < n; i++) {     for (int j = 0; j < i; j++) {      if (a[j] > a[i]) count++;     }    }    boolean even = count % 2 == 0 ? true : false;    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int left = in.nextInt();     int right = in.nextInt();     int diff = right - left;     if ((diff % 4 == 1) || (diff % 4 == 2)) {      even = !even;     }     if (even) {      out.println("even");     } else {      out.println("odd");     }    }   }  }  static class InputReader {   private static BufferedReader in;   private static StringTokenizer tok;   public InputReader(InputStream in) {    this.in = new BufferedReader(new InputStreamReader(in));   }   public int nextInt() {    return Integer.parseInt(next());   }   public int[] readIntArray(int n) {    int[] ar = new int[n];    for (int i = 0; i < n; i++) {     ar[i] = nextInt();    }    return ar;   }   public String next() {    try {     while (tok == null || !tok.hasMoreTokens()) {      tok = new StringTokenizer(in.readLine());          }    } catch (IOException ex) {     System.err.println("An IOException was caught :" + ex.getMessage());    }    return tok.nextToken();   }  } }
4	public class EdF { static long[] mods = {1000000007, 998244353, 1000000009}; static long mod = mods[0]; public static MyScanner sc;  public static PrintWriter out; public static void main(String[] havish) throws Exception{    sc = new MyScanner();  out = new PrintWriter(System.out);  int t = sc.nextInt();  while(t-->0) {   int n = sc.nextInt();      Stack<Integer> st = new Stack<>();   Stack<Integer> temporary = new Stack<>();   for(int j = 0;j<n;j++){    int val = sc.nextInt();    boolean found = false;    while(!st.isEmpty()){    int temp = st.peek();    if (val == temp+1){     found = true;     st.pop();     break;    }    else{     temporary.add(st.pop());    }    }    if (!found){    while(!temporary.isEmpty()){     st.add(temporary.pop());    }    }    st.add(val);    ArrayList<Integer> arr = new ArrayList<>();       for(int s : st){    arr.add(s);    }    for (int s =0 ;s<arr.size()-1;s++){    out.print(arr.get(s));    out.print(".");    }    out.println(arr.get(arr.size()-1));    temporary.clear();   }     }    out.close();    }  public static void sort(int[] array){  ArrayList<Integer> copy = new ArrayList<>();  for (int i : array)  copy.add(i);  Collections.sort(copy);  for(int i = 0;i<array.length;i++)  array[i] = copy.get(i); } static String[] readArrayString(int n){  String[] array = new String[n];  for(int j =0 ;j<n;j++)  array[j] = sc.next();  return array; } static int[] readArrayInt(int n){  int[] array = new int[n];  for(int j = 0;j<n;j++)   array[j] = sc.nextInt();  return array;  } static int[] readArrayInt1(int n){  int[] array = new int[n+1];  for(int j = 1;j<=n;j++){  array[j] = sc.nextInt();  }  return array; } static long[] readArrayLong(int n){  long[] array = new long[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextLong();  return array; } static double[] readArrayDouble(int n){  double[] array = new double[n];  for(int j =0 ;j<n;j++)  array[j] = sc.nextDouble();  return array; } static int minIndex(int[] array){  int minValue = Integer.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(long[] array){  long minValue = Long.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static int minIndex(double[] array){  double minValue = Double.MAX_VALUE;  int minIndex = -1;  for(int j = 0;j<array.length;j++){  if (array[j] < minValue){   minValue = array[j];   minIndex = j;  }  }  return minIndex; } static long power(long x, long y){  if (y == 0)  return 1;  if (y%2 == 1)  return (x*power(x, y-1))%mod;  return power((x*x)%mod, y/2)%mod; } static void verdict(boolean a){   out.println(a ? "YES" : "NO");  }  public static class MyScanner {   BufferedReader br;   StringTokenizer st;   public MyScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try{     str = br.readLine();    }    catch (IOException e) {     e.printStackTrace();    }    return str;   }    } }
6	public class C0008 {  public static void main(String args[]) throws Exception {   new C0008();  }  int n;  int target;  int pow[];  int dp[];  int next[];  int dist[][];  C0008() throws Exception {   PandaScanner sc = null;   PrintWriter out = null;   try {    sc = new PandaScanner(System.in);    out = new PrintWriter(System.out);   } catch (Exception ignored) {   }   pow = new int[26];   for (int i = 0; i < 26; i++) {    pow[i] = 1 << i;   }   dist = new int[26][26];   int[][] p = new int[26][];   p[25] = new int[] {sc.nextInt(), sc.nextInt()};   n = sc.nextInt();   target = (1 << n) - 1;   for (int i = 0; i < n; i++) {    p[i] = new int[] {sc.nextInt(), sc.nextInt()};    dist[i][25] = getDist(p[i], p[25]);    for (int j = 0; j < i; j++) {     dist[j][i] = getDist(p[j], p[i]);    }   }   next = new int[1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(go(0));   ArrayList<Integer> paths = new ArrayList<Integer>();   paths.add(0);   int curr = 0;   while (curr != target) {    for (Integer i: getBits(next[curr], true)) {     paths.add(i + 1);    }    paths.add(0);    curr |= next[curr];   }   out.println(paths.toString().replaceAll("[^ 0-9]", ""));   out.close();   System.exit(0);  }  int go(int mask) {   if (mask == target) {    return 0;   }   if (dp[mask] != -1) {    return dp[mask];   }   ArrayList<Integer> notDone = getBits(mask, false);   dp[mask] = Integer.MAX_VALUE;   for (Integer i: notDone) {    int oneD = (dist[i][25] << 1) + go(mask | pow[i]);    if (dp[mask] > oneD) {     dp[mask] = oneD;     next[mask] = 1 << i;    }    for (Integer j: notDone) {     if (j == i) continue;     int d = (dist[j][25] + dist[i][j] + dist[i][25]) + go(mask | pow[i] | pow[j]);     if (dp[mask] > d) {      dp[mask] = d;      next[mask] = (1 << i) | (1 << j);     }    }    break;   }   return dp[mask];  }  int getDist(int[] p1, int[] p2) {   return sq(p1[0] - p2[0]) + sq(p1[1] - p2[1]);  }  int sq(int a) {   return a * a;  }  ArrayList<Integer> getBits(int mask, boolean on) {   ArrayList<Integer> res = new ArrayList<Integer>();   for (int i = 0; i < n; i++) {    if (((mask & (1 << i)) == 0) ^ on) {     res.add(i);    }   }   return res;  }    public class PandaScanner {   BufferedReader br;   StringTokenizer st;   InputStream in;   PandaScanner(InputStream in) throws Exception {    br = new BufferedReader(new InputStreamReader(this.in = in));   }   public String next() throws Exception {    if (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine().trim());     return next();    }    return st.nextToken();   }   public boolean hasNext() throws Exception {    return (st != null && st.hasMoreTokens()) || in.available() > 0;   }   public long nextLong() throws Exception {    return Long.parseLong(next());   }   public int nextInt() throws Exception {    return Integer.parseInt(next());   }  } }
2	public class C {   public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long s = sc.nextLong();     BigInteger k = findFirst(BigInteger.valueOf(s));   if (BigInteger.valueOf(n).compareTo(k) >= 0)   {    System.out.println(n - k.longValue() + 1);   }   else   {    System.out.println("0");   }  }   public static BigInteger findFirst(BigInteger s)  {   BigInteger b = BigInteger.ZERO;   while (cd(b).compareTo(b.subtract(s)) > 0)   {    BigInteger c = BigInteger.ONE;    while (cd(b.add(c)).compareTo(b.add(c).subtract(s)) > 0) {     c = c.multiply(BigInteger.TEN);    }       c = c.divide(BigInteger.TEN);    if (c.compareTo(BigInteger.TEN) < 0) c = BigInteger.TEN;    b = b.add(c);   }   return b;  }   public static BigInteger cd(BigInteger n)  {   BigInteger t = BigInteger.ZERO;   while (n.compareTo(BigInteger.ZERO) > 0)   {    t = t.add(n.mod(BigInteger.TEN));    n = n.divide(BigInteger.TEN);   }   return t;  } }
0	public class A {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long l = sc.nextLong();  long h = sc.nextLong();   sc.close();   if(h-l<2) {  System.out.println(-1);  return ;  }   if(h-l==2 && l%2==1) {  System.out.println(-1);  return ;  }   if(l%2==1) {  ++l;  }   System.out.printf("%d %d %d\n",l,l+1L,l+2L); } }
5	public class Main{  public static void main(String[] args) throws Exception {   Parserdoubt12 s = new Parserdoubt12(System.in);     int n = s.nextInt();     int a[] = new int[n];   for (int i = 0; i < n; i++) {    a[i] = s.nextInt();   }     int copy[] = a.clone();   Arrays.sort(a);   int count = 0;   for (int i = 0; i < copy.length; i++) {    if(a[i] != copy[i]) count++;   }   if(count <= 2) System.out.println("YES");   else System.out.println("NO");  }    }  class Parserdoubt12 {  final private int BUFFER_SIZE = 1 << 17;   private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Parserdoubt12(InputStream in)  {  din = new DataInputStream(in);  buffer = new byte[BUFFER_SIZE];  bufferPointer = bytesRead = 0;  }  public String nextString() throws Exception  {   StringBuffer sb=new StringBuffer("");   byte c = read();   while (c <= ' ') c = read();   do   {    sb.append((char)c);    c=read();   }while(c>' ');   return sb.toString();  }  public char nextChar() throws Exception  {   byte c=read();   while(c<=' ') c= read();   return (char)c;  }  public int nextInt() throws Exception  {  int ret = 0;  byte c = read();  while (c <= ' ') c = read();  boolean neg = c == '-';  if (neg) c = read();  do  {   ret = ret * 10 + c - '0';   c = read();  } while (c > ' ');  if (neg) return -ret;  return ret;  }  public long nextLong() throws Exception  {  long ret = 0;  byte c = read();  while (c <= ' ') c = read();  boolean neg = c == '-';  if (neg) c = read();  do  {   ret = ret * 10 + c - '0';   c = read();  } while (c > ' ');  if (neg) return -ret;  return ret;  }  private void fillBuffer() throws Exception  {  bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);  if (bytesRead == -1) buffer[0] = -1;  }   private byte read() throws Exception  {  if (bufferPointer == bytesRead) fillBuffer();  return buffer[bufferPointer++];  } }
3	public class code5 { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; static int dx[]={0,0,1,-1},dy[]={1,-1,0,0}; String arr[]; long dp[][]; void solve() throws IOException {  int n=ni();  int a[]=na(n);  int q=ni();  boolean flag=false;  for(int i=0;i<n;i++)  {  for(int j=0;j<i;j++)  {   if(a[j]>a[i])   flag^=true;  }  }  while(q--!=0)  {  int l=ni()-1;  int r=ni()-1;  int num=(r-l+1);  int tot=num*(num-1)/2;  if(tot%2==1)   flag^=true;  if(flag)   out.println("odd");  else   out.println("even");   } } int sum(int i) {  int sum=0;  while(i!=0)  {  if((i%10)%2==1)   sum+=i%10;  i/=10;  }  return sum; } ArrayList<Integer> al[];  void take(int n,int m)  {  al=new ArrayList[n];  for(int i=0;i<n;i++)   al[i]=new ArrayList<Integer>();  for(int i=0;i<m;i++)  {   int x=ni()-1;   int y=ni()-1;   al[x].add(y);   al[y].add(x);  }  }  int check(long n)  {  int count=0;  while(n!=0)  {   if(n%10!=0)   break;   n/=10;   count++;  }  return count;  } public static int count(int x) {  int num=0;  while(x!=0)  {  x=x&(x-1);  num++;  }  return num; } static long d, x, y; void extendedEuclid(long A, long B) {  if(B == 0) {   d = A;   x = 1;   y = 0;  }  else {   extendedEuclid(B, A%B);   long temp = x;   x = y;   y = temp - (A/B)*y;  } } long modInverse(long A,long M)  {  extendedEuclid(A,M);  return (x%M+M)%M;  } public static void mergeSort(int[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(int arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  int left[] = new int[n1];  int right[] = new int[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; } public static void mergeSort(long[] arr, int l ,int r){  if((r-l)>=1){  int mid = (l+r)/2;  mergeSort(arr,l,mid);  mergeSort(arr,mid+1,r);  merge(arr,l,r,mid);  } } public static void merge(long arr[], int l, int r, int mid){  int n1 = (mid-l+1), n2 = (r-mid);  long left[] = new long[n1];  long right[] = new long[n2];  for(int i =0 ;i<n1;i++) left[i] = arr[l+i];  for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];  int i =0, j =0, k = l;  while(i<n1 && j<n2){  if(left[i]>right[j]){   arr[k++] = right[j++];  }  else{   arr[k++] = left[i++];  }  }  while(i<n1) arr[k++] = left[i++];  while(j<n2) arr[k++] = right[j++]; }  static class Pair implements Comparable<Pair>{     int x,y,k;   int i,dir;   long val;  Pair (int x,int y){  this.x=x;  this.y=y;  }   public int compareTo(Pair o) {  if(this.x!=o.x)   return this.x-o.x;  return this.y-o.y;  }   public String toString(){  return x+" "+y+" "+k+" "+i;}  public boolean equals(Object o) {  if (o instanceof Pair) {   Pair p = (Pair)o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode()*31 + new Long(y).hashCode() ;  } }     public static boolean isPal(String s){   for(int i=0, j=s.length()-1;i<=j;i++,j--){     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  public static String rev(String s){  StringBuilder sb=new StringBuilder(s);  sb.reverse();  return sb.toString();  }    public static long gcd(long x,long y){  if(y==0)  return x;  else  return gcd(y,x%y);  }    public static int gcd(int x,int y){   if(y==0)    return x;   return gcd(y,x%y);  }    public static long gcdExtended(long a,long b,long[] x){      if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);      x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];      return gcd;  }    public static int abs(int a,int b){  return (int)Math.abs(a-b);  }    public static long abs(long a,long b){  return (long)Math.abs(a-b);  }    public static int max(int a,int b){  if(a>b)  return a;  else  return b;  }    public static int min(int a,int b){  if(a>b)  return b;  else   return a;  }    public static long max(long a,long b){  if(a>b)  return a;  else  return b;  }    public static long min(long a,long b){  if(a>b)  return b;  else   return a;  }    public static long pow(long n,long p,long m){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;   if(result>=m)   result%=m;   p >>=1;   n*=n;   if(n>=m)   n%=m;  }  return result;  }    public static long pow(long n,long p){  long result = 1;  if(p==0)   return 1;  if (p==1)   return n;  while(p!=0)  {   if(p%2==1)    result *= n;    p >>=1;   n*=n;   }  return result;  }  public static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));  }  void run() throws Exception {  is = System.in;  out = new PrintWriter(System.out);  solve();  out.flush();  }    public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {   public void run() {   try {    new code5().run();   } catch (Exception e) {    e.printStackTrace();   }   }  }, "1", 1 << 26).start();      }  private byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;   private int readByte() {  if (lenbuf == -1)   throw new InputMismatchException();  if (ptrbuf >= lenbuf) {   ptrbuf = 0;   try {   lenbuf = is.read(inbuf);   } catch (IOException e) {   throw new InputMismatchException();   }   if (lenbuf <= 0)   return -1;  }  return inbuf[ptrbuf++];  }   private boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }   private int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b));  return b;  }   private double nd() {  return Double.parseDouble(ns());  }   private char nc() {  return (char) skip();  }   private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }   private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {   buf[p++] = (char) b;   b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p);  }   private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)   map[i] = ns(m);  return map;  }   private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = ni();  return a;  }  private long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nl();  return a;  }   private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }   private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }    while (true) {   if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   } else {   return minus ? -num : num;   }   b = readByte();  }  }  }
0	public class Codechef{ static int max=Integer.MIN_VALUE; static int res=0; static int[] checkMax(int arr[],int j){    int sum=0;    int x=arr[j];    while(x!=0){      if(j+1==15){      j=0;      }else{      arr[j+1]=arr[j+1]+1;      }                                             x--;      j++;    }     return arr;  }    public static void main(String []args){   Scanner sc = new Scanner (System.in);  long a [] = new long [14];  long b [] = new long [14];  long p,q,r,s,max = 0;  for(int i = 0; i < 14; i++) a[i] = sc.nextInt();  for(int i = 0; i < 14; i++){  p = a[i]%14;  q = a[i]/14;  r = 0;  s = 0;  for(int j = 0; j < 14; j++) b[j] = a[j];  b[i] = 0;  int j = (i+1)%14;  for(; r < p; r++) {   b[j]++;   j=(j+1)%14;  }  for( j = 0; j < 14; j++) {   b[j] += q;   if(b[j] % 2 == 0) s+= b[j];  }  max = Math.max(max,s);  }  System.out.println(max);   } }
2	public class Main{ public static void main(String[] args)throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  long n = Long.parseLong(st.nextToken());  long s = Long.parseLong(st.nextToken());  long posible = binarySearch(n,s);  long dig, answer;  long i, cmed;  for (i = posible; i >= 0; i--) {  dig = 0;  cmed = i;  while (cmed > 0) {   dig = dig+cmed%10;   cmed/=10;  }  if (i-dig < s) {   break;  }  }  answer = n-i;  System.out.println(answer); } private static long binarySearch(long n, long s){  long med=n, l = 0, r = n, cmed, dig;  while(l<=r){  med = (l+r)/2;  cmed = med;  dig = 0;  while (cmed > 0) {   dig = dig+cmed%10;   cmed/=10;  }  if (med-dig == s) {   break;  }else {   if (med-dig > s) {   r = med-1;   }else {   l = med+1;   }  }    }  return med; } }
6	public class C8 { static int[] mem; static int[] bag; static int[][] items; static int[] close; static PrintWriter pw; static int n; public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  pw = new PrintWriter(System.out);   bag = new int[2];  bag[0] = sc.nextInt();  bag[1] = sc.nextInt();   n = sc.nextInt();  items = new int[n][2];   for(int i = 0;i<n;i++)  {  items[i][0] = sc.nextInt();  items[i][1] = sc.nextInt();  }        mem = new int[1<<n];   Arrays.fill(mem, -1);   pw.println(dp(0));  trace(0);  pw.print(0);   pw.flush(); } static int dp(int mask){  if(mask==(1<<n)-1)  return 0;   if(mem[mask]!=-1)  return mem[mask];   int ans = (int)1e9;  for(int i = 0;i<n;i++)  if((1<<i&mask)==0)  {   ans = getDisBag(i)*2+dp(mask|1<<i);        for(int j = i+1;j<n;j++)   if((1<<j&mask)==0)    ans = Math.min(ans, getDisBag(i)+getDis(i,j)+getDisBag(j)+dp(mask|1<<i|1<<j));     break;  }   return mem[mask] = ans; } static int getDis(int i, int j){  return (items[i][0]-items[j][0])*(items[i][0]-items[j][0])+(items[i][1]-items[j][1])*(items[i][1]-items[j][1]); } static int getDisBag(int i){  return (items[i][0]-bag[0])*(items[i][0]-bag[0])+(items[i][1]-bag[1])*(items[i][1]-bag[1]); } static int getClosest(int i, int mask){  int ret = -1;  for(int j = 0;j<n;j++)  if(i!=j&&(mask&1<<j)==0)   if(ret==-1||getDis(i, j)<getDis(i, ret))   ret = j;  return ret; } static void trace(int mask){  if(mask==(1<<n)-1)  return;   int ans = (int)1e9;  for(int i = 0;i<n;i++)  if((1<<i&mask)==0)  {   ans = getDisBag(i)*2+dp(mask|1<<i);   if(mem[mask]==ans)   {   pw.print(0+" "+(i+1)+" ");   trace(mask|1<<i);   return;   }     for(int j = i+1;j<n;j++)   if((1<<j&mask)==0)    if(mem[mask] == getDisBag(i)+getDis(i,j)+getDisBag(j)+dp(mask|1<<i|1<<j))    {    pw.print(0+" "+(i+1)+" "+(j+1)+" ");    trace(mask|1<<i|1<<j);    return;    }   }   } static class Scanner  {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {return Integer.parseInt(next());}  public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException  {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if(x.charAt(0) == '-')  {   neg = true;   start++;  }  for(int i = start; i < x.length(); i++)   if(x.charAt(i) == '.')   {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   }   else   {   sb.append(x.charAt(i));   if(dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg?-1:1);  }  public boolean ready() throws IOException {return br.ready();}  } }
3	public class D2 { public static void main(String args[]) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int array[] =new int[n];  for(int i=0; i<=n-1; i++) {  array[i] = sc.nextInt();  }  int m = sc.nextInt();  int result = count(array);  for(int i=1; i<=m; i++) {  int a = sc.nextInt();  int b = sc.nextInt();  result += (b-a)*(b-a+1)/2;  result=result%2;  if(result%2==1)   System.out.println("odd");  else   System.out.println("even");  } }  public static int count(int[] arr) {  int[] array = arr.clone();  return sort(array,0,array.length-1); }  public static int sort(int[] arr, int i, int j) {  if(i>=j) return 0;  int mid = (i+j)/2;  int a = sort(arr,i,mid);  int b = sort(arr,mid+1,j);  int addition = 0;  int r1 = mid+1;  int[] tmp = new int[arr.length];  int tIndex = i;   int cIndex=i;  while(i<=mid&&r1<=j) {  if (arr[i] <= arr[r1])     tmp[tIndex++] = arr[i++];    else {      tmp[tIndex++] = arr[r1++];      addition+=mid+1-i;    }  }  while (i <=mid) {    tmp[tIndex++] = arr[i++];   }   while ( r1 <= j ) {    tmp[tIndex++] = arr[r1++];   }   while(cIndex<=j){    arr[cIndex]=tmp[cIndex];    cIndex++;   }   return a+b+addition; } }
3	public class D {  public static void main(String[] args){  FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt();  int[] a = new int[n+1];  for(int i = 1; i <= n; i++) a[i] = scan.nextInt();  BIT bit = new BIT(n);  int p = 0;  for(int i = 1; i <= n; i++) {  p ^= bit.atOrAbove(a[i])&1;  bit.add(a[i], 1);  }  int m = scan.nextInt();  for(int i = 0; i < m; i++) {  int l = scan.nextInt(), r = scan.nextInt();  int s = r-l+1;  int in = s*(s-1)/2;  if((in&1) == 1) p ^= 1;  out.println(p==0?"even":"odd");  }  out.close(); }  static class BIT {  int[] a;  int n;  public BIT(int n) {  this.n = n;  a = new int[n+1];  }  public void add(int i, int val) {  while(i <= n) {   a[i] += val;   i += i & -i;  }  }  public int sum(int j)  {  int res = 0;  for(int i = j; i >= 1; i -= (i & -i)) res += a[i];  return res;  }  public int sum(int i, int j) {  return sum(j)-sum(i-1);  }  public int atOrAbove(int index) {  int sub = 0;  if (index > 0) sub = sum(index-1);  return sum(n) - sub;  } }  static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner() {  try {   br = new BufferedReader(new InputStreamReader(System.in));   st = new StringTokenizer(br.readLine());  } catch (Exception e){e.printStackTrace();}  }  public String next() {  if (st.hasMoreTokens()) return st.nextToken();  try {st = new StringTokenizer(br.readLine());}  catch (Exception e) {e.printStackTrace();}  return st.nextToken();  }  public int nextInt() {return Integer.parseInt(next());}  public long nextLong() {return Long.parseLong(next());}  public double nextDouble() {return Double.parseDouble(next());}  public String nextLine() {  String line = "";  if(st.hasMoreTokens()) line = st.nextToken();  else try {return br.readLine();}catch(IOException e){e.printStackTrace();}  while(st.hasMoreTokens()) line += " "+st.nextToken();  return line;  }  public int[] nextIntArray(int n) {  int[] a = new int[n];  for(int i = 0; i < n; i++) a[i] = nextInt();  return a;  }  public long[] nextLongArray(int n){  long[] a = new long[n];  for(int i = 0; i < n; i++) a[i] = nextLong();  return a;  }  public double[] nextDoubleArray(int n){  double[] a = new double[n];  for(int i = 0; i < n; i++) a[i] = nextDouble();  return a;  }  public char[][] nextGrid(int n, int m){  char[][] grid = new char[n][m];  for(int i = 0; i < n; i++) grid[i] = next().toCharArray();  return grid;  } }  }
4	public class Solution {  static class Reader {  BufferedReader br;  StringTokenizer st;   public Reader() {  br = new BufferedReader(new InputStreamReader(System.in));  }   String next() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int[] nextArr(int n)  {   int a[]=new int[n];   for (int i=0;i<n;i++)a[i]=nextInt();   return a;  }   int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  }   String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  }  static class Ele implements Comparable<Ele>  {   public int x,y;   Ele(int x1,int y1)   {    x=x1;y=y1;   }   public int compareTo(Ele ob) {   if(ob.x!=x)return x-ob.x;   return this.y-ob.y;   }    public String toString()   {   return "["+x+","+y+"]";   }  } void disp(PrintWriter o,boolean b)  {   if (b) o.println("Yes");   else o.println("No");  }  void disp(PrintWriter o,int ...a)  {   o.println(Arrays.toString(a));  }  void disp(PrintWriter o,long ...a)  {   o.println(Arrays.toString(a));  }  void func(PrintWriter o,ArrayList<Integer> a)  {   for (int i=0;i<a.size();i++)   {    if (i!=a.size()-1)    o.print(a.get(i)+".");    else o.println(a.get(i));   }  }  int dp[][];  public static void main(String[] args) throws IOException  {  Reader sc=new Reader();Solution G=new Solution();  PrintWriter o = new PrintWriter(System.out);  int t=1;t=sc.nextInt();  int mod=(int)1e9+7;  int x,x0,x1,x2;int y,y0,y1,y2;int s,s0,s1,s2;  int n,m;int a[],b[],in[],in1[];  long k,l;boolean v[],b1,b2;String ss;char c1[];   ArrayList<ArrayList<Integer>> ll=new ArrayList<>();  ArrayList<Integer> a1=new ArrayList<>();  ArrayList<Integer> a2=new ArrayList<>();  PriorityQueue<Integer> pq1=new PriorityQueue<>();  PriorityQueue<Integer> pq2=new PriorityQueue<>(Collections.reverseOrder());  ArrayDeque<Integer> dq=new ArrayDeque<>();  TreeSet<Integer> h0=new TreeSet<>();  TreeSet<Integer> h1=new TreeSet<>();  TreeMap<Integer,Integer> h=new TreeMap<>();  try{  while (t-->0)  {   n=sc.nextInt();a=sc.nextArr(n);b=new int[(int)1e4];   a1.add(a[0]);b[1]=a[0];   for (int i=1;i<n;i++)   {    G.func(o,a1);    x=a1.get(a1.size()-1);    if (a[i]==1)    {     a1.add(a[i]);     b[a1.size()]=a[i];    }    else if (a[i]==x+1)    {     a1.remove(a1.size()-1);     a1.add(a[i]);     b[a1.size()]=a[i];    }    else    {     while (a1.get(a1.size()-1)!=a[i]-1)     a1.remove(a1.size()-1);     a1.remove(a1.size()-1);     a1.add(a[i]);    }   }   G.func(o,a1);                    h0.clear();ll.clear();a1.clear();a2.clear();h1.clear();h.clear();pq1.clear();pq2.clear();  }  }  catch (Throwable e)  {   e.printStackTrace();  }      o.flush();   o.close(); } }
1	public class C{  static PrintWriter out;  static InputReader in;  public static void main(String args[]){   out = new PrintWriter(System.out);   in = new InputReader();   new C();   out.flush(); out.close();  }   C(){   int a = solve();   out.print(a == 0 ? "tokitsukaze" : a == 1 ? "quailty" : "once again");  }  int n, k;  char ch[]; int a[], c0 = 0, c1 = 0;  TreeSet<Integer> ts[] = new TreeSet[2];  boolean check(){   int min = 0, max = n;   if(!ts[0].isEmpty()){    min = ts[0].first(); max = ts[0].last();    if(max - min + 1 > k)return true;   }   if(!ts[1].isEmpty()){    min = ts[1].first(); max = ts[1].last();    if(max - min + 1 > k)return true;    }   return false;  }  int solve(){   n = in.nextInt(); k = in.nextInt();   ch = in.next().trim().toCharArray(); a = new int[n];   for(int i = 0; i < n; i++)c1 += a[i] = ch[i] - '0';   c0 = n - c1;   for(int i = 0; i < k; i++){    if(a[i] == 0)c0--; else c1--;   }   if(c0 == 0 || c1 == 0)return 0;   for(int i = k; i < n; i++){    if(a[i] == 0)c0--; else c1--;    if(a[i - k] == 0)c0++; else c1++;    if(c0 == 0 || c1 == 0)return 0;   }   for(int i = 0; i < 2; i++)ts[i] = new TreeSet<>();   for(int i = 0; i < n; i++){    ts[a[i]].add(i);   }   for(int i = 0; i < k; i++){    ts[a[i]].remove(i);   }   if(check())return 2;   for(int i = k; i < n; i++){    ts[a[i]].remove(i); ts[a[i - k]].add(i - k);    if(check())return 2;   }   return 1;  }  public static class InputReader{   BufferedReader br;   StringTokenizer st;   InputReader(){    br = new BufferedReader(new InputStreamReader(System.in));   }   public int nextInt(){    return Integer.parseInt(next());   }   public long nextLong(){    return Long.parseLong(next());   }   public double nextDouble(){    return Double.parseDouble(next());   }   public String next(){    while(st == null || !st.hasMoreTokens()){     try{      st = new StringTokenizer(br.readLine());     }catch(IOException e){}    }    return st.nextToken();   }  } }
5	public class A {   public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int so[]= new int[n];   for(int i=0;i<n;i++) so[i]=in.nextInt();   Arrays.sort(so);   if(m<=k) {    System.out.println("0");    return;   }   int sum=0;   int socUsed=0;   int cont=0;   for(int i=n-1;i>=0;i--){    cont++;    sum+=so[i];    if(sum>=m || sum+(k-1)>=m){     System.out.println(cont);     return;    }     sum--;   }    System.out.println("-1");  } }
1	public class Primes { static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );  public static void main( String[] args ) {  int n = in.nextInt(), k = in.nextInt(), count = 0;  boolean[] isP = new boolean[n+1];  for( int i = 2; i <= n; i++ ) isP[i] = true;  ArrayList<Integer> primes = new ArrayList<Integer>();  for( int i = 2; i <= n; i++ ) if( isP[i] )  {  primes.add(i);  if( i <= Math.sqrt(n) ) for( int j = 2*i; j <= n; j += i ) isP[j] = false;  }  for( int i = 0; i < primes.size()-1; i++ )  {  int sum = primes.get(i)+primes.get(i+1)+1;  if( sum<=n && isP[sum] ) count++;  }  if( count>=k ) System.out.println( "YES" );  else System.out.println( "NO" ); } }
1	public class B {   static final boolean DBG = false; static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  static int[] e = new int[100001];  public static void main(String[] args) throws IOException {  int n = i(), k = i(), cnt = 0;  int[] a = new int[n+1];  for (int i=1; i<=n; i++){  a[i] = i();  if (e[a[i]] == 0)   cnt++;  e[a[i]]++;  }  if (k > cnt){  pw.println("-1 -1");  pw.close();  return;  }  if (cnt == n){  pw.print("1 " + k);  pw.close();  return;  }  if (k == 1){  pw.println("1 1");  pw.close();  return;  }  Arrays.fill(e, 0);  int i = 1, j = 0, unik = 0, start = 0, end = 0, len = n, m = 0;   if (e[a[i]] == 0){  unik++;  }  e[a[i]]++;  while (i+1<=n && a[i+1] == a[i]){  i = i+1;  }    j = i+1;   while (j <= n){  if (e[a[j]] == 0){   unik++;   if (unik == k){   while (e[a[i]] > 1){    e[a[i]]--;    i++;    while (i+1<=n && a[i+1] == a[i]){    i = i+1;    }    }   m = j - i + 1;   if (m < len){    start = i; end = j; len = m;    if (m == k)    break;   }      while (i <=n && unik == k){    e[a[i]]--;    if (e[a[i]] == 0)    unik--;    i++;       while (i+1<=n && a[i+1] == a[i]){    i = i+1;    }      }   }  }  e[a[j]]++;  while (j+1<=n && a[j+1] == a[j]){   j++;  }    j++;  }  pw.println(start + " " + end);  pw.close(); }  static int i() throws IOException{  st.nextToken();  return (int)st.nval; }  static long l() throws IOException {  st.nextToken();  return (long)st.nval; }  static double d() throws IOException {  st.nextToken();  return st.nval; } static String s() throws IOException{  st.nextToken();  return st.sval; } }
0	public class Main { public static String conv(String str) {  boolean[] Arr = new boolean[26];  for (int i = 0; i < str.length(); i++) {  Arr[str.charAt(i) - 'a'] = true;  }  StringBuilder sb = new StringBuilder();  for (int i = 0; i < 26; i++) {  if (Arr[i])   sb.append((char) (i + 'a'));  }  return "" + sb; }  public static void main(String[] args) throws IOException, InterruptedException {  PrintWriter pw = new PrintWriter(System.out);  Scanner sc = new Scanner(System.in);  HashSet<String> hs = new HashSet<String>();  int[] Arr = new int[14];  long max = 0;  for (int i = 0; i < 14; i++) {  Arr[i] = sc.nextInt();  }  for (int i = 0; i < 14; i++) {  int[] arr = Arr.clone();   long sum = 0;  int r = arr[i];  arr[i] = 0;  for (int j = i + 1; j < arr.length && r > 0; j++) {   arr[j]++;   r--;  }  for (int j = 0; j < arr.length; j++) {   arr[j] +=( r / 14);   if (j + 1 <= (r % 14)) {   arr[j]++;   }   if (arr[j] % 2 == 0) {   sum += arr[j];   }  }  max = Math.max(max, sum);  }  System.out.println(max); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
2	public class A {  public static boolean realbig (long num, long s) {  String str = num + "";  String[] digs = str.split("");  int sum = 0;  for(String dig : digs) {  sum+= Integer.parseInt(dig);  }  if(num-sum < s) {  return false;  } else {  return true;  } }   public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();  sc.close();  long count = 0;  long i = s;  for(; i < s+200 && i <= n; i++) {  if(realbig(i,s)) {   count++;  }  }  if(i <= n) {  count+=n-i+1;  }  System.out.println(count); } }
4	public class Solution {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   for (int i = 0, t = sc.nextInt(); i < t; i++) {    int n = sc.nextInt();    LinkedList<Set<Integer>> stack = new LinkedList<>();    for (int j = 0; j < n; j++) {     printStack(stack);     int val = sc.nextInt();     if (val == 1) {      Set<Integer> branch = new HashSet<>();      branch.add(val);      stack.push(branch);      continue;     }     Set<Integer> branch = stack.peek();     assert branch != null;     while (branch.contains(val) || branch.stream().max(Integer::compareTo).get() + 1 != val) {      stack.pop();      branch = stack.peek();     }     branch.add(val);    }    printStack(stack);   }  }  public static void printStack(LinkedList<Set<Integer>> stack) {   if (stack.size() == 0) {    return;   }   StringBuilder sb = new StringBuilder();   for (int i = stack.size() - 1; i >= 0; i--) {    sb.append(stack.get(i).stream().max(Integer::compareTo).get()).append(".");   }   System.out.println(sb.substring(0, sb.length() - 1));  } }
0	public class D {  public static void main(String[] args)  {   new D();  }   D()  {   Scanner in = new Scanner(System.in);   double a = in.nextDouble();   double v = in.nextDouble();   double l = in.nextDouble();   double d = in.nextDouble();   double w = in.nextDouble();     if (w>v) w=v;     double dx=(v*v-w*w)/(2*a);   double d0=(w*w)/(2*a);     double t=0;   if (d0>d)   {    if (d0>=l)    {     t=Math.sqrt(2*a*l)/a;    }    else    {     t=w/a;     if (d0+dx>=l)     {      t+=(-w+Math.sqrt(w*w+2*a*(l-d0)))/a;     }     else     {      t+=(v-w)/a;      t+=(l-(d0+dx))/v;     }    }   }   else   {    t=w/a;           if (d+dx>l)    {     t+=(-w+Math.sqrt(w*w+2*a*(l-d)))/a;    }    else    {     t+=(v-w)/a;     t+=(l-(d+dx))/v;    }           if (d0+2*dx>d)    {     double half=(d-d0)/2;     t+=2*(-w+Math.sqrt(w*w+2*a*half))/a;    }    else    {     t+=2*(v-w)/a;     t+=(d-2*dx-d0)/v;    }   }     System.out.printf("%.12f%n", t+1e-11);  } }
6	public class Driver {  private static int [][] distances, parents;  private static int [] distance, parent;  private static String [][] longNames;  private static String [] shortNames, answers;  private static int N;  public static void main(String [] args) throws IOException {   BufferedReader scanner = new BufferedReader(new InputStreamReader(System.in));   String [] pieces = scanner.readLine().split("\\s+");      Point origin = new Point(Integer.parseInt(pieces[0]), Integer.parseInt(pieces[1]));   N = Integer.parseInt(scanner.readLine());   Point [] points = new Point[N + 1];   distances = new int[N + 1][N + 1];   parents = new int[N + 1][N + 1];   longNames = new String[N][N];   shortNames = new String[N];   for (int i = 0; i < N; ++i) {    pieces = scanner.readLine().split("\\s+");    points[i] = new Point(Integer.parseInt(pieces[0]), Integer.parseInt(pieces[1]));   }   points[N] = origin;   for (int i = 0; i <= N; ++i) {    if (i < N) {     shortNames[i] = (i + 1) + " ";    }    for (int j = 0; j <= N; ++j) {     if (i < N && j < N) {      longNames[i][j] = (i + 1) + " " + (j + 1) + " ";     }     distances[i][j] = 2 * points[i].distance(points[j]);     parents[i][j] = points[i].distance(points[N]) + points[i].distance(points[j]) + points[j].distance(points[N]);    }   }   distance = new int[1 << N];   parent = new int[1 << N];   answers = new String[1 << N];   Arrays.fill(distance, -1);   distance[0] = 0;   int result = rec((1 << N) - 1);   StringBuilder answer = new StringBuilder();   for (int i = distance.length - 1; parent[i] != i; i = parent[i]) {    answer.append("0 ");    answer.append(answers[i]);   }   answer.append("0");   System.out.println(result);   System.out.println(answer.toString());  }  private static int rec(int mask) {   if (distance[mask] != -1) {    return distance[mask];   }   int min = 0;   while (((1 << min) & mask) == 0) {    min++;   }   int newMask = mask & (~(1 << min));   distance[mask] = rec(newMask) + distances[min][N];   parent[mask] = newMask;   answers[mask] = shortNames[min];   for (int i = min + 1; i < N; i++) {    if (((1 << i) & mask) > 0) {     newMask = mask & (~(1 << i)) & (~(1 << min));     int temp = rec(newMask) + parents[i][min];     if (temp< distance[mask]) {      distance[mask] = temp;      parent[mask] = newMask;      answers[mask] = longNames[min][i];     }    }   }   return distance[mask];  }  private static class Point {   int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }   public int distance(Point p) {    return (int)(Math.pow(this.x - p.x, 2) + Math.pow(this.y - p.y, 2));   }  } }
1	public class Main {  static int n; static int a; static int b; static int g; static int ref; static int refg; static HashSet<Integer> cgroup; static HashMap<Integer,Integer> indexmap; static HashSet<Integer> nums; static HashSet<Integer> used;  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  n = scan.nextInt();  a = scan.nextInt();  b = scan.nextInt();   boolean[] where = new boolean[n];  indexmap = new HashMap<Integer,Integer>();  used = new HashSet<Integer>();  nums = new HashSet<Integer>();   if (a==b)  b = 0;   for (int i = 0; i<n; i++) {  int x = scan.nextInt();  nums.add(x);  indexmap.put(x,i);  }  scan.close();   for (int x : nums) {  if (used.contains(x))   continue;  cgroup = new HashSet<Integer>();  cgroup.add(x);  g = -1;  refg = -1;  ref = -1;  used.add(x);  if (!spawn(x,a,b) || !spawn(x,b,a)) {   System.out.println("NO");   return;  }  if (cgroup.size()%2==1 && ref == -1) {   System.out.println("NO");   return;  } else {   boolean w = true;   if (g == a)   w = false;   for (int k : cgroup) {   where[indexmap.get(k)] = w;   }  }  }   System.out.println("YES");  for (int i = 0; i<where.length; i++)  if (where[i])   System.out.print("1 ");  else   System.out.print("0 ");   }  private static boolean spawn(int x, int ab, int abo) {  int xab = ab-x;  if (xab == x) {  ref = x;  refg = ab;  } else {  if (nums.contains(xab)) {   cgroup.add(xab);   used.add(xab);   spawn(xab,abo,ab);  } else {   if (g == -1)   g = abo;   else if (g != abo) {   return false;   }  }  }  return true; } }
0	public class kresz { public static double a; public static double v; public static double l; public static double d; public static double w;   public static double gyorsulut (double v1, double v2) {  return Math.abs((v2*v2-v1*v1)/(2*a)); } public static double gyorsulido (double v1, double v2) {  return Math.abs((v2-v1)/a); }   public static void beolvas () throws IOException {  Scanner be = new Scanner (new InputStreamReader (System.in));  a = be.nextDouble();  v = be.nextDouble();  l = be.nextDouble();  d = be.nextDouble();  w = be.nextDouble();  be.close(); }   public static void main (String args[]) throws IOException {  beolvas();  double s = l;   double t = 0;     if (v <= w || Math.sqrt(2*a*d) <= w) {   if (gyorsulut(0,v) > l) {   t+=gyorsulido(0, Math.sqrt(2*a*l));   s = 0;   }   else {   s-=gyorsulut(0,v);   t+=gyorsulido(0,v);   }  }  else {        if (d < gyorsulut(0,v)+gyorsulut(v,w)) {   double x = Math.sqrt(a*(d-w*w/(2*a))+w*w);   s-=gyorsulut(0,w)+2*gyorsulut(w,x);   t+=gyorsulido(0,w)+2*gyorsulido(w,x);   }   else {   s-=gyorsulut(0,v)+gyorsulut(w,v);   t+=gyorsulido(0,v)+gyorsulido(w,v);   }        if (gyorsulut(v,w) > l-d) {   double y = Math.sqrt(2*a*(l-d)+w*w);   s-= gyorsulut(w,y);   t+=gyorsulido(w,y);   }   else {   s-=gyorsulut(w,v);   t+=gyorsulido(w,v);   }  }    t+=s/v;     System.out.println(t);   }  }
2	public class Ds {  static long lim;  public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] line = in.readLine().split("\\s+");   long n = Long.parseLong(line[0]);   lim = Long.parseLong(line[1]);    long pos = -1;   for(int i=61; i>=0; i--) {    long shift = (long) Math.pow(2, i);    if(pos + shift - sumOfDigits(pos + shift) < lim) {   pos += shift;  }  }   pos++;   if(pos <= n && pos- sumOfDigits(pos) >= lim) {  System.out.println(n - pos + 1);  }  else {  System.out.println(0);  }   }  private static long sumOfDigits(long d) {   long sum = 0;  long num = d;   while(num != 0) {  sum += (num%10);  num /= 10;  }   return sum; } }
1	public class Main {    public static void main(String[] args) {     Scanner entrada = new Scanner (System.in);   int Primos []= {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,     71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,     151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,     233,239,     241,     251,     257,     263,     269,     271,     277,     281,     283,     293,     307,     311,     313,     317,     331,     337,     347,     349,     353,     359,     367,     373,     379,     383,     389,     397,     401,     409,     419,     421,     431,     433,     439,     443,     449,     457,     461,     463,     467,     479,     487,     491,     499,     503,     509,     521,     523,     541,     547,     557,     563,     569,     571,     577,     587,     593,     599,     601,     607,     613,     617,     619,     631,     641,     643,     647,     653,     659,     661,     673,     677,     683,     691,     701,     709,     719,     727,     733,     739,     743,     751,     757,     761,     769,     773,     787,     797,     809,     811,     821,     823,     827,     829,     839,     853,     857,     859,     863,     877,     881,     883,     887,     907,     911,     919,     929,     937,     941,     947,     953,     967,     971,     977,     983,     991,     997     };   boolean sw=true;   int Indices [] = new int [Primos.length];   int cantidad = 0;   for(int i=0;i<Primos.length-1 && sw;i++)   {    int suma=Primos[i]+Primos[i+1]+1;    int posicion = Arrays.binarySearch(Primos,suma);    if(posicion>-1)     Indices[posicion]=1;   }   while(entrada.hasNextInt())   {    int N = entrada.nextInt();    int K = entrada.nextInt();    int contador=0;    for(int i=0;Primos[i]<=N && i<Primos.length-1;i++)     contador+=Indices[i];    if(contador>=K)     System.out.println("YES");    else     System.out.println("NO");   }  } }
1	public class B { static Set<Integer> A; static Set<Integer> B; static TreeSet<Integer> ts; static int a; static int b; static boolean noAns; public static void main(String[] args) throws Exception{  int n = readInt();  a = readInt();  b = readInt();  ts = new TreeSet<Integer>();  int[] table = new int[n];  for(int i = 0; i<n; i++){  table[i] = readInt();  ts.add(table[i]);  }  A = new HashSet<Integer>();  B = new HashSet<Integer>();  noAns = false;  for(Integer cur:ts){  boolean fitsA = false;  boolean fitsB = false;  if(A.contains(cur) || B.contains(cur)){   continue;  }  if(ts.contains(a-cur)){   fitsA = true;  }  if(ts.contains(b-cur)){   fitsB = true;  }  if(fitsA && fitsB){   continue;  }  else if(!(fitsA || fitsB)){   noAns = true;  }  else if(fitsA){   tour(cur, false);  }  else if(fitsB){   tour(cur, true);  }  }  for(Integer cur:ts){  if(A.contains(cur) || B.contains(cur)){   continue;  }  else{   A.add(cur);  }  }  if(!noAns){  System.out.println("YES");  StringBuilder sb = new StringBuilder();  for(int i = 0; i< n; i++){   if(A.contains(table[i])){   sb.append("0");   }   else{   sb.append("1");   }   sb.append(" ");  }  System.out.println(sb);  }  else{  System.out.println("NO");  } }  static void tour(Integer cur, boolean bb){  if(A.contains(cur) || B.contains(cur)){  return;  }  if(bb){  B.add(cur);  B.add(b-cur);    if(ts.contains(a-cur)){   B.add(a-cur);   if(ts.contains(b-(a-cur))){   tour(b-(a-cur), true);   }   else{   noAns = true;   }  }    if(ts.contains(a-(b-cur))){   B.add(a-(b-cur));   if(ts.contains(b-(a-(b-cur)))){   tour(b-(a-(b-cur)), true);   }   else{   noAns = true;   }  }  }  else{  A.add(cur);  A.add(a-cur);  if(ts.contains(b-cur)){   A.add(b-cur);   if(ts.contains(a-(b-cur))){   tour(a-(b-cur), false);   }   else{   noAns = true;   }  }  if(ts.contains(b-(a-cur))){   A.add(b-(a-cur));   if(ts.contains(a-(b-(a-cur)))){   tour(a-(b-(a-cur)), false);   }   else{   noAns = true;   }  }  } }  static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(" "); static String readString() throws Exception{  while(!st.hasMoreTokens()){  st = new StringTokenizer(stdin.readLine());  }  return st.nextToken(); } static int readInt() throws Exception {  return Integer.parseInt(readString()); } static long readLong() throws Exception {  return Long.parseLong(readString()); } }
1	public class ProblemB {  public static void main(String[] args) {   InputReader in = new InputReader(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt();   long a = in.nextLong();   long b = in.nextLong();   long[] x = new long[n];   for (int i = 0; i < n; i++) {    x[i] = in.nextLong();   }   Map<Long,Integer> idxmap = new HashMap<>();   for (int i = 0; i < n; i++) {    idxmap.put(x[i], i);   }   if (a == b) {    solve1(x, a, idxmap, out);    return;   }   int[] mark = new int[n];   Arrays.fill(mark, -1);   boolean isok = true;   for (int i = 0 ; i < n ; i++) {    if (mark[i] != -1) {     continue;    }    long w = x[i];    long aw = a - w;    long bw = b - w;    if (idxmap.containsKey(aw) && idxmap.containsKey(bw)) {     continue;    } else if (idxmap.containsKey(bw)) {     long w1 = w;     long w2 = bw;     while (true) {      if (!idxmap.containsKey(w1) || !idxmap.containsKey(w2)) {       break;      }      int i1 = idxmap.get(w1);      int i2 = idxmap.get(w2);      if (mark[i1] == 0 || mark[i2] == 0) {       isok = false;      }      mark[i1] = 1;      mark[i2] = 1;      if (w1 + a - b == w2) {       break;      }      w1 += (a - b);      w2 += (b - a);     }    } else if (idxmap.containsKey(aw)){     long w1 = w;     long w2 = aw;     while (true) {      if (!idxmap.containsKey(w1) || !idxmap.containsKey(w2)) {       break;      }      int i1 = idxmap.get(w1);      int i2 = idxmap.get(w2);      if (mark[i1] == 1 || mark[i2] == 1) {       isok = false;      }      mark[i1] = 0;      mark[i2] = 0;      if (w1 + b - a == w2) {       break;      }      w1 += (b - a);      w2 += (a - b);     }    }   }   for (int i = 0 ; i < n ; i++) {    if (mark[i] == -1) {     isok = false;     break;    }   }   if (isok) {    printAnswer(mark, out);   } else {    out.println("NO");   }   out.flush();  }  private static void printAnswer(int[] mark, PrintWriter out) {   out.println("YES");   StringBuilder ln = new StringBuilder();   for (int m : mark) {    ln.append(' ').append(m);   }   out.println(ln.substring(1));  }  private static void solve1(long[] x, long a, Map<Long, Integer> idxmap, PrintWriter out) {   int[] mark = new int[x.length];   for (int i = 0 ; i < x.length ; i++) {    if (mark[i] == 1) {     continue;    }    long w = x[i];    long wp = a - w;    if (idxmap.containsKey(wp)) {     mark[i] = mark[idxmap.get(wp)] = 1;    }   }   boolean isok = true;   for (int i = 0 ; i < x.length ; i++) {    if (mark[i] == 0) {     isok = false;     break;    }   }   if (isok) {    printAnswer(mark, out);   } else {    out.println("NO");   }   out.flush();  }  public static void debug(Object... o) {   System.err.println(Arrays.deepToString(o));  }   static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int next() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public int nextInt() {    int c = next();    while (isSpaceChar(c))     c = next();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = next();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = next();    } while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = next();    while (isSpaceChar(c))     c = next();    long sgn = 1;    if (c == '-') {     sgn = -1;     c = next();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = next();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
3	public class D {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt(), sum = 0;   int [] a = new int[n+1];   for (int i = 1; i <= n; i++) {    a[i] = in.nextInt();   }   for (int i = 1; i <= n; ++i)    for (int j = i + 1; j <= n; ++j)     sum += a[i] > a[j] ? 1 : 0;   int m = in.nextInt();   sum &= 1;   for (int i = 1; i <= m; i++) {    int l = in.nextInt(), r = in.nextInt();    if (((r - l + 1) / 2) % 2 == 1)     sum ^= 1;    System.out.println(sum == 1 ? "odd" : "even");   }  } }
4	public class Codeforces {  public static void main(String args[])throws Exception  {   BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));   StringBuilder sb=new StringBuilder();   int t=Integer.parseInt(bu.readLine());   while(t-->0)   {    int n=Integer.parseInt(bu.readLine());    int cur[]=new int[n],i,cr=-1;    for(i=0;i<n;i++)    {     int j,d=Integer.parseInt(bu.readLine()),f=-1;     for(j=cr;j>=0;j--)     if(cur[j]==d-1) {f=j; break;}     if(f==-1)     {      cr++;      f=cr;     }     cur[f]=d;     cr=f;     for(j=f+1;j<n;j++) cur[j]=0;     sb.append(cur[0]);     for(j=1;j<n;j++)     if(cur[j]==0) break;     else sb.append("."+cur[j]);     sb.append("\n");    }   }   System.out.print(sb);  } }
0	public class Main {  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String [] line = br.readLine().split(" ");  long l = Long.parseLong(line[0]);  long r = Long.parseLong(line[1]);  if(r-l < 2 || ((r-l == 2) && (l % 2 == 1)))  System.out.println("-1");  else  {  Long start = l + (l%2);   System.out.println(start + " " + (start + 1) + " " + (start + 2));  } } }
5	public class A {  public A() throws Exception {   int n = in.nextInt();   int[] arr = new int[n];   for (int i=0; i<n; i++) arr[i] = in.nextInt();   int[] arr2 = arr.clone();   Arrays.sort(arr2);   int diff = 0;   for (int i=0; i<n; i++) {    if (arr2[i]!=arr[i]) diff++;   }   if (diff<=2) System.out.println("YES");   else System.out.println("NO");  }  Scanner in = new Scanner(System.in);  StringBuilder buf = new StringBuilder();  public static void main(String[] args) throws Exception {   new A();  }  public static void debug(Object... arr) {   System.err.println(Arrays.deepToString(arr));  }  public static class Scanner {   BufferedReader br;   String line;   StringTokenizer st;   public Scanner(InputStream in) {    br = new BufferedReader(new InputStreamReader(in));   }   public boolean hasNext() throws IOException {    while ((st==null||!st.hasMoreTokens())&&(line=br.readLine())!=null)     st = new StringTokenizer(line);    return st.hasMoreTokens();   }   public String next() throws IOException {    if (hasNext()) return st.nextToken();    throw new NoSuchElementException();   }   public int nextInt() throws IOException {    return Integer.parseInt(next());   }   public long nextLong() throws IOException {    return Long.parseLong(next());   }   public double nextDouble() throws IOException {    return Double.parseDouble(next());   }  } }
5	public class Codeforces_R136_Div1_A implements Runnable{  private void solve() throws IOException {  int n = scanner.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; i++) {  a[i] = scanner.nextInt();  }   boolean sorted = true;  for (int i = 0; i < a.length; i++) {  if (!isOk(a, i)){   sorted = false;  }  }  if (sorted){  out.println("YES");  return;  }   List<Integer> idx = new ArrayList<Integer>();   for(int i=0; i<n; i++){  if (!isOk(a, i)){    idx.add(i);      }  }   if (idx.size() > 6){  out.println("NO");  return;  }   for(int i=0; i<idx.size(); i++){  for(int j=0; j<n; j++){   swap(a, idx.get(i), j);   if (isOk(a, idx) && isOk(a, j)){   out.println("YES");   return;   }   swap(a, idx.get(i), j);  }  }  out.println("NO");   }  private boolean isOk(int[] a, int i) {   boolean ordered = true;  if (i>0 && !(a[i-1] <= a[i])){  ordered = false;  }  if (i<a.length-1 && !(a[i]<=a[i+1])){  ordered = false;  }  return ordered; }  private boolean isOk(int[] a, List<Integer> idx) {  for(int i : idx){  if (!isOk(a, i))   return false;  }  return true; }  private void swap(int[] a, int i, int j) {  int tmp = a[i];  a[i] = a[j];  a[j] = tmp; }   final int BUF_SIZE = 1024 * 1024 * 8; final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ; final int BUF_SIZE_INPUT = 1024;  final int BUF_SIZE_OUT = 1024;  boolean inputFromFile = false; String filenamePrefix = "A-small-attempt0"; String inSuffix = ".in"; String outSuffix = ".out";    PrintStream out; ByteScanner scanner; ByteWriter writer;   public void run() {  try{  InputStream bis = null;  OutputStream bos = null;    if (inputFromFile){   File baseFile = new File(getClass().getResource("/").getFile());   bis = new BufferedInputStream(    new FileInputStream(new File(     baseFile, filenamePrefix+inSuffix)),     INPUT_BUFFER_SIZE);   bos = new BufferedOutputStream(    new FileOutputStream(     new File(baseFile, filenamePrefix+outSuffix)));   out = new PrintStream(bos);  }else{   bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);   bos = new BufferedOutputStream(System.out);   out = new PrintStream(bos);  }  scanner = new ByteScanner(bis, BUF_SIZE_INPUT, BUF_SIZE);  writer = new ByteWriter(bos, BUF_SIZE_OUT);    solve();  out.flush();  }catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public interface Constants{  final static byte ZERO = '0';  final static byte NINE = '9';  final static byte SPACEBAR = ' ';  final static byte MINUS = '-';    final static char FLOAT_POINT = '.'; }  public static class EofException extends IOException{ }  public static class ByteWriter implements Constants {   int bufSize = 1024;  byte[] byteBuf = new byte[bufSize];  OutputStream os;   public ByteWriter(OutputStream os, int bufSize){  this.os = os;  this.bufSize = bufSize;  }   public void writeInt(int num) throws IOException{    int byteWriteOffset = byteBuf.length;    if (num==0){    byteBuf[--byteWriteOffset] = ZERO;    }else{    int numAbs = Math.abs(num);    while (numAbs>0){     byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);     numAbs /= 10;    }    if (num<0)     byteBuf[--byteWriteOffset] = MINUS;    }    os.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);  }     public void writeByteAr(byte[] ar) throws IOException{  for (int i = 0; i < ar.length; i++) {   byteBuf[i] = ar[i];  }  os.write(byteBuf,0,ar.length);  }   public void writeSpaceBar() throws IOException{  byteBuf[0] = SPACEBAR;  os.write(byteBuf,0,1);  }   }  public static class ByteScanner implements Constants{   InputStream is;   public ByteScanner(InputStream is, int bufSizeInput, int bufSize){  this.is = is;  this.bufSizeInput = bufSizeInput;  this.bufSize = bufSize;    byteBufInput = new byte[this.bufSizeInput];  byteBuf = new byte[this.bufSize];  }   public ByteScanner(byte[] data){  byteBufInput = data;  bufSizeInput = data.length;  bufSize = data.length;  byteBuf = new byte[bufSize];  byteRead = data.length;  bytePos = 0;  }   private int bufSizeInput;  private int bufSize;   byte[] byteBufInput;  byte by=-1;  int byteRead=-1;  int bytePos=-1;  byte[] byteBuf;  int totalBytes;   boolean eofMet = false;   private byte nextByte() throws IOException{    if (bytePos<0 || bytePos>=byteRead){   byteRead = is==null? -1: is.read(byteBufInput);   bytePos=0;   if (byteRead<0){   byteBufInput[bytePos]=-1;   if (eofMet)    throw new EofException();   eofMet = true;   }  }  return byteBufInput[bytePos++];  }     public byte nextChar() throws IOException{  while ((by=nextByte())<=0x20);  return by;  }     public byte nextCharOrSpacebar() throws IOException{  while ((by=nextByte())<0x20);  return by;  }      public String nextLine() throws IOException {    readToken((byte)0x20);    return new String(byteBuf,0,totalBytes);  }    public byte[] nextLineAsArray() throws IOException {    readToken((byte)0x20);    byte[] out = new byte[totalBytes];    System.arraycopy(byteBuf, 0, out, 0, totalBytes);    return out;  }        public String nextToken() throws IOException {    readToken((byte)0x21);    return new String(byteBuf,0,totalBytes);  }      private void readToken() throws IOException {      readToken((byte)0x21);  }    private void readToken(byte acceptFrom) throws IOException {    totalBytes = 0;    while ((by=nextByte())<acceptFrom);    byteBuf[totalBytes++] = by;    while ((by=nextByte())>=acceptFrom){     byteBuf[totalBytes++] = by;    }  }    public int nextInt() throws IOException{  readToken();  int num=0, i=0;  boolean sign=false;  if (byteBuf[i]==MINUS){   sign = true;   i++;  }  for (; i<totalBytes; i++){   num*=10;   num+=byteBuf[i]-ZERO;  }  return sign?-num:num;  }   public long nextLong() throws IOException{  readToken();  long num=0;  int i=0;  boolean sign=false;  if (byteBuf[i]==MINUS){   sign = true;   i++;  }  for (; i<totalBytes; i++){   num*=10;   num+=byteBuf[i]-ZERO;  }  return sign?-num:num;  }      public double nextDouble() throws IOException{  readToken();  char[] token = new char[totalBytes];  for (int i = 0; i < totalBytes; i++) {   token[i] = (char)byteBuf[i];  }  return Double.parseDouble(new String(token));  }   }  public static void main(String[] args) {  new Codeforces_R136_Div1_A().run(); }  }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.readInt();   int a = in.readInt();   int b = in.readInt();   TreeMap<Integer, Integer> mp = new TreeMap<Integer, Integer>();   for (int i = 0; i < n; ++i) {    mp.put(in.readInt(), i);   }   int aname = 0;   int bname = 1;   if (a > b) {    int t = a;    a = b;    b = t;    aname = 1;    bname = 0;   }   int[] res = new int[n];   while (mp.size() > 0) {    Map.Entry<Integer, Integer> e = mp.firstEntry();    int val = e.getKey();    if (mp.containsKey(b - val)) {     res[mp.get(val)] = res[mp.get(b - val)] = bname;     mp.remove(val);     mp.remove(b - val);    } else if (mp.containsKey(a - val)) {     res[mp.get(val)] = res[mp.get(a - val)] = aname;     mp.remove(val);     mp.remove(a - val);    } else {     break;    }   }   if (mp.size() > 0) {    out.println("NO");   } else {    out.println("YES");    for (int i = 0; i < n; ++i) {     if (i > 0) out.print(" ");     out.print(res[i]);    }    out.println();   }  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {     if (numChars == -1)    throw new UnknownError();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new UnknownError();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   } else if (c == '+') {    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }
5	public class Main {  Scanner in; static PrintWriter out;  static class Scanner {  StreamTokenizer in;   Scanner(InputStream is) {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));   in.resetSyntax();    in.whitespaceChars(0, 32);    in.wordChars(33, 255);     }   int nextInt() {  try {   in.nextToken();   return Integer.parseInt(in.sval);  } catch (IOException e) {   throw new Error();  }  }   String next() {  try {   in.nextToken();   return in.sval;  } catch (IOException e) {   throw new Error();  }  } }    static class Value implements Comparable <Value> {  int x;  int pos;   Value(int x, int pos) {  this.x = x;  this.pos = pos;  }   public int compareTo(Value second) {  if (this.x == second.x) {   return this.pos - second.pos;  } else {   return this.x - second.x;  }  } }  void solve() {  int n = in.nextInt();   Value ar[] = new Value[n];  for (int i = 0; i < n; i++) {  ar[i] = new Value(in.nextInt(), i);  }  Arrays.sort(ar);  int cnt = 0;   for (int i = 0; i < n; i++) {  if (ar[i].pos != i && ar[ar[i].pos].x != ar[i].x) {   cnt++;     }  }  if (cnt > 2) {  out.println("NO");  } else {  out.println("YES");  } }  static void asserT(boolean e) {  if (!e) {  throw new Error();  } }   public void run() {  in = new Scanner(System.in);  out = new PrintWriter(System.out);   try {  solve();  } finally {  out.close();  } }  public static void main(String[] args) {  new Main().run(); } }
5	public class Main2 {   public static void main(String args[]){   Scanner input = new Scanner(System.in);   int n = input.nextInt();   int m = input.nextInt();   int k = input.nextInt();   int[] num = new int[n];   for(int i = 0 ; i < n ; i++){   num[i] = input.nextInt();   }     System.out.println(str(n,m,k,num));  }  static int str(int n,int m,int k,int[] num){  Arrays.sort(num);  int total = k;  int count = 0;  while(k < m){  if(count == num.length)return -1;  k += num[num.length-count-1]-1;  count++;  }  return count; }  }
0	public class Counterexample {  public static void main(String[] args) {   Scanner sc= new Scanner(System.in);  long l=sc.nextLong(),r=sc.nextLong();  if (l%2==0&&r-l>=2) System.out.print(l+" "+(l+1)+" "+(l+2));  else if (l%2==1&&r-l>=3) System.out.print((l+1)+" "+(l+2)+" "+(l+3));  else System.out.print("-1"); } }
0	public class FollowTrafficRules { public Scanner in = new Scanner(System.in); public PrintStream out = System.out;  public double len, d, w, vmax, a;  DecimalFormat fmt = new DecimalFormat("0.0000000000000000");  public void main() {  a = in.nextDouble();  vmax = in.nextDouble();  len = in.nextDouble();  d = in.nextDouble();  w = in.nextDouble();   out.println(fmt.format(T())); }  public double T() {  double t, s;   double t1, s1;  t1 = vmax / a;  s1 = vmax*vmax/(2.0*a);   double t3, s3;  t3 = w/a;  s3 = w*w/(2.0*a);    if(w >= vmax)  {  if(s1 < len)  {   return t1 + (len - s1)/vmax;  }  else  {   return Math.sqrt(2.0*len/a);  }   }  else  {      double t2, s2, v2;  t2 = Math.sqrt(2.0*d/a);  v2 = a*t2;    double tx, vx;  vx = Math.sqrt((2.0*a*d + w*w)/2.0);  tx = vx / a;           if(v2 < w)  {   if(v2 > vmax)   {      if(vmax > vx)   {    return tx + (vx - w)/a + T2(w);   }   else   {    double ty, sy;    ty = (vmax - w)/a;    sy = ty * (vmax + w)/2.0;    return t1 + ty + (d - s1 - sy)/vmax + T2(w);   }   }   else   {      return t2 + T2(v2);     }  }  else if(v2 > vmax)   {     if(vmax > vx)   {   return tx + (vx - w)/a + T2(w);   }   else   {   double ty, sy;   ty = (vmax - w)/a;   sy = ty * (vmax + w)/2.0;   return t1 + ty + (d - s1 - sy)/vmax + T2(w);   }  }  else   {             return tx + (vx - w)/a + T2(w);  }  } }  public double binary() {  double low, high, t, s;  low = 0.0; high = vmax/a;   for(int c=0;c<50;++c)  {  t = (low+high)/2;  s = (a*t*t)/2 + ((a*t - w)/a)*(a*t + w)/2.0;    if(s > d) high = t;  else low = t;  }  t = (low+high)/2;  return t + (a*t - w)/a; }   public double T2(double v0) {     double t1, s1;  t1 = (vmax - v0)/a;  s1 = ((vmax + v0)/2.0)*t1;   if(s1 < len-d)  {    return t1 + (len-d-s1)/vmax;  }  else  {    return (-v0 + Math.sqrt(v0*v0 + 2*a*(len-d)))/a;  } }  public static void main(String[] args) {  (new FollowTrafficRules()).main(); } }
3	public class D { FastScanner in; PrintWriter out; boolean systemIO = true;  public void solve() {  int n = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; i++) {  a[i] = in.nextInt();  }  int x = 0;  for (int i = 0; i < a.length; i++) {  for (int j = i + 1; j < a.length; j++) {   if (a[i] > a[j]) {   x++;   }  }  }  boolean ans = x % 2 == 0;  int m = in.nextInt();  for (int i = 0; i < m; i++) {  int len = -in.nextInt() + in.nextInt();  len = len * (len + 1) / 2;  if (len % 2 == 1) {   ans = !ans;  }  if (ans) {   out.println("even");  } else {   out.println("odd");  }  } }  public void run() {  try {  if (systemIO) {   in = new FastScanner(System.in);   out = new PrintWriter(System.out);  } else {   in = new FastScanner(new File("segments.in"));   out = new PrintWriter(new File("segments.out"));  }  solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  } }  class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  FastScanner(InputStream f) {  br = new BufferedReader(new InputStreamReader(f));  }  String nextLine() {  try {   return br.readLine();  } catch (IOException e) {   return null;  }  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  }   public static void main(String[] arg) {  new D().run(); } }
1	public class B { public void solve() throws IOException {  int n = nextInt();  int k = nextInt();  int[] a = new int[n];  for(int i = 0; i < n; i++){  a[i] = nextInt();  }  int[] num = new int[n];  Set<Integer> set = new HashSet<Integer>();  int s = -1;  int l = -1;  for(int i = 0; i < n; i++){  set.add(a[i]);  num[i] = set.size();  if( num[i] == k ){   l = i+1;   set = new HashSet<Integer>();   for(int j = i; j >= 0; j--){   set.add(a[j]);   if( set.size() == k ){    s = j+1;    break;   }   }   break;  }  }  writer.println(s + " " + l);  }  public static void main(String[] args) throws IOException {  new B().run(); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  public void run() throws IOException {  try {  reader = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
3	public class E35PD {  public static void main(String[] args) throws IOException {   Scanner in = new Scanner(System.in);     int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }     int count = 0;   for (int i = 0; i < n - 1; i++) {    for (int j = i + 1; j < n; j++) {     if (a[i] > a[j]) {      count++;     }    }      }     boolean isEven = (count % 2 == 0);     BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));   int m = in.nextInt();   for (int i = 0; i < m; i++) {    int l = in.nextInt();    int r = in.nextInt();    int size = (r - l) + 1;    int numOfConn = (size - 1) * size / 2;    if (numOfConn % 2 == 1) {     isEven = !isEven;    }    if (isEven) {     out.write("even");     out.newLine();    } else {     out.write("odd");     out.newLine();    }   }   out.close();  } }
1	public class A { static Scanner sc = new Scanner(System.in);  public static void main(String[] args) throws Exception {  BitSet primes = primes(1001);  int N = sc.nextInt();  int K = sc.nextInt();  int count = 0;  for (int i = 2; i <= N; ++i) {  if (!primes.get(i)) continue;  int res = i - 1;  boolean found = false;  for (int j = 2; j <= i / 2; ++j) {   if (primes.get(j) && primes.nextSetBit(j + 1) == res - j) {   found = true;   break;   }  }  if (found) {   ++count;  }  }  System.out.println(count >= K ? "YES" : "NO"); }  public static BitSet primes(int max) {  BitSet primeSet = new BitSet(max + 1);  if (max < 2) {  return primeSet;  }  int limit = (int) Math.sqrt(max + 1);  primeSet.set(2);  for (int i = 3; i < max + 1; i += 2) {  primeSet.set(i);  }  for (int i = 3; i <= limit; i += 2) {  if (!primeSet.get(i)) {   continue;  }  for (int j = i * i; j < max; j += i) {   primeSet.clear(j);  }  }  return primeSet; } }
6	public class LookingForOrder {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int bx = in.nextInt();   int by = in.nextInt();   in.nextLine();   int n = in.nextInt();   int[][] objects = new int[n][2];   for (int i = 0; i < n; i++) {    objects[i][0] = in.nextInt();    objects[i][1] = in.nextInt();   }   int[] cs = new int[n];   for (int i = 0; i < n; i++) {    cs[i] = 2 * time(objects[i], new int[] { bx, by });   }   int[][] cd = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     cd[j][i] = cd[i][j] = time(objects[i], new int[] { bx, by }) + time(objects[j], new int[] { bx, by }) + time(objects[i], objects[j]);    }   }   int maxMask = 1 << n;   int[] dp = new int[maxMask];   int[] path = new int[maxMask];   Arrays.fill(dp, -1);   dp[0] = 0;   for (int g = 1; g < maxMask; g++) {    int min = Integer.MAX_VALUE;    int minPath = 0;    int h = 31;    while ((g & (1 << h)) == 0)     h--;    h++;    int l = 0;    while ((g & (1 << l)) == 0)     l++;    if ((g & 1 << l) > 0) {     int oneleft = g ^ (1 << l);     int t = cs[l] + dp[oneleft];     if (t < min) {      min = t;      minPath = oneleft;     }     for (int j = l + 1; j < h; j++) {      if ((oneleft & 1 << j) > 0) {       int twoleft = oneleft ^ (1 << j);       t = cd[l][j] + dp[twoleft];       if (t < min) {        min = t;        minPath = twoleft;       }      }     }    }    dp[g] = min;    path[g] = minPath;   }   System.out.println(dp[maxMask - 1]);   int previous = maxMask - 1;   int pathElt = path[previous];   System.out.print("0 ");   while (previous > 0) {    int bits = previous - pathElt;    int h = 31;    while ((bits & (1 << h)) == 0)     h--;    int l = 0;    while ((bits & (1 << l)) == 0)     l++;    String el = h == l ? "" + (h + 1) : (h + 1) + " " + (l + 1);    System.out.print(el + " " + 0 + " ");    previous = pathElt;    pathElt = path[pathElt];   }   System.out.println();  }  static int time(int[] a, int[] b) {   int x = b[0] - a[0];   int y = b[1] - a[1];   return x * x + y * y;  } }
0	public class Berland implements Runnable {  private void solve() throws IOException {   double a = nextInt();   double v = nextInt();   double l = nextInt();   double d = nextInt();   double w = nextInt();   double res;   if (v <= w) {                  res = simpleCase(a, v, l, 0);   } else {    double vMax = Math.sqrt(2 * d * a);    if (vMax <= w) {     res = simpleCase(a, v, l, 0);    } else {     double tFullSpeed = v / a;     double tSlowdown = (v - w) / a;     if (a * tFullSpeed * tFullSpeed / 2 + v * tSlowdown - a * tSlowdown * tSlowdown / 2 <= d) {      res = tFullSpeed + tSlowdown + (d - (a * tFullSpeed * tFullSpeed / 2 + v * tSlowdown - a * tSlowdown * tSlowdown / 2)) / v + simpleCase(a, v, l - d, w);     } else {      double min = w;      double max = v;      for (int i = 0; i < 1000; ++i) {       double cur = (min + max) / 2;       double cFullSpeed = cur / a;       double cSlowdown = (cur - w) / a;       if (a * cFullSpeed * cFullSpeed / 2 + cur * cSlowdown - a * cSlowdown * cSlowdown / 2 <= d)        min = cur;       else        max = cur;      }      res = min / a + (min - w) / a + simpleCase(a, v, l - d, w);     }    }   }   writer.printf("%.20f\n", res);  }  private double simpleCase(double a, double v, double l, double v0) {   double tFullSpeed = (v - v0) / a;   if (v0 * tFullSpeed + a * tFullSpeed * tFullSpeed / 2 <= l) {    return tFullSpeed + (l - (v0 * tFullSpeed + a * tFullSpeed * tFullSpeed / 2)) / v;   } else {    double min = 0;    double max = tFullSpeed;    for (int i = 0; i < 1000; ++i) {     double cur = (min + max) / 2;     if (v0 * cur + a * cur * cur / 2 <= l)      min = cur;     else      max = cur;    }    return min;   }  }   public static void main(String[] args) {   new Berland().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
0	public class A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r = in.nextLong();  long a = 0;  long b = 0;  long c = 0;  if (r - l < 2)  System.out.println(-1);  else if (r - l < 3 && l % 2 == 1)  System.out.println(-1);  else {  if (l % 2 == 0) {   a = l;   b = l + 1;   c = l + 2;  } else {   if (l == 1) {   a = 2;   b = 3;   c = 4;   } else {   a = l + 1;   b = l + 2;   c = l + 3;   }  }  System.out.println(a + " " + b + " " + c);  }   } }
3	public class Solution {   static MyScanner sc;  private static PrintWriter out;  static long M2 = 1_000_000_000L + 7;  private static HashMap<Long, Long>[] mods;  public static void main(String[] s) throws Exception {   StringBuilder stringBuilder = new StringBuilder();           if (stringBuilder.length() == 0) {    sc = new MyScanner(System.in);   } else {    sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString())));   }   out = new PrintWriter(new OutputStreamWriter(System.out));   initData();   solve();   out.flush();  }  private static void solve() throws IOException {   int n = sc.nextInt();   int[] data = sc.na(n);   boolean ev = true;   for (int t = 0; t < n - 1; t++) {    for (int x = t + 1; x < n; x++) {     if (data[t] > data[x]) {      ev = !ev;     }    }   }   int m = sc.nextInt();   for (int i = 0; i < m; i++) {    int dd = -sc.nextInt() + sc.nextInt();    int dm = (dd + 1) * dd / 2;    if (dm % 2 == 1) {     ev = !ev;    }    out.println(ev ? "even" : "odd");   }   }   private static void initData() {   }   private static boolean isset(long i, int k) {   return (i & (1 << k)) > 0;  }  private static void solveT() throws IOException {   int t = sc.nextInt();   while (t-- > 0) {    solve();   }  }   private static long gcd(long l, long l1) {   if (l > l1) return gcd(l1, l);   if (l == 0) return l1;   return gcd(l1 % l, l);  }  private static long pow(long a, long b, long m) {   if (b == 0) return 1;   if (b == 1) return a;   long pp = pow(a, b / 2, m);   pp *= pp;   pp %= m;   return (pp * (b % 2 == 0 ? 1 : a)) % m;  }   static class MyScanner {   BufferedReader br;   StringTokenizer st;   MyScanner(BufferedReader br) {    this.br = br;   }   public MyScanner(InputStream in) {    this(new BufferedReader(new InputStreamReader(in)));   }   void findToken() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }   }   String next() {    findToken();    return st.nextToken();   }   Integer[] nab(int n) {    Integer[] k = new Integer[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   int[] na(int n) {    int[] k = new int[n];    for (int i = 0; i < n; i++) {     k[i] = sc.fi();    }    return k;   }   long[] nl(int n) {    long[] k = new long[n];    for (int i = 0; i < n; i++) {     k[i] = sc.nextLong();    }    return k;   }   int nextInt() {    return Integer.parseInt(next());   }   int fi() {    String t = next();    int cur = 0;    boolean n = t.charAt(0) == '-';    for (int a = n ? 1 : 0; a < t.length(); a++) {     cur = cur * 10 + t.charAt(a) - '0';    }    return n ? -cur : cur;   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  }  }
0	public class practice { public static void main(String[] args) throws Exception {   Scanner in = new Scanner(System.in);  String str = in.nextLine();  long n = Long.parseLong(str.substring(0, str.indexOf(" ")));  long m = Long.parseLong(str.substring(str.indexOf(" ") + 1));  if(m - n < 2) {  System.out.println("-1");  } else {  if(m - n == 2 && m % 2 == 1) {   System.out.println("-1");  } else {   System.out.println((n + n % 2) + " " + (n + 1 + n % 2) + " " + (n + 2 + n % 2));  }  } } }
0	public class A { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long l = in.nextLong();  long r = in.nextLong();  in.close();  if (r - l < 2) {  System.out.println(-1);  return;  }  if ((r - l > 2)||(l%2 ==0 )) {  long s = l + l%2;  System.out.println(s+" "+(s+1)+" "+(s+2));  } else {  if (l%2 == 1) {   System.out.println(-1);  } else{   long s = l;   System.out.println(s+" "+(s+1)+" "+(s+2));  }  }   } static long gcd(long a, long b) {  if(a==0) {  return b;  }  if (b==0) {  return a;  }  if (a > b) {  return gcd (a%b, b);  }  return gcd (b%a, a); } }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastReader in = new FastReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  int val[];  int p[];  int aneigh[], bneight[], deg[];  public void solve(int testNumber, FastReader in, PrintWriter out)  {   int n = in.ni ();   val = new int[n];   int a = in.ni ();   int b = in.ni ();   Map<Integer, Integer> set = new TreeMap<Integer, Integer> ();   p = in.iArr (n);   for (int i = 0; i < n; i++)   {    set.put (p[i], i);   }   aneigh = new int[n];   bneight = new int[n];   deg = new int[n];   for (int i = 0; i < n; i++)   {    aneigh[i] = val[i] = bneight[i] = -1;    deg[i] = 0;   }   Queue<Integer> queue = new ArrayDeque<Integer> ();   for (int i = 0; i < n; i++)   {    Integer x1 = set.get (a - p[i]);    Integer x2 = set.get (b - p[i]);    if (x1 != null)    {     aneigh[i] = x1;     deg[i]++;    }    if (x2 != null && a != b)    {     bneight[i] = x2;     deg[i]++;    }    if (deg[i] == 1)    {     queue.add (i);    }   }   while (!queue.isEmpty ())   {    int idx = queue.remove ();    if (deg[idx] != 1)    {     continue;    }    int aa = aneigh[idx];    int bb = bneight[idx];    if (aa != -1)    {     val[idx] = val[aa] = 0;     deg[aa]--;     deg[idx]--;     aneigh[aa] = -1;     aneigh[idx] = -1;     if (deg[aa] == 1)     {      int zz = bneight[aa];      bneight[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)      queue.add (zz);     }    }    else    {     val[idx] = val[bb] = 1;     deg[bb]--;     deg[idx]--;     bneight[idx] = bneight[bb] = -1;     if (deg[bb] == 1)     {           int zz = aneigh[bb];      aneigh[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)       queue.add (zz);     }    }   }   for (int i = 0; i < n; i++)   {    if (val[i] == -1 && cantBePaired(i))    {     out.println ("NO");     return;    }   }      out.println ("YES");   for (int i = 0; i < n; i++)   {    out.print (val[i] + " ");   }   out.println ();  }  private boolean cantBePaired(int i)  {   int aa = aneigh[i];   int bb = bneight[i];   if (aa != -1 && val[aa] == -1)   {    return false;   }   if (bb != -1 && val[bb] == -1)   {    return false;   }   return true;  } } class FastReader {  public InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public FastReader(InputStream stream)  {   this.stream = stream;  }  public FastReader()  {  }  public int read()  {   if (numChars == -1)   {    throw new InputMismatchException ();   }   if (curChar >= numChars)   {    curChar = 0;    try    {     numChars = stream.read (buf);    } catch (IOException e)    {     throw new InputMismatchException ();    }    if (numChars <= 0)    {     return -1;    }   }   return buf[curChar++];  }  public int ni()  {   int c = read ();   while (isSpaceChar (c))    c = read ();   int sgn = 1;   if (c == '-')   {    sgn = -1;    c = read ();   }   int res = 0;   do   {    if (c < '0' || c > '9')    {     throw new InputMismatchException ();    }    res *= 10;    res += c - '0';    c = read ();   } while (!isSpaceChar (c));   return res * sgn;  }  public boolean isSpaceChar(int c)  {   if (filter != null)   {    return filter.isSpaceChar (c);   }   return isWhitespace (c);  }  public static boolean isWhitespace(int c)  {   return c==' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int[] iArr(int n)  {   int a[] = new int[n];   for (int i = 0; i < n; i++)   {    a[i] = ni ();   }   return a;  }  public interface SpaceCharFilter  {   public boolean isSpaceChar(int ch);  } }
4	public class Main{  public static void pri(ArrayList<Integer> list)  {   int len=list.size();   for(int i=0;i<len-1;++i)    System.out.print(list.get(i)+".");   System.out.println(list.get(len-1));  }  public static void main(String[] args) throws java.io.IOException {   Scanner sc=new Scanner(System.in);   int t=sc.nextInt();   while(t-->0)   {    int n=sc.nextInt();    int[] arr=new int[n];    for(int i=0;i<n;++i)    {     arr[i]=sc.nextInt();    }    ArrayList<Integer> cur=new ArrayList<>();    cur.add(1);    System.out.println(1);    for(int i=1;i<n;++i)    {     if(arr[i]==1)     {      cur.add(1);      pri(cur);      continue;     }     int len=cur.size();     while(cur.get(len-1)!=arr[i]-1)     {      cur.remove(len-1);      len--;     }     cur.set(len-1,arr[i]);     pri(cur);     continue;    }   }  } }
2	public class P817C { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  long ans = 0;  if (s > n)  {  System.out.println(0);  return;  }  if (n > s+200)  {  ans += n-(s+200);  n = s+200;  }  for (long i = s; i <= n; i++)  {  char[] num = (""+i).toCharArray();  int sum = 0;  for (int j = 0; j < num.length; j++)   sum += num[j] - '0';  if (i - sum >= s)   ans++;  }  System.out.println(ans); } }
6	public class C {  static int[] DP;  static Point[] Next;  static int[][] pair;  static int[] single;  static int n;  public static int get(int mask) {   if (mask + 1 == (1 << n))    return 0;   if (DP[mask] != -1)    return DP[mask];   int x = 0;   for (;; x++)    if ((mask & (1 << x)) == 0)     break;   int min = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    if ((mask & (1 << i)) != 0 || i == x)     continue;    int temp = pair[x][i] + get(mask | (1 << i) | (1 << x));    if (temp < min) {     min = temp;     Next[mask] = new Point(x, i);    }   }   int temp = single[x] + get(mask | (1 << x));   if (temp < min) {    min = temp;    Next[mask] = new Point(x, -1);   }   return DP[mask] = min;  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   Point start = new Point(in.nextInt(), in.nextInt());   n = in.nextInt();   Point[] A = new Point[n];   for (int i = 0; i < n; i++)    A[i] = new Point(in.nextInt(), in.nextInt());   DP = new int[1 << n];   Next = new Point[1 << n];   Arrays.fill(DP, -1);   pair = new int[n][n];   single = new int[n];   for (int i = 0; i < n; i++)    for (int j = 0; j < n; j++) {     int dx1 = A[i].x - start.x;     int dy1 = A[i].y - start.y;     int dx2 = A[j].x - A[i].x;     int dy2 = A[j].y - A[i].y;     int dx3 = A[j].x - start.x;     int dy3 = A[j].y - start.y;     pair[i][j] = dx1 * dx1 + dy1 * dy1 + dx2 * dx2 + dy2 * dy2       + dx3 * dx3 + dy3 * dy3;     single[i] = 2 * (dx1 * dx1 + dy1 * dy1);    }   int ans = get(0);   System.out.println(ans);   int mask = 0;   while (mask + 1 != (1 << n)) {    Point temp = Next[mask];    if (temp.y == -1)     System.out.print("0 " + (temp.x + 1) + " ");    else {     System.out       .print("0 " + (temp.x + 1) + " " + (temp.y + 1) + " ");     mask |= (1 << temp.y);    }    mask |= (1 << temp.x);   }   System.out.println("0");  } }
3	public class inversioncounting {  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] permutation = new int[n];  for (int i = 0; i < n; i++) {  permutation[i] = sc.nextInt();  }  int m = sc.nextInt();  int[][] reverse = new int[m][2];  for (int i = 0; i < m; i++) {  reverse[i][0] = sc.nextInt();  reverse[i][1] = sc.nextInt();  }  int counter = 0;  for (int i = 0; i < n - 1; i++) {  for (int j = i + 1; j < n; j++) {   if (permutation[i] > permutation[j]) {   counter++;   }  }  }  boolean bayus = true;  if (counter % 2 == 1) {  bayus = false;  }  for (int i = 0; i < m; i++) {  int bobib = reverse[i][1] - reverse[i][0] + 1;  int bafry = nChoose2(bobib);  if (bafry%2 == 1) {   bayus = !bayus;  }  if (bayus) {   System.out.println("even");  }  else {   System.out.println("odd");  }  }  } private static int nChoose2 (int n) {  return (n * (n-1)) / 2; } }
0	public class Traffic extends Template{ public double search1(int a, int w, int d){  double s = 0;  double l = 2*w+2*a*d;  int repeat = 100;  while( repeat-- > 0 ){  double x = (s+l)/2;  if( a*a*x*x + 2*a*w*x - w*w - 4*a*d > 0 ){   l = x;  } else {   s = x;  }  }  return l; }  public double search2(int a, double lim, int k){  double s = 0;  double l = lim + 2*a*k;  int repeat = 100;  while( repeat-- > 0 ){  double x = (s+l)/2;  if( a*x*x + 2*lim*x - 2*k > 0 ){   l = x;  } else {   s = x;  }  }  return l; }  public void solve() throws IOException {  int a = nextInt();  int v = nextInt();  int l = nextInt();  int d = nextInt();  int w = nextInt();  if( w > v ){  w = v;  }  double time_max = Math.sqrt((double)2*d/a);  double time_d = search1(a,w,d);   double t1 = (time_max*a < w) ? time_max : (v >= (w+a*time_d)/2) ? time_d : (w < v) ? (double)(2*v*v-2*v*w+2*a*d+w*w)/(2*a*v) : (double)v/a + (double)(d-(double)v*v/(2*a))/v;  double lim = (time_max*a < w) ? time_max*a : w;  double t3 = Math.min((double)(v-lim)/a, search2(a, lim, l-d));  double dist2 = (l-d) - t3*t3*a/2 - t3*lim;  double t4 = dist2/v;    writer.println((t1+t3+t4)); }  public static void main(String[] args){  new Traffic().run(); } } abstract class Template implements Runnable{ public abstract void solve() throws IOException;  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  public void run(){  try{  reader = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch(Exception e){  e.printStackTrace();  System.exit(1);  } }  public int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  public String nextToken() throws IOException{  while( tokenizer == null || !tokenizer.hasMoreTokens() ){  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
2	public class ques3 { static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream) {    this.stream = stream;   }    public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {       numChars = stream.read(buf);     } catch (IOException e) {       throw new InputMismatchException();     }     if (numChars <= 0) {       return -1;     }    }    return buf[curChar++];   }    public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }    public interface SpaceCharFilter {     public boolean isSpaceChar(int ch);   }    public String next() {    return nextString();   }     public char nextChar(){   int c=read();   while (isSpaceChar(c)) {     c = read();    }   return (char)c;   }    public String nextString() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }    public int nextInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }    public Long nextLong() {    return Long.parseLong(nextString());   }    public Double nextDouble() {    return Double.parseDouble(nextString());   }  }  public static void main(String[] args) {  InputReader sc=new InputReader(System.in);  long n=sc.nextLong();  long s=sc.nextLong();   long start=0,end=n;  while(start<end)  {  long mid=(start+end)/2;  if(func(mid)>=s)   end=mid;  else   start=mid+1;  }  if(func(start)>=s)  System.out.println(n-start+1);  else  System.out.println(0); }  public static long func(long n) {  long temp=n;  int sum=0;  while(temp>0)  {  sum+=temp%10;  temp/=10;  }  return n-sum; } }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n, k;   n = sc.nextInt();   k = sc.nextInt();   int a = (n - k) / 2;   StringBuilder s = new StringBuilder();   int i;   while (s.length() < n) {    i = 0;    while (i < a && s.length() < n) {     s.append("0");     i++;    }    if (s.length() < n) s.append("1");   }   System.out.println(s);  } }
3	public class D {  int N,M;  int[] a,l,r;  private void solve() {   N = nextInt();   a = new int[N];   for(int i = 0;i < N;i++) {    a[i] = nextInt();   }   M = nextInt();   l = new int[M];   r = new int[M];   for(int i = 0;i < M;i++) {    l[i] = nextInt();    r[i] = nextInt();   }   int count = 0;   for(int i = 0;i < N - 1;i++) {    for(int j = i + 1;j < N;j++) if (a[i] > a[j]) {     count++;    }   }   for(int i = 0;i < M;i++) {    count += (r[i] - l[i] + 1) * (r[i] - l[i]) / 2;    count %= 2;    out.println(count == 0 ? "even" : "odd");   }  }  public static void main(String[] args) {   out.flush();   new D().solve();   out.close();  }    private static final InputStream in = System.in;  private static final PrintWriter out = new PrintWriter(System.out);  private final byte[] buffer = new byte[2048];  private int p = 0;  private int buflen = 0;  private boolean hasNextByte() {   if (p < buflen)    return true;   p = 0;   try {    buflen = in.read(buffer);   } catch (IOException e) {    e.printStackTrace();   }   if (buflen <= 0)    return false;   return true;  }  public boolean hasNext() {   while (hasNextByte() && !isPrint(buffer[p])) {    p++;   }   return hasNextByte();  }  private boolean isPrint(int ch) {   if (ch >= '!' && ch <= '~')    return true;   return false;  }  private int nextByte() {   if (!hasNextByte())    return -1;   return buffer[p++];  }  public String next() {   if (!hasNext())    throw new NoSuchElementException();   StringBuilder sb = new StringBuilder();   int b = -1;   while (isPrint((b = nextByte()))) {    sb.appendCodePoint(b);   }   return sb.toString();  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  }  public double nextDouble() {   return Double.parseDouble(next());  } }
2	public class ed817Q3 { public static void main(String[] args){  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int t = 1;  for(int zxz=0;zxz<t;zxz++){    long n = in.nextLong();  long s = in.nextLong();  long start=s,end=n;  long ans=n+1;  while(start<=end){   long mid = start+(end-start)/2;   if(mid-digitSum(mid)>=s){   ans = mid;   end = mid-1;   }   else{   start=mid+1;   }  }  System.out.println(n-ans+1);    } } static int digitSum(long n){  int sum=0;  while(n>0){  sum+=n%10;  n=n/10;  }  return sum; } static class InputReader {     private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream) {    this.stream = stream;   }    public int snext() {    if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }    public int nextInt() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public long nextLong() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }    public String readString() {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
1	public class Main{           static int mod = 1000000007;       static ArrayList<Integer> cd[]; static int K=0;  public static void main(String[] args) throws Exception, IOException{      Reader sc = new Reader(System.in);         int n=sc.nextInt();  int a=sc.nextInt(),b=sc.nextInt(),d[]=new int[n];  HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();  ArrayList<Integer> A = new ArrayList<Integer>();     for (int i = 0; i < n ; i++) {    d[i]=sc.nextInt();  map.put(d[i],i );    }   int c=1;  if( a>b ){c--; int x=a; a=b; b=x;}   int r[]=new int[n];   if(a==b){    for (int i = 0; i < n; i++) {   if(d[i]>a || !map.containsKey(a-d[i]) ){System.out.println("NO"); return;}  } System.out.println("YES");  for (int i = 0; i < n; i++) {System.out.print("1 ");}  System.out.println();  return;  }    sort(d);  for (int j = 0; j < n; j++) {   int i=n-j-1;  int id=map.get(d[i]),idd=-1;  if( id<0)continue;        if( d[i]<=a ){   if( map.containsKey(a-d[i]) && 0<=(idd=map.get(a-d[i])) ){    r[id]=r[idd]=(c+1)%2;   map.put(a-d[i], -1);   }   else if( map.containsKey(b-d[i]) && 0<=(idd=map.get(b-d[i])) ){     r[id]=r[idd]=c;    map.put(b-d[i], -1); }   else{ System.out.println("NO"); return; }     }    else{     if( map.containsKey(b-d[i]) && 0<=(idd=map.get(b-d[i])) ){    r[id]=r[idd]=c;   map.put(b-d[i], -1); }   else{ System.out.println("NO"); return; }     }  map.put(d[i], -1);     }  System.out.println("YES");   for (int j = 0; j < n; j++) {  System.out.print(r[j]+" ");  }  System.out.println();        }  static class P implements Comparable<P>{  int id; long d; ; P(int id,long d){  this.id=id;  this.d=d; }   public int compareTo(P x){  return (-x.d+d)>=0?1:-1 ;     }  }  static void db(Object... os){  System.err.println(Arrays.deepToString(os)); }  }  class Reader {  private BufferedReader x; private StringTokenizer st;  public Reader(InputStream in) {  x = new BufferedReader(new InputStreamReader(in));  st = null; } public String nextString() throws IOException {  while( st==null || !st.hasMoreTokens() )  st = new StringTokenizer(x.readLine());  return st.nextToken(); } public int nextInt() throws IOException {  return Integer.parseInt(nextString()); } public long nextLong() throws IOException {  return Long.parseLong(nextString()); } public double nextDouble() throws IOException {  return Double.parseDouble(nextString()); } }
6	public class c8 {  static int n;  static int[] ds;  static int[][] g; public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int x = input.nextInt(), y = input.nextInt();  int n = input.nextInt();  int[] xs = new int[n], ys = new int[n];  for(int i = 0; i<n; i++)  {   xs[i] = input.nextInt();   ys[i] = input.nextInt();  }  ds = new int[n];  g = new int[n][n];  for(int i = 0; i<n; i++)  {   ds[i] = (x - xs[i]) * (x - xs[i]) + (y - ys[i]) * (y - ys[i]);   for(int j = 0; j<n; j++)   {    g[i][j] = (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  int[] dp = new int[1<<n];  Arrays.fill(dp, 987654321);  dp[0] = 0;  for(int i = 0; i<(1<<n); i++)  {   if(dp[i] == 987654321) continue;   for(int a = 0; a<n; a++)   {    if((i & (1<<a)) > 0) continue;    dp[i | (1<<a)] = Math.min(dp[i | (1<<a)], dp[i] + 2*ds[a]);    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) > 0) continue;     dp[i | (1<<a) | (1<<b)] = Math.min(dp[i | (1<<a) | (1<<b)], dp[i] + ds[a] + ds[b] + g[a][b]);    }    break;   }  }  Stack<Integer> stk = new Stack<Integer>();  stk.add(0);  int i = (1<<n) - 1;    trace:  while(i > 0)  {     for(int a = 0; a<n; a++)   {    if((i & (1<<a)) == 0) continue;    if( dp[i] == dp[i - (1<<a)] + 2*ds[a])    {     stk.add(a+1);     stk.add(0);     i -= (1<<a);     continue trace;    }    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) == 0) continue;     if(dp[i] == dp[i - (1<<a) - (1<<b)] + ds[a] + ds[b] + g[a][b])     {      stk.add(a+1);      stk.add(b+1);      stk.add(0);      i -= (1<<a) + (1<<b);      continue trace;     }    }      }  }  System.out.println(dp[(1<<n) - 1]);  while(!stk.isEmpty()) System.out.print(stk.pop()+" "); } }
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   ArrayList<Integer>list=new ArrayList<Integer>();   for(int i=0;i<n;i++)    list.add(a[i]);   Collections.shuffle(list);   int[]b=new int[n];   for(int i=0;i<n;i++)    b[i]=list.get(i);   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");  }  private void mySort(int[] a) {   if(a.length<=1)    return;   int n=a.length;   int[]left=new int[n/2];   int[]right=new int[n-n/2];   for(int i=0;i<n;i++)    if(i<left.length)     left[i]=a[i];    else     right[i-left.length]=a[i];   mySort(left);   mySort(right);   int i=0;   int j=0;   while (i<left.length || j<right.length)   {    if(i==left.length)     a[i+j]=right[j++];    else if(j==right.length)     a[i+j]=left[i++];    else if(left[i]<right[j])     a[i+j]=left[i++];    else     a[i+j]=right[j++];   }  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;        solve();   reader.close();    }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
4	public class Main { public static void solve() {  int n = in.nextInt();  ArrayList<Integer> ans = new ArrayList<>();  out.println(in.nextInt());  ans.add(1);  for(int i = 0; i<n-1; i++) {  int cur = in.nextInt();  if(ans.isEmpty() || cur==1) ans.add(cur);  else {   while((!ans.isEmpty()) && (ans.get(ans.size()-1)+1!=cur)) ans.remove(ans.size()-1);   if(!ans.isEmpty()) ans.remove(ans.size()-1);   ans.add(cur);  }  int cnt = 0;  for(int j : ans) {   cnt++;   out.print(j+(cnt==ans.size()?"":"."));  }  out.println();  }   } static boolean equal(ArrayList<Integer> a, ArrayList<Integer> b) {  if(a.size()!=b.size()) return false;  for(int i = 0; i<a.size(); i++) if(a.get(i)!=b.get(i)) return false;  return true; }  public static void main(String[] args) {  in = new Reader();  out = new Writer();  int t = in.nextInt();  while(t-->0) solve();  out.exit(); } static Reader in; static Writer out; static class Reader { static BufferedReader br; static StringTokenizer st;  public Reader() {  this.br = new BufferedReader(new InputStreamReader(System.in)); }  public Reader(String f){  try {  this.br = new BufferedReader(new FileReader(f));  } catch (IOException e) {  e.printStackTrace();  } }  public int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = nextInt();  return a; }  public double[] nd(int n) {  double[] a = new double[n];  for (int i = 0; i < n; i++) a[i] = nextDouble();  return a; }  public long[] nl(int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++) a[i] = nextLong();  return a; }  public char[] nca() {  return next().toCharArray(); }  public String[] ns(int n) {  String[] a = new String[n];  for (int i = 0; i < n; i++) a[i] = next();  return a; }  public int nextInt() {  ensureNext();  return Integer.parseInt(st.nextToken()); }  public double nextDouble() {  ensureNext();  return Double.parseDouble(st.nextToken()); }  public Long nextLong() {  ensureNext();  return Long.parseLong(st.nextToken()); }  public String next() {  ensureNext();  return st.nextToken(); }  public String nextLine() {  try {  return br.readLine();  } catch (Exception e) {  e.printStackTrace();  return null;  } }  private void ensureNext() {  if (st == null || !st.hasMoreTokens()) {  try {   st = new StringTokenizer(br.readLine());  } catch (IOException e) {   e.printStackTrace();  }  } } } static class Util{  private static Random random = new Random();  static long[] fact;   public static void initFactorial(int n, long mod) {  fact = new long[n+1];  fact[0] = 1;  for (int i = 1; i < n+1; i++) fact[i] = (fact[i - 1] * i) % mod;  }   public static long modInverse(long a, long MOD) {  long[] gcdE = gcdExtended(a, MOD);  if (gcdE[0] != 1) return -1;   long x = gcdE[1];  return (x % MOD + MOD) % MOD;  }   public static long[] gcdExtended(long p, long q) {  if (q == 0) return new long[] { p, 1, 0 };  long[] vals = gcdExtended(q, p % q);  long tmp = vals[2];  vals[2] = vals[1] - (p / q) * vals[2];  vals[1] = tmp;  return vals;  }   public static long nCr(int n, int r, long MOD) {  if (r == 0) return 1;  return (fact[n] * modInverse(fact[r], MOD) % MOD * modInverse(fact[n - r], MOD) % MOD) % MOD;  }   public static long nCr(int n, int r) {  return (fact[n]/fact[r])/fact[n-r];  }   public static long nPr(int n, int r, long MOD) {  if (r == 0) return 1;  return (fact[n] * modInverse(fact[n - r], MOD) % MOD) % MOD;  }  public static long nPr(int n, int r) {  return fact[n]/fact[n-r];  }   public static boolean isPrime(int n) {    if (n <= 1) return false;    if (n <= 3) return true;    if (n % 2 == 0 || n % 3 == 0) return false;    for (int i = 5; i * i <= n; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)     return false;    return true;   }    public static boolean[] getSieve(int n) {   boolean[] isPrime = new boolean[n+1];   for (int i = 2; i <= n; i++) isPrime[i] = true;   for (int i = 2; i*i <= n; i++) if (isPrime[i])      for (int j = i; i*j <= n; j++) isPrime[i*j] = false;   return isPrime;  }    public static int gcd(int a, int b) {   int tmp = 0;   while(b != 0) {   tmp = b;   b = a%b;   a = tmp;   }   return a;  }    public static long gcd(long a, long b) {   long tmp = 0;   while(b != 0) {   tmp = b;   b = a%b;   a = tmp;   }   return a;  }    public static int random(int min, int max) {   return random.nextInt(max-min+1)+min;  }    public static void dbg(Object... o) {   System.out.println(Arrays.deepToString(o));  }   public static void reverse(int[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   int tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(int[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(long[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   long tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(long[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(float[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   float tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(float[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(double[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   double tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(double[] s) {  reverse(s, 0, s.length-1);  }   public static void reverse(char[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   char tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static void reverse(char[] s) {  reverse(s, 0, s.length-1);  }   public static <T> void reverse(T[] s, int l , int r) {  for(int i = l; i<=(l+r)/2; i++) {   T tmp = s[i];   s[i] = s[r+l-i];   s[r+l-i] = tmp;  }  }   public static <T> void reverse(T[] s) {  reverse(s, 0, s.length-1);  }   public static void shuffle(int[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    int t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(long[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    long t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(float[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    float t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(double[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    double t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void shuffle(char[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    char t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static <T> void shuffle(T[] s) {   for (int i = 0; i < s.length; ++i) {    int j = random.nextInt(i + 1);    T t = s[i];    s[i] = s[j];    s[j] = t;   }  }    public static void sortArray(int[] a) {   shuffle(a);   Arrays.sort(a);  }   public static void sortArray(long[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(float[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(double[] a) {  shuffle(a);   Arrays.sort(a);  }   public static void sortArray(char[] a) {  shuffle(a);   Arrays.sort(a);  }   public static <T extends Comparable<T>> void sortArray(T[] a) {   Arrays.sort(a);  } } static class Writer { private PrintWriter pw; public Writer(){  pw = new PrintWriter(System.out); }  public Writer(String f){  try {  pw = new PrintWriter(new FileWriter(f));  } catch (IOException e) {  e.printStackTrace();  } }  public void printArray(int[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" "); }  public void printlnArray(int[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" ");  pw.println(); }  public void printArray(long[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" "); }  public void printlnArray(long[] a) {  for(int i = 0; i<a.length; i++) print(a[i]+" ");  pw.println(); }  public void print(Object o) {  pw.print(o.toString()); }  public void println(Object o) {  pw.println(o.toString()); }  public void println() {  pw.println(); }  public void flush() {  pw.flush(); } public void exit() {  pw.close(); } } }
5	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(br.readLine());   int[] arr = new int[n];   HashMap<Integer, Integer> map = new HashMap<>();   StringTokenizer st = new StringTokenizer(br.readLine());   for (int i = 0; i < n; i++) {    int x = Integer.parseInt(st.nextToken());    arr[i] = x;    if (!map.containsKey(x)) {     map.put(x, 1);    } else {     map.replace(x, map.get(x) + 1);    }   }   int[] power = new int[31];   for (int i = 0; i < 31; i++) {    power[i] = 1 << i;   }   int c = 0;   for (int i = 0; i < n; i++) {   boolean f = false;   for (int j = 0; j <= 30; j++) {   int check = power[j] - arr[i];     if ((map.containsKey(check) && check != arr[i])) {     f = true; break;}     if((map.containsKey(check) && check == arr[i] && map.get(check) >=2)) {      f = true; break;     }    }    if (!f) {     c++;    }   }   System.out.println(c);  } }
2	public class ReallyBigNumbers {  public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  long ans = 0;  long l = 0;   long r = n;   while (l <= r) {       long mid = l + (r - l) / 2;    if(isReallyBig(mid, s)){    ans = mid;    r = mid-1;    }    else l = mid+1;   }   if(ans == 0) System.out.println(ans);   else   System.out.println(n-ans+1); }  static boolean isReallyBig(long m, long s){  String x = m+"";  long sum = 0;  for(int i = 0; i < x.length(); i++){  sum += x.charAt(i)-'0';  }  if(m-sum >= s) return true;  return false; } }
1	public class Main { public static void main(String[] args) {  InputReader in = new StreamInputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  run(in, out); }  public static void run(InputReader in, PrintWriter out) {  Solver solver = new Task();  solver.solve(1, in, out);  Exit.exit(in, out); } } abstract class InputReader { private boolean finished = false;  public abstract int read();  public long readLong() {  return new BigInteger(readString()).longValue(); }  public int readInt() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public String readString() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuffer res = new StringBuffer();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  public void setFinished(boolean finished) {  this.finished = finished; }  public abstract void close(); } class StreamInputReader extends InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar, numChars;  public StreamInputReader(InputStream stream) {  this.stream = stream; }  public int read() {  if (numChars == -1)  throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars <= 0)   return -1;  }  return buf[curChar++]; }  public void close() {  try {  stream.close();  } catch (IOException ignored) {  } } } class Exit { private Exit() { }  public static void exit(InputReader in, PrintWriter out) {  in.setFinished(true);  in.close();  out.close(); } } interface Solver { public void solve(int testNumber, InputReader in, PrintWriter out); } class Task implements Solver { public void solve(int testNumber, InputReader in, PrintWriter out) {  int n = in.readInt();  int a = in.readInt();  int b = in.readInt();   if (a==b) {  b = 0;  }   boolean[] where = new boolean[n];   HashSet<Integer> set = new HashSet<Integer>();  HashMap<Integer,Integer> indexmap = new HashMap<Integer,Integer>();   for (int i = 0; i<n; i++) {  int x = in.readInt();  indexmap.put(x, i);  set.add(x);  }   while (set.size() > 0) {  int size = set.size();  HashSet<Integer> todo = new HashSet<Integer>();  HashSet<Integer> used = new HashSet<Integer>();  for (int x : set) {   if (used.contains(x))   continue;   int ax = a-x;   int bx = b-x;     if ((set.contains(ax) && !used.contains(ax)) && (set.contains(bx) && !used.contains(bx))) {   todo.add(x);   } else if (set.contains(ax) && !used.contains(ax)) {   used.add(x);   used.add(ax);   todo.remove(ax);         bx = b-ax;   while (set.contains(bx) && !used.contains(bx)) {    x = bx;    ax = a-x;    if (!set.contains(ax) || used.contains(ax)) {    System.out.println("NO");    return;    }    todo.remove(x);    todo.remove(ax);    used.add(x);    used.add(ax);    bx = b-ax;   }      } else if (set.contains(bx) && !used.contains(bx)) {   used.add(x);   used.add(bx);   todo.remove(bx);   where[indexmap.get(bx)] = true;   where[indexmap.get(x)] = true;         ax = a-bx;   while (set.contains(ax) && !used.contains(ax)) {    x = ax;    bx = b-x;    if (!set.contains(bx) || used.contains(bx)) {    System.out.println("NO");    return;    }    todo.remove(x);    todo.remove(bx);    used.add(x);    used.add(bx);    where[indexmap.get(bx)] = true;    where[indexmap.get(x)] = true;    ax = a-bx;   }      } else {   System.out.println("NO");   return;   }  }  set = todo;  if (set.size() == size) {   System.out.println("Set size constant!!");   break;  }  }   System.out.println("YES");  for (int i = 0; i<n; i++)  if (where[i])   System.out.print("1 ");  else   System.out.print("0 "); } } class num {   }
1	public class ProblemaNoldbaha implements Runnable{ public static void main(String[] args) throws IOException {  new Thread(new ProblemaNoldbaha()).start(); }  BufferedReader br; StringTokenizer in; PrintWriter out;  public String nextToken() throws IOException{  while (in == null || !in.hasMoreTokens()){  in = new StringTokenizer(br.readLine());  }   return in.nextToken(); }  public int nextInt() throws IOException{  return Integer.parseInt(nextToken()); }  public double nextDouble() throws IOException{  return Double.parseDouble(nextToken()); }  public void solve() throws IOException{  int n = nextInt();  int k = nextInt();   int[] prime = new int[1000];   int l = 0;   for (int i = 2; i <= n; i++) {  boolean f = false;  for (int j = 2; j < i; j++) {   if (i % j == 0){   f = true;   break;   }  }    if (!f){   prime[l] = i;   l++;  }  }   int count = 0;  for (int i = 2; i < l; i++) {  boolean f = false;  for (int j = 0; j < l - 1; j++) {   if (prime[j] + prime[j + 1] + 1 == prime[i]){   f = true;   break;   }  }    if (f) count++;  }   if (count >= k){  out.println("YES");  }  else{  out.println("NO");  } }  public void run(){  try{  br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);    solve();    out.close();  }  catch(IOException e){  e.printStackTrace();  System.exit(1);  } } }
1	public class B {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int distinct = sc.nextInt();   HashMap<Integer, Integer> set = new HashMap<Integer, Integer>();   int[] ar = new int[n];   for (int i = 0; i < n; i++) {    ar[i] = sc.nextInt();    if (set.containsKey(ar[i])) {     set.put(ar[i], set.get(ar[i])+1);    } else {     set.put(ar[i], 1);    }    if (set.size() == distinct) {     int st = 0;     for (int j = 0; j < i; j++) {      st=j;      if (set.get(ar[j]) > 1) {       set.put(ar[j], set.get(ar[j]) - 1);      } else {       break;      }     }     System.out.println((st + 1) + " " + (i + 1));     return;    }   }   System.out.println("-1 -1");  } }
0	public class Main {  private static final double EPS = 1e-11;  public static void main(String[] args) throws IOException {   new Main().run();  }  BufferedReader in;  PrintWriter out;  StringTokenizer st = new StringTokenizer("");   void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);     double a = nextDouble();   double v = nextDouble();   double l = nextDouble();   double d = nextDouble();   double w = nextDouble();     double ans = 0.0;     if (v < w + EPS || sqr(w) / 2 / a > d - EPS) {    double t1 = sqrt(2 * l / a);    double t2 = v / a;       if (t1 < t2 + EPS) {     ans = t1;    } else {     ans = t2 + (l - a * sqr(t2) / 2) / v;    }   } else {    double t1 = v / a;    double t2 = (v - w) / a;    double s12 = a * sqr(t1) / 2 + w * t2 + a * sqr(t2) / 2;       if (s12 < d + EPS) {     ans += t1 + t2 + (d - s12) / v;    } else {     double ta = sqrt(d / a + sqr(w / a) / 2);     double tb = ta - w / a;     ans += ta + tb;    }       double r = l - d;    double tm = (v - w) / a;    double tx = (sqrt(sqr(w) + 2 * a * r) - w) / a;       if (tx < tm + EPS) {     ans += tx;    } else {     ans += tm + (r - w * tm - a * sqr(tm) / 2) / v;    }   }        out.printf(Locale.US, "%.12f%n", ans);   out.close();  }   double sqr(double x) {   return x * x;  }   String nextToken() throws IOException {   while (!st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }     return st.nextToken();  }   int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
1	public class E17 {  static StreamTokenizer in; static PrintWriter out;  static int nextInt() throws IOException {  in.nextToken();  return (int)in.nval; }  static String nextString() throws IOException {  in.nextToken();  return in.sval; }  public static void main(String[] args) throws IOException {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(System.out);   int n = nextInt(), k = nextInt();  int MAX = n, nprimes = 0;  int[] primes = new int[MAX];  boolean[] isPrime = new boolean[MAX+1];  Arrays.fill(isPrime, true);  isPrime[0] = false;  isPrime[1] = false;  for (int i = 2; i <= MAX; i++) if (isPrime[i]) {  primes[nprimes++] = i;  for (int j = i + i; j <= MAX; j += i) isPrime[j] = false;  }  primes[nprimes] = Integer.MAX_VALUE;   HashSet<Integer> h = new HashSet<Integer>();  for (int i = 1; i < nprimes; i++) {  int x = primes[i-1] + primes[i] + 1;  if (x > n) break;  if (isPrime[x]) h.add(x);  }   out.println(h.size() >= k ? "YES" : "NO");   out.flush(); } }
3	public class Sample implements Runnable  {       public static void solve()   {     int n=i();     int[] a=new int[n];    for(int i=0;i<n;i++)a[i]=i();    int temp=0;    for(int i=0;i<n;i++)    {     for(int j=i+1;j<n;j++)     {     if(a[j]<a[i])temp++;     }    }    boolean even=(temp%2==0)?true:false;    int m=i();    while(m-->0)    {     int l=i(); int r=i();     long tt=(long)(Math.floor(r-l+1)/2);     if(tt%2==1)     {     if(even)     {     out.println("odd");     even=false;     }     else     {     out.println("even");     even=true;     }     }else     {     if(even)     {     out.println("even");          }     else     {     out.println("odd");          }     }    }       }          public void run()   {     solve();    out.close();   }    public static void main(String[] args) throws IOException   {     new Thread(null, new Sample(), "whatever", 1<<26).start();   }   abstract static class Pair implements Comparable<Pair>   {    long a;    int b;       Pair(){}    Pair(long a,int b)    {       this.a=a;       this.b=b;    }     public int compareTo(Pair x)    {     return Long.compare(x.a,this.a);    }   }             static class Merge  {    public static void sort(long inputArr[])   {    int length = inputArr.length;    doMergeSort(inputArr,0, length - 1);   }    private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)   {      if (lowerIndex < higherIndex) {     int middle = lowerIndex + (higherIndex - lowerIndex) / 2;     doMergeSort(arr,lowerIndex, middle);     doMergeSort(arr,middle + 1, higherIndex);     mergeParts(arr,lowerIndex, middle, higherIndex);    }   }    private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)   {    long[] temp=new long[higherIndex-lowerIndex+1];    for (int i = lowerIndex; i <= higherIndex; i++)    {     temp[i-lowerIndex] = array[i];    }    int i = lowerIndex;    int j = middle + 1;    int k = lowerIndex;    while (i <= middle && j <= higherIndex)    {     if (temp[i-lowerIndex] < temp[j-lowerIndex])     {      array[k] = temp[i-lowerIndex];      i++;     } else {      array[k] = temp[j-lowerIndex];      j++;     }     k++;    }    while (i <= middle)    {     array[k] = temp[i-lowerIndex];     k++;     i++;    }    while(j<=higherIndex)    {     array[k]=temp[j-lowerIndex];     k++;     j++;    }   }   }          static boolean isPal(String s)  {   for(int i=0, j=s.length()-1;i<=j;i++,j--)   {     if(s.charAt(i)!=s.charAt(j)) return false;   }   return true;  }  static String rev(String s)  {     StringBuilder sb=new StringBuilder(s);     sb.reverse();     return sb.toString();  }  static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}  static long gcdExtended(long a,long b,long[] x)  {    if(a==0){    x[0]=0;    x[1]=1;    return b;   }   long[] y=new long[2];   long gcd=gcdExtended(b%a, a, y);    x[0]=y[1]-(b/a)*y[0];   x[1]=y[0];    return gcd;  }   boolean findSum(int set[], int n, long sum)  {  if (sum == 0)   return true;  if (n == 0 && sum != 0)   return false;  if (set[n-1] > sum)   return findSum(set, n-1, sum);  return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);  }    public static long modPow(long base, long exp, long mod)  {   base = base % mod;   long result = 1;   while (exp > 0)   {    if (exp % 2 == 1)    {     result = (result * base) % mod;    }    base = (base * base) % mod;    exp = exp >> 1;   }   return result;  }   static long[] fac;  static long[] inv;  static long mod=(long)1e9+7;  public static void cal()  {   fac = new long[1000005];   inv = new long[1000005];   fac[0] = 1;   inv[0] = 1;   for (int i = 1; i <= 1000000; i++)   {    fac[i] = (fac[i - 1] * i) % mod;    inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;   }  }   public static long ncr(int n, int r)  {   return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;  }      static InputReader sc = new InputReader(System.in);  static PrintWriter out= new PrintWriter(System.out);    static class InputReader {    private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream) {     this.stream = stream;   }    public int snext()   {     if (snumChars == -1)       throw new InputMismatchException();     if (curChar >= snumChars) {       curChar = 0;       try {         snumChars = stream.read(buf);       } catch (IOException e) {         throw new InputMismatchException();       }       if (snumChars <= 0)         return -1;     }     return buf[curChar++];   }    public int nextInt()   {     int c = snext();     while (isSpaceChar(c))      {       c = snext();     }     int sgn = 1;     if (c == '-')     {       sgn = -1;       c = snext();     }     int res = 0;     do {       if (c < '0' || c > '9')         throw new InputMismatchException();       res *= 10;       res += c - '0';       c = snext();     } while (!isSpaceChar(c));     return res * sgn;   }    public long nextLong()    {     int c = snext();     while (isSpaceChar(c))      {       c = snext();     }     int sgn = 1;     if (c == '-')      {       sgn = -1;       c = snext();     }     long res = 0;     do {       if (c < '0' || c > '9')         throw new InputMismatchException();       res *= 10;       res += c - '0';       c = snext();     } while (!isSpaceChar(c));     return res * sgn;   }    public int[] nextIntArray(int n)   {     int a[] = new int[n];     for (int i = 0; i < n; i++)      {       a[i] = nextInt();     }     return a;   }    public long[] nextLongArray(int n)   {     long a[] = new long[n];     for (int i = 0; i < n; i++)      {       a[i] = nextLong();     }     return a;   }       public String nextLine()   {     int c = snext();     while (isSpaceChar(c))       c = snext();     StringBuilder res = new StringBuilder();     do {       res.appendCodePoint(c);       c = snext();     } while (!isEndOfLine(c));     return res.toString();   }    public boolean isSpaceChar(int c)    {     if (filter != null)       return filter.isSpaceChar(c);     return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    private boolean isEndOfLine(int c)    {     return c == '\n' || c == '\r' || c == -1;   }    public interface SpaceCharFilter    {     public boolean isSpaceChar(int ch);   }   }   static int i()  {   return sc.nextInt();  }  static long l(){   return sc.nextLong();  }  static int[] iarr(int n)  {   return sc.nextIntArray(n);  }  static long[] larr(int n)  {   return sc.nextLongArray(n);  }  static String s(){   return sc.nextLine();  }   }
6	public class CF_8C {  public static void main(String[] args) {      Scanner in = new Scanner(System.in);     int hb_x = in.nextInt(), hb_y = in.nextInt();  int n = in.nextInt();  int[] ox = new int[n];  int[] oy = new int[n];        int[][] dt = new int[n][n];  int[] hbd = new int[n];  for (int i = 0; i < n; i++) {  ox[i] = in.nextInt();  oy[i] = in.nextInt();  hbd[i] = (ox[i] - hb_x) * (ox[i] - hb_x)   + (oy[i] - hb_y) * (oy[i] - hb_y);  }     for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++) {   dt[i][j] = (ox[i] - ox[j]) * (ox[i] - ox[j])    + (oy[i] - oy[j]) * (oy[i] - oy[j]);  }  }      int[] sofar = new int[1 << n];  int[] masks = new int[1 << n];  sofar[0] = 0;  for (int i = 1; i < (1 << n); i++) {  sofar[i] = -1;  }   for (int i = 0; i < (1 << n); i++) {  if (sofar[i] != -1) {   for (int maskbit = 0; maskbit < n; maskbit++) {      if (((1 << maskbit) & i) == 0) {    int iffirst = ((1 << maskbit) | i);    int fromold = sofar[i] + 2 * hbd[maskbit];       if (sofar[iffirst] == -1 || sofar[iffirst] > fromold) {        sofar[iffirst] = fromold;    masks[iffirst] = i;    }           for (int otherone = 0; otherone < n; otherone++) {    if (((1 << otherone) & iffirst) == 0) {     int iffollow = ((1 << otherone) | iffirst);     int fromi = sofar[i] + hbd[maskbit] + dt[maskbit][otherone] + hbd[otherone];              if (sofar[iffollow] == -1 || sofar[iffollow] > fromi) {     sofar[iffollow] = fromi;     masks[iffollow] = i;     }    }    }    break;   }   }  }  }              int end_val = (1 << n) - 1;   System.out.println(sofar[end_val]);  System.out.print(0);  while (end_val > 0) {    int diff = end_val ^ masks[end_val];  int obj1 = -1, obj2 = -1;  for (int i = 0; i < n; i++) {   if (((1 << i) & diff) > 0) {   obj2 = obj1;   obj1 = i;   }  }    if (obj2 >= 0) {     System.out.print(" " + (obj1 + 1) + " " + (obj2 + 1) + " 0");  } else {     System.out.print(" " + (obj1 + 1) + " 0");  }  end_val = masks[end_val];  }   in.close(); } }
2	public class Main{ static long s; static boolean check(long n){  int sum = 0;  long storen=n;  while(n>0){  int k = (int)(n%10);  n /=10;  sum+=k;  }  return storen-(long)sum >= s; } public static void main(String args[]){  PrintWriter pw=new PrintWriter(System.out);  InputReader ip=new InputReader(System.in);   long n;  n=ip.nextLong();  s=ip.nextLong();  if(s>n){  pw.println("0");  }  else{  long l=0,r=n;  boolean possible=false;  long mid=0;  int it=100;  while(it-->0){   mid = (l+r)/2;   if(check(mid)){   r=mid;   possible = true;   }   else{   l=mid+1;   }     }  if(possible){   pw.println(n-l+1);  }   else{   pw.println("0");  }  }   pw.close(); } static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1)     throw new InputMismatchException();    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine() {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }   public int nextInt() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble() {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.') {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.') {     c = read();     double m = 1;     while (!isSpaceChar(c)) {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString() {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next() {    return readString();   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
0	public class Counterexample483A {  public static void main(String[] args)  {     Scanner sc = new Scanner(System.in);      long l = sc.nextLong();     long r = sc.nextLong();     if (l==r || l+1 == r)   {    System.out.println(-1);    return;   }   if (l+2 == r && l%2 == 1)   {    System.out.println(-1);    return;   }   if (l%2 == 0)   {    System.out.println(l + " " + (l+1) + " " + (l+2));    return;   }   System.out.println((l+1) + " " + (l+2) + " " + (l+3));  } }
3	public class D_Edu_Round_35 {  public static long MOD = 1000000007;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int[] data = new int[n];   for (int i = 0; i < n; i++) {    data[i] = in.nextInt();   }   FT tree = new FT(n + 1);   int result = 0;   for (int i = n - 1; i >= 0; i--) {    tree.update(data[i], 1);    result += tree.get(data[i] - 1);    result %= 2;   }   int q = in.nextInt();   int[] tmp = new int[n];   for (int i = 0; i < q; i++) {    int l = in.nextInt() - 1;    int r = in.nextInt() - 1;    FT a = new FT(n + 1);    int total = r - l + 1;    total = total * (total - 1) / 2;    total %= 2;                    result += total;    result %= 2;           if (result % 2 == 0) {     out.println("even");    } else {     out.println("odd");    }   }   out.close();  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   public void update(int index, int value) {    while (index < data.length) {     data[index] += value;     data[index] %= 2;     index += (index & (-index));    }   }   public int get(int index) {    int result = 0;    while (index > 0) {     result += data[index];     result %= 2;     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, long MOD) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2, MOD);   if (b % 2 == 0) {    return val * val % MOD;   } else {    return val * (val * a % MOD) % MOD;   }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() throws FileNotFoundException {       br = new BufferedReader(new InputStreamReader(System.in));      }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
2	public class main implements Runnable{  static ArrayList <Integer> adj[];  static int co=0,f=0;  static void Check2(int n){   adj=new ArrayList[n+1];   for(int i=0;i<=n;i++){    adj[i]=new ArrayList<>();   }  }  static void add(int i,int j){   adj[i].add(j);   adj[j].add(i);  }  public static void main(String[] args) {   new Thread(null, new main(), "Check2", 1<<26).start();  }  static long mod=(long)(1e9+7);  public void run() {        InputReader in = new InputReader(System.in);   PrintWriter w = new PrintWriter(System.out);    long n=in.nextLong();   long s=in.nextLong();     long l=1;   long r=(long)(n);   long ans=-1;   while(l<=r){       long mid=(l+r)/2;    if(ch(mid,s)){     ans=mid;     r=mid-1;    }    else    {     l=mid+1;    }      }   if(ans==-1)w.println(0);   else    w.println(n-ans+1);   w.close();  }   public boolean ch(long a,long s){       long p=0;    long val=a;    while(val>0){     p=p+val%10;     val=val/10;    }    if(a-p>=s)return true;    return false;      }  public boolean rec(int a,int b,int x,int y,int c,int d,int co){   if(a>x|b>y)return false;   if(a<-100000||b<-100000||co>100000)return false;   if(a==x&&b==y)return true;    return (rec(a+c,b+d,x,y,c,d,co+1)||rec(a+c,b-d,x,y,c,d,co+1)||rec(a-c,b+d,x,y,c,d,co+1)||rec(a-c,b-d,x,y,c,d,co+1));   }   static int gcd(int a,int b){   if(b==0)return a;   return gcd(b,a%b);  }  static void dfs(int i,int v[],int val,int b[]){    if(v[i]==1)return ;   v[i]=1;   b[i]=val;   Iterator <Integer> it=adj[i].iterator();   while(it.hasNext()){    int q=it.next();    dfs(q,v,val,b);   }    }  static void sev(int a[],int n){   for(int i=2;i<=n;i++)a[i]=i;   for(int i=2;i<=n;i++){    if(a[i]!=0){     for(int j=2*i;j<=n;){      a[j]=0;      j=j+i;     }    }   }  }  static class pair implements Comparable<pair> {   int x,y;   pair(int c,int d){    x=c;    y=d;   }   public int compareTo(pair o){    return (this.x-o.x);    }   }  static class node{   int y;   int val;   node(int a,int b){    y=a;    val=b;   }   }  static void rec(String s,int a,int b,int n){   if(b==n){    System.out.println(s);    return ;   }   String p=s;   if(a>b){    s=p+")" ;    rec(s,a,b+1,n);   }   if(a<n){    s=p+"(";    rec(s,a+1,b,n);   }    }  static class InputReader  {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private SpaceCharFilter filter;   public InputReader(InputStream stream)   {    this.stream = stream;   }   public int read()   {    if (numChars==-1)     throw new InputMismatchException();    if (curChar >= numChars)    {     curChar = 0;     try     {      numChars = stream.read(buf);     }     catch (IOException e)     {      throw new InputMismatchException();     }     if(numChars <= 0)      return -1;    }    return buf[curChar++];   }   public String nextLine()   {    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }   public int nextInt()   {    int c = read();    while(isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-')    {     sgn = -1;     c = read();    }    int res = 0;    do    {     if(c<'0'||c>'9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public long nextLong()   {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-')    {     sgn = -1;     c = read();    }    long res = 0;    do    {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    while (!isSpaceChar(c));    return res * sgn;   }   public double nextDouble()   {    int c = read();    while (isSpaceChar(c))     c = read();    int sgn = 1;    if (c == '-')    {     sgn = -1;     c = read();    }    double res = 0;    while (!isSpaceChar(c) && c != '.')    {     if (c == 'e' || c == 'E')      return res * Math.pow(10, nextInt());     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = read();    }    if (c == '.')    {     c = read();     double m = 1;     while (!isSpaceChar(c))     {      if (c == 'e' || c == 'E')       return res * Math.pow(10, nextInt());      if (c < '0' || c > '9')       throw new InputMismatchException();      m /= 10;      res += (c - '0') * m;      c = read();     }    }    return res * sgn;   }   public String readString()   {    int c = read();    while (isSpaceChar(c))     c = read();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = read();    }    while (!isSpaceChar(c));    return res.toString();   }   public boolean isSpaceChar(int c)   {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public String next()   {    return readString();   }   public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }  }    }
5	public class A {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] A = new int[n];   for (int i = 0; i < n; i++)    A[i] = in.nextInt();   Arrays.sort(A);   int cnt = 0;   for (int i = n - 1; i >= 0; i--) {    if (k >= m) {     System.out.println(cnt);     return;    }    cnt++;    k += A[i] - 1;   }   if (k >= m)    System.out.println(cnt);   else    System.out.println(-1);  } }
1	public class Array {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int n = in.nextInt();  int k = in.nextInt();   int last[] = new int[100001];  int distinct = 0;  for ( int i = 0 ; i < n ; ++i ) {  int t = in.nextInt();  if ( last[t] == 0 ) ++distinct;  last[t] = i+1;  if ( distinct == k ) {   int min = i+1;   for ( int j = 0 ; j < last.length ; ++j ) {   if ( last[j] != 0 ) min = min>last[j]?last[j]:min;   }   System.out.println(min+" "+(i+1)); return;  }  }  System.out.println("-1 -1");  }  }
6	public class Main {  public static void main(String[] args) throws IOException {   new Main().run();  }  BufferedReader in;  PrintWriter out;  StringTokenizer st = new StringTokenizer("");   int INF = Integer.MAX_VALUE >> 1;   void run() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);        int x0 = nextInt();   int y0 = nextInt();   int N = nextInt();   int FULL_MASK = (1 << N) - 1;   int[] xs = new int [N];   int[] ys = new int [N];   for (int i = 0; i < N; i++) {    xs[i] = nextInt();    ys[i] = nextInt();   }        int[][] dist = new int [N][N];   for (int i = 0; i < N; i++)    for (int j = 0; j < N; j++)     dist[i][j] = dist(x0, y0, xs[i], ys[i]) + dist(xs[i], ys[i], xs[j], ys[j]) + dist(xs[j], ys[j], x0, y0);        int[] dp = new int [1 << N];   int[] pr = new int [1 << N];   Arrays.fill(dp, INF);   dp[0] = 0;   for (int mask = 0; mask < FULL_MASK; mask++) {    int i = Integer.numberOfTrailingZeros(~mask);    int imask = mask | (1 << i);    for (int j = i; j < N; j++) {     int jmask = mask | (1 << j);     if (jmask == mask) continue;     int ijmask = imask | jmask;     int nval = dp[mask] + dist[i][j];     if (dp[ijmask] > nval) {      dp[ijmask] = nval;      pr[ijmask] = mask;     }    }   }        out.println(dp[FULL_MASK]);   out.print("0");   for (int mask = FULL_MASK; mask != 0; mask = pr[mask]) {    int diff = mask ^ pr[mask];    int i = Integer.numberOfTrailingZeros(diff);    diff &= ~(1 << i);    int j = Integer.numberOfTrailingZeros(diff);    if (i != 32) out.print(" " + (i + 1));    if (j != 32) out.print(" " + (j + 1));    out.print(" 0");   }   out.println();   out.close();  }     int dist(int x1, int y1, int x2, int y2) {   return sqr(x2 - x1) + sqr(y2 - y1);  }  int sqr(int x) {   return x * x;  }    String nextToken() throws IOException {   while (!st.hasMoreTokens())    st = new StringTokenizer(in.readLine());   return st.nextToken();  }   int nextInt() throws IOException {   return Integer.parseInt(nextToken());  } }
5	public class A { static BufferedReader in; static PrintWriter out; static StringTokenizer st; static Random rnd;  void solve() throws IOException {  int n = nextInt();  int[] arr = new int[n];  Integer[] arrCopy = new Integer[n];  for (int i = 0; i < n; i++)  arr[i] = arrCopy[i] = nextInt();  Arrays.sort(arrCopy);  int bad = 0;  for (int i = 0; i < n; i++)  if (arr[i] != arrCopy[i])   ++bad;  boolean fail = bad > 2;  out.println(!fail ? "YES" : "NO"); }  public static void main(String[] args) {  new A().run(); }  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   rnd = new Random();   solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(42);  } }  String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  String line = in.readLine();   if (line == null)   return null;   st = new StringTokenizer(line);  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
6	public class LookingForOrder {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] parsedString = parsedString = in.readLine().split(" ");   int xStart = parseInt(parsedString[0]);   int yStart = parseInt(parsedString[1]);   int objectNum = parseInt(in.readLine());   int[] xLocs = new int[objectNum + 1];   int[] yLocs = new int[objectNum + 1];   int[] bitMasks = new int[1 << objectNum];   Arrays.fill(bitMasks, MAX_VALUE);   int[] previous = new int[1 << objectNum];   xLocs[objectNum] = xStart;   yLocs[objectNum] = yStart;   for (int i = 0; i < objectNum; i++) {    parsedString = in.readLine().split(" ");    xLocs[i] = parseInt(parsedString[0]);    yLocs[i] = parseInt(parsedString[1]);   }        int[][] times = new int[objectNum + 1][objectNum + 1];   for (int i = 0; i <= objectNum; i++) {    for (int j = 0; j <= objectNum; j++) {     times[i][j] = times[j][i] = (xLocs[i] - xLocs[j]) * (xLocs[i] - xLocs[j]) + (yLocs[i] - yLocs[j]) * (yLocs[i] - yLocs[j]);    }   }             bitMasks[0] = 0;   for (int i = 0; i < (1 << objectNum); i++) {    if (bitMasks[i] != MAX_VALUE) {     for (int j = 0; j < objectNum; j++) {      if (((1 << j) & i) == 0) {       int curState = (1 << j) | i;       int curTime = bitMasks[i] + 2 * times[objectNum][j];        if (curTime < bitMasks[curState]) {        bitMasks[curState] = curTime;        previous[curState] = i;       }              for (int k = 0; k < objectNum; k++) {        if (((1 << k) & curState) == 0) {         int kState = ((1 << k) | curState);                  int kTime = bitMasks[i] + times[objectNum][j] + times[j][k] + times[k][objectNum];         if (kTime < bitMasks[kState]) {          bitMasks[kState] = kTime;          previous[kState] = i;         }        }       }       break;      }     }    }   }   int finalState = (1 << objectNum) - 1;   StringBuilder sb = new StringBuilder();   sb.append(bitMasks[finalState]).append('\n');   Deque<Integer> outputQ = new ArrayDeque<>();   outputQ.add(0);   int curState = finalState;   while (curState > 0) {       int difference = curState ^ previous[curState];    int firstItem = -1;    int secondItem = -1;    for (int i = 0; i < objectNum; i++) {     if (((1 << i) & difference) > 0) {      secondItem = firstItem;      firstItem = i;     }    }    if (secondItem != -1) {         outputQ.add(firstItem + 1);     outputQ.add(secondItem + 1);     outputQ.add(0);    } else {     outputQ.add(firstItem + 1);     outputQ.add(0);    }    curState = previous[curState];   }   sb.append(outputQ.removeLast());   while (!outputQ.isEmpty()) {    sb.append(' ').append(outputQ.removeLast());   }   System.out.print(sb);  } }
4	public class C {  public static void main(String[] args) throws IOException {   FastScanner scn = new FastScanner();   PrintWriter out = new PrintWriter(System.out);   for (int tc = scn.nextInt(); tc > 0; tc--) {    int N = scn.nextInt();    int[] arr = new int[N];    for (int i = 0; i < N; i++) {     arr[i] = scn.nextInt();    }    StringBuilder[] ans = new StringBuilder[N];    ans[0] = new StringBuilder("1");    ArrayDeque<Integer> st = new ArrayDeque<>();    st.addLast(0);    for (int i = 1; i < N; i++) {         ans[i] = new StringBuilder();     if (arr[i] == 1) {      st.addLast(i);      ans[i].append(ans[i - 1].toString() + ".1");     } else {      while (arr[st.getLast()] != arr[i] - 1) {       st.removeLast();      }      int pos = st.removeLast();      String[] prev = ans[pos].toString().split("[.]");      for (int j = 0, sz = prev.length - 1; j < sz; j++) {       ans[i].append(prev[j] + ".");      }      ans[i].append(arr[i] + "");      st.addLast(i);     }    }    for (StringBuilder str : ans) {     out.println(str);    }   }   out.close();  }  private static int gcd(int num1, int num2) {   int temp = 0;   while (num2 != 0) {    temp = num1;    num1 = num2;    num2 = temp % num2;   }   return num1;  }  private static int lcm(int num1, int num2) {   return (int)((1L * num1 * num2) / gcd(num1, num2));  }  private static void ruffleSort(int[] arr) {                      }  private static class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner() {    this.br = new BufferedReader(new InputStreamReader(System.in));    this.st = new StringTokenizer("");   }   String next() {    while (!st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException err) {      err.printStackTrace();     }    }    return st.nextToken();   }   String nextLine() {    if (st.hasMoreTokens()) {     return st.nextToken("").trim();    }    try {     return br.readLine().trim();    } catch (IOException err) {     err.printStackTrace();    }    return "";   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }  } }
1	public class B {  public B () {  int N = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt();  int [] P = sc.nextInts();  TreeSet<Integer> S = new TreeSet<>();  Set<Integer> A = new HashSet<>();  Set<Integer> B = new HashSet<>();  for (int p : P) S.add(p);  while (!S.isEmpty()) {  int q = S.first();  int x = a - q, y = b - q;  if (S.contains(x) && S.contains(y)) {   if (x > y) {   S.remove(q); S.remove(x);   A.add(q); A.add(x);   } else {   S.remove(q); S.remove(y);   B.add(q); B.add(y);   }  }  else if (S.contains(x)) {   S.remove(q); S.remove(x);   A.add(q); A.add(x);  }  else if (S.contains(y)) {   S.remove(q); S.remove(y);   B.add(q); B.add(y);  }  else   exit("NO");  }  int [] res = new int[N];  for (int i : rep(N))  if (B.contains(P[i]))   res[i] = 1;  print("YES");  exit(res); }  private static int [] rep(int N) { return rep(0, N); } private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }  private final static IOUtils.MyScanner sc = new IOUtils.MyScanner(); private static void print (Object o, Object ... A) { IOUtils.print(o, A); } private static void exit (Object o, Object ... A) { IOUtils.print(o, A); IOUtils.exit(); } private static class IOUtils {  public static class MyScanner {  public String next() { newLine(); return line[index++]; }  public int nextInt() { return Integer.parseInt(next()); }  public String nextLine() { line = null; return readLine(); }  public String [] nextStrings() { return split(nextLine()); }  public int [] nextInts() {   String [] L = nextStrings();   int [] res = new int [L.length];   for (int i = 0; i < L.length; ++i)   res[i] = Integer.parseInt(L[i]);   return res;  }    private boolean eol() { return index == line.length; }  private String readLine() {   try {   return r.readLine();   } catch (Exception e) {   throw new Error (e);   }  }  private final java.io.BufferedReader r;  private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }  private MyScanner (java.io.BufferedReader r) {   try {   this.r = r;   while (!r.ready())    Thread.sleep(1);   start();   } catch (Exception e) {   throw new Error(e);   }  }  private String [] line;  private int index;  private void newLine() {   if (line == null || eol()) {   line = split(readLine());   index = 0;   }  }  private String [] split(String s) { return s.length() > 0 ? s.split(" ") : new String [0]; }  }  private static String build(Object o, Object ... A) { return buildDelim(" ", o, A); }  private static String buildDelim(String delim, Object o, Object ... A) {  StringBuilder b = new StringBuilder();  append(b, o, delim);  for (Object p : A)   append(b, p, delim);  return b.substring(delim.length());  }   private static void start() { if (t == 0) t = millis(); }  private static void append(StringBuilder b, Object o, String delim) {  if (o.getClass().isArray()) {   int len = java.lang.reflect.Array.getLength(o);   for (int i = 0; i < len; ++i)   append(b, java.lang.reflect.Array.get(o, i), delim);  } else if (o instanceof Iterable<?>)   for (Object p : (Iterable<?>) o)   append(b, p, delim);  else {   if (o instanceof Double)   o = new java.text.DecimalFormat("#.############").format(o);   b.append(delim).append(o);  }  }  private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out);  private static void print(Object o, Object ... A) { pw.println(build(o, A)); }  private static void err(Object o, Object ... A) { System.err.println(build(o, A)); }  private static void exit() {  IOUtils.pw.close();  System.out.flush();  err("------------------");  err(IOUtils.time());  System.exit(0);  }  private static long t;  private static long millis() { return System.currentTimeMillis(); }  private static String time() { return "Time: " + (millis() - t) / 1000.0; } } public static void main (String[] args) { new B(); IOUtils.exit(); } }
2	public class Main {  public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] in = br.readLine().split(" ");  long n = Long.parseLong(in[0]), s = Long.parseLong(in[1]);  Solver solver = new Solver(n, s);  System.out.println(solver.solve());  } } class Solver {  private long n, s;  Solver(long n, long s) {  this.n = n;  this.s = s; }  public long solve() {  long low = 1, high = n;  for (int i = 0; i < 72; ++i) {  long x = low + (high - low) / 2;  if (check(x))   high = x - 1;  else   low = x + 1;  }  return n - high; }  private boolean check(long x) {  long tmp = x;  int sum = 0;  while (tmp > 0) {  sum += tmp % 10;  tmp /= 10;  }  return x - sum >= s; } }
5	public class A {  private void solve() throws IOException {  int n = nextInt();  Integer[] a = new Integer[n];  Integer[] b = new Integer[n];   for (int i = 0; i < n; i++) {  a[i] = b[i] = nextInt();  }   Arrays.sort(a);  int k = 0;  for (int i = 0; i < n; i++) {  if (!a[i].equals(b[i])) {   k++;  }  }   if (k <= 2) {  println("YES");  } else {  println("NO");  } }  private String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  private int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  private double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private void print(Object o) {  writer.print(o); }  private void println(Object o) {  writer.println(o); }  private void printf(String format, Object... o) {  writer.printf(format, o); }  public static void main(String[] args) {  long time = System.currentTimeMillis();  Locale.setDefault(Locale.US);  new A().run();  System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time)); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  private void run() {  try {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch (IOException e) {  e.printStackTrace();  System.exit(13);  } } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   MyScanner in = new MyScanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, MyScanner in, PrintWriter out) {   int n = in.nextInt();   int[] as = new int[n];   for (int i = 0; i < n; i++) as[i] = in.nextInt();   int[] sorted = as.clone();   ArrayUtils.sort(sorted);   int diff = 0;   for (int i = 0; i < n; i++)if(as[i]!=sorted[i])diff++;   if(diff<=2)out.println("YES");   else out.println("NO");  } } class MyScanner {  private final InputStream in;  public MyScanner(InputStream in){   this.in = in;  }  public int nextInt(){   try{    int c=in.read();    if(c==-1) return c;    while(c!='-'&&(c<'0'||'9'<c)){     c=in.read();     if(c==-1) return c;    }    if(c=='-') return -nextInt();    int res=0;    do{     res*=10;     res+=c-'0';     c=in.read();    }while('0'<=c&&c<='9');    return res;   }catch(Exception e){    return -1;   }  }   } class ArrayUtils {  public static void swap(int[] is, int i, int j) {   int t = is[i];   is[i] = is[j];   is[j] = t;  }  public static void shuffle(int[] S) {   Random rnd = r == null ? (r = new Random()) : r;   shuffle(S, rnd);  }  private static Random r;  private static void shuffle(int[] S, Random rnd) {   for (int i = S.length; i > 1; i--)    swap(S, i - 1, rnd.nextInt(i));  }   public static void sort(int[] a) {   shuffle(a);   Arrays.sort(a);  } }
1	public class Main { static Scanner in; static PrintWriter out;  public static void main(String[] args) throws Exception {  in = new Scanner(System.in);  out = new PrintWriter(System.out);   int n = in.nextInt();  int k = in.nextInt();  boolean[] p = new boolean[n + 5];  int[] pp = new int[n + 5];  int ind = 0;  Arrays.fill(p, true);  p[0] = false;  p[1] = false;  for (int i = 2; i < n + 5; i++)  if (p[i]) {   pp[ind++] = i;   for (int j = 2*i; j < n + 5; j += i) p[j] = false;  }    boolean[] b = new boolean[n + 1];  for (int i = 0; i < ind - 1; i++)  if (pp[i] + pp[i + 1] + 1 <= n && p[pp[i] + pp[i + 1] + 1]) b[pp[i] + pp[i + 1] + 1] = true;   int kol = 0;  for (int i = 2; i <= n; i++)   if (b[i]) kol++;  if (kol >= k) out.println("YES");  else out.println("NO");  out.close(); } }
6	public class CF_8C implements Runnable { int[] step = new int[1 << 24];  int[] steplast = new int[1 << 24];  int n; int vs[] = new int[24]; int vd[][] = new int[24][24]; int x_bag, y_bag; int x[] = new int[24], y[] = new int[24];  private void solve() throws IOException {  x_bag = nextInt();  y_bag = nextInt();  n = nextInt();  for (int i = 0; i < n; i++) {  x[i] = nextInt();  y[i] = nextInt();  }    for (int i = 0; i < n; i++) {  vs[i] = 2 * ((x[i] - x_bag) * (x[i] - x_bag) + (y[i] - y_bag) * (y[i] - y_bag));  }  for (int i = 0; i < n; i++) {  for (int j = i + 1; j < n; j++) {   vd[i][j] =    (x[i] - x_bag) * (x[i] - x_bag)     + (y[i] - y_bag) * (y[i] - y_bag)     + (x[j] - x_bag) * (x[j] - x_bag)     + (y[j] - y_bag) * (y[j] - y_bag)     + (x[i] - x[j]) * (x[i] - x[j])     + (y[i] - y[j]) * (y[i] - y[j]);  }  }    for (int i = 1; i < 1 << n; i++) {  int j, k = 0, l, m, lastState;  for (j = 1; (i & j) == 0 && j < 1 << n; j <<= 1) {   k++;  }  lastState = i & (~j);  step[i] = step[lastState] + vs[k];  steplast[i] = lastState;  m = k;  for (l = j << 1; l < 1 << n; l <<= 1) {   m++;   if ((lastState & l) != 0) {   if (step[i] > step[lastState & (~l)] + vd[k][m]) {    step[i] = step[lastState & (~l)] + vd[k][m];    steplast[i] = lastState & (~l);   }   }  }    }  writer.println(step[(1 << n) - 1]);  int i = (1 << n) - 1;  writer.print("0 ");  while (i != 0) {  for (int j = 1, m = 1; j <= i; j <<= 1, m++) {   if ((j & (i ^ steplast[i])) != 0) {   writer.print(m + " ");   }  }  writer.print("0 ");  i = steplast[i];  } }  public static void main(String[] args) {  new CF_8C().run(); }  BufferedReader reader; StringTokenizer tokenizer; PrintWriter writer;  public void run() {  try {  reader = new BufferedReader(new InputStreamReader(System.in));  tokenizer = null;  writer = new PrintWriter(System.out);  solve();  reader.close();  writer.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); } }
0	public class Rules { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  int a = in.nextInt();  double maxSpeed = in.nextInt();  double len = in.nextInt();  double delayDist = in.nextInt();  double delaySpeed = in.nextInt();     double timeToDelayAtMax = travelS(a, 0.0, maxSpeed, delayDist);  double timeToDelayAtDelay = travelS(a, 0.0, delaySpeed, delayDist);  if (Math.abs(timeToDelayAtMax-timeToDelayAtDelay) < 0.00001) {    double time = travelS(a, 0.0, maxSpeed, len);  System.out.printf("%.9f\n", time);  return;  }     double lowV = delaySpeed;  double highV = maxSpeed;  int loopCount = 1000;  double[] initial = null;  double[] secondary = null;  while (loopCount-->0) {  double guessV = (lowV+highV)/2.0;  initial = travelA(a, 0.0, guessV);  secondary = travelA(a, guessV, Math.min(delaySpeed, maxSpeed));  if (initial[1] + secondary[1] < delayDist) {   lowV = guessV;  } else {   highV = guessV;  }  }  double totalTime = 0.0;  double finalSpeed = 0.0;  initial = travelA(a, 0.0, lowV);  secondary = travelA(a, lowV, delaySpeed);  totalTime = initial[0] + secondary[0];  double totalDist = initial[1] + secondary[1];  totalTime += (delayDist-totalDist)/maxSpeed;     totalTime += travelS(a, delaySpeed, maxSpeed, len-delayDist);  System.out.printf("%.9f\n", totalTime); }    public static double[] travelA(int a, double startSpeed, double endSpeed) {  if (startSpeed > endSpeed)  a = -a;   double time = (endSpeed - startSpeed) / a;  double dist = 0.5*a*time*time + startSpeed*time;  return new double[] {time, dist}; }   public static double travelS(int a, double startSpeed, double maxSpeed, double dist) {  double timeToMax = (maxSpeed - startSpeed) / a;  double targetTime = (-startSpeed + Math.sqrt(startSpeed*startSpeed + 2*a*dist)) / a;  if (targetTime < timeToMax)  return targetTime;   double partialDist = 0.5*timeToMax*timeToMax*a + startSpeed*timeToMax;  double remainingDist = dist - partialDist;  targetTime = remainingDist / maxSpeed;  return targetTime + timeToMax; } }
3	public class Main911D { public static void main(String[] args) {  run(System.in, System.out); }  public static void run(InputStream in, PrintStream out) {  try (Scanner sc = new Scanner(in)) {  int n = sc.nextInt();  int[] t = new int[n];  int inv = 0;  for (int i = 0; i < n; i++) {   t[i] = sc.nextInt();   for (int j = 0; j < i; j++) {   if (t[j] > t[i]) inv++;   }  }   inv = inv % 2;  int m = sc.nextInt();  for (int i = 0; i < m; i++) {   int a = sc.nextInt();   int b = sc.nextInt();   int s = b - a + 1;   inv = (inv + s * (s - 1) / 2) % 2;   out.println(inv == 0 ? "even" : "odd");   }  } } }
4	public class p1523C {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int t = sc.nextInt();   for (int i = 0; i < t ; i++) {    int n = sc.nextInt();    ArrayList<Stack<Integer>> ar = new ArrayList<Stack<Integer>>();    for (int j = 0; j < n + 1; j++) {     ar.add(new Stack<Integer>());    }    HashMap <Integer , Integer> hm = new HashMap<Integer, Integer>();    StringBuilder cur = new StringBuilder();    int l = 0;    for (int j = 0; j < n; j++) {     int a = sc.nextInt();     if( a == 1)     {      if(cur.length() == 0)       cur.append("1");      else       cur.append(".1");      l++;      ar.get(1).add(l);      hm.put(l , 1);     }     else     {      int newl = ar.get( a - 1).pop();      for (int k = newl + 1; k <= l ; k++) {       ar.get(hm.get(k)).pop();       hm.remove(k);       cur.delete(cur.lastIndexOf(".") + 1, cur.length());       cur.delete(cur.length() - 1 , cur.length());      }      cur.delete(cur.lastIndexOf(".") + 1, cur.length());      cur.append(a);      ar.get(a).add(newl);      hm.put(newl , a);      l = newl;     }     System.out.println(cur);    }   }  } }
6	public class Main{  BufferedReader in;  StringTokenizer str = null;  PrintWriter out;  private String next() throws Exception{  if (str == null || !str.hasMoreElements())   str = new StringTokenizer(in.readLine());  return str.nextToken();  }   private int nextInt() throws Exception{  return Integer.parseInt(next());  }  int []x,y;  int n;  int []dp, prev;   public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   int xs = nextInt();  int ys = nextInt();  n = nextInt();  x = new int[n];  y = new int[n];  for(int i=0;i<n;i++){   x[i] = nextInt();   y[i] = nextInt();  }   int one[] = new int[n];  for(int i=0;i<n;i++){   one[i] = dist(xs, ys, x[i], y[i]);  }   int two[][] = new int[n][n];  for(int i=0;i<n;i++){   for(int j=i+1;j<n;j++){   two[i][j] = two[j][i] = dist(xs, ys, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(xs, ys, x[j], y[j]);   }  }   dp = new int[1<<n];  Arrays.fill(dp, Integer.MAX_VALUE/2);  dp[0] = 0;  prev = new int[1<<n];  Arrays.fill(prev, -1);   for(int mask=1;mask<(1<<n);mask++){   int i = 0;   while((mask & (1<<i)) == 0) i++;   dp[mask] = dp[mask ^ (1<<i)] + 2*one[i];   prev[mask] = i+1;   for(int j=i+1;j<n;j++){   if ((mask & (1<<j)) > 0) {    if (dp[mask] > dp[mask ^ (1<<i) ^ (1<<j)] + two[i][j]) {    dp[mask] = dp[mask ^ (1<<i) ^ (1<<j)] + two[i][j];    prev[mask] = 100 * (i+1) + (j+1);    }   }   }  }   out.println(dp[(1<<n)-1]);  out.print(0 + " ");  int cur = (1<<n)-1;  int i = 0, j = 0;  while(cur > 0) {   i = prev[cur]/100;   j = prev[cur]%100;     if (i > 0) {   cur^=1<<(i-1);   out.print(i + " ");   }   if (j > 0) {   cur^=1<<(j-1);   out.print(j + " ");   }   out.print(0 + " ");  }        out.close();  }  private String bit2str(int mask, int n) {  String s = "";  for(int i=0;i<n;i++){   if ((mask & (1<<i)) > 0){   s+="1";   }else{   s+="0";   }  }  while(s.length() < n)   s+="0";   return new StringBuilder(s).reverse().toString();  }  private int dist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);  }  public static void main(String args[]) throws Exception{  new Main().run();  } }
0	public class p481a {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   long l = sc.nextLong();   long r = sc.nextLong();   if (r - l <= 1) {    System.out.println("-1");   } else if (r - l >= 3) {    if (l % 2 == 0) {     System.out.println(l + " " + (l + 1) + " " + (l + 2));    } else {     System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));    }   } else {    long g1 = GCD(l, (l + 1));    long g2 = GCD((l + 1), (l + 2));    long g3 = GCD(l, r);    if (g1 == 1 && g2 == 1 && g3 != 1) {     System.out.println(l + " " + (l + 1) + " " + r);    } else {     System.out.println("-1");    }   }  }  public static long GCD(long a, long b) {   if (b == 0) return a;   return GCD(b, a % b);  } }
4	public class C1523 { public static void print(Stack<Integer> st, PrintWriter pw) {  for (int i = 0; i < st.size(); i++) {  pw.print(st.get(i));  if (i != st.size() - 1) {   pw.print(".");  }  }  pw.println(); }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int t = sc.nextInt();  while (t-- > 0) {  int n = sc.nextInt();  int[] arr = sc.nextIntArr(n);  Stack<Integer> st = new Stack<Integer>();  st.add(arr[0]);  print(st, pw);  for (int i = 1; i < n; i++) {   if (arr[i] == 1) {   st.add(arr[i]);   } else {   while (st.peek() != arr[i] - 1) {    st.pop();   }   st.pop();   st.add(arr[i]);   }   print(st, pw);  }  }  pw.close(); }  static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader f) {  br = new BufferedReader(f);  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public int[] nextIntArr(int n) throws IOException {  int[] arr = new int[n];  for (int i = 0; i < n; i++) {   arr[i] = Integer.parseInt(next());  }  return arr;  }  } }
1	public class Solver {  StringTokenizer st;  BufferedReader in;  PrintWriter out;  public static void main(String[] args) throws NumberFormatException,    IOException {   Solver solver = new Solver();   solver.open();   long time = System.currentTimeMillis();   solver.solve();   if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {    System.out.println("Spent time: "      + (System.currentTimeMillis() - time));   }   solver.close();  }  public void open() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  }  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  public int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  }  public void solve() throws NumberFormatException, IOException {   int n = nextInt();   int k = nextInt();     int[] ar = new int[n];   int[] ex = new int[100005];   int dif = 0;     for(int i=0;i<n;i++){    int tmp = nextInt();    ar[i] = tmp;    if (ex[tmp]++==0){     dif++;      }      }     if (dif<k){    out.println("-1 -1");    return;   }     Arrays.fill(ex, 0);   dif = 0;   int right = 0;   while(dif<k){    int tmp = ar[right];    if(ex[tmp]++==0){       dif++;    }    right++;   }     int left = 0;   while (ex[ar[left]]-- > 1) left++;     out.println((left+1)+" "+right);  }  public void close() {   out.flush();   out.close();  } }
6	public class Main {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String[] parsedString;   int objectNum = 0;   int xStart=0;   int yStart=0;   parsedString = in.readLine().split(" ");   xStart = Integer.parseInt(parsedString[0]);   yStart = Integer.parseInt(parsedString[1]);   objectNum = Integer.parseInt(in.readLine());   int[] xLocs = new int[objectNum+1];   int[] yLocs = new int[objectNum+1];   int[] bitMasks = new int[1<<objectNum];   Arrays.fill(bitMasks, -1);   int[] previous = new int[1<<objectNum];   xLocs[objectNum]=xStart;   yLocs[objectNum]=yStart;   for(int i=0; i<objectNum; i++){    parsedString = in.readLine().split(" ");    xLocs[i] = Integer.parseInt(parsedString[0]);    yLocs[i] = Integer.parseInt(parsedString[1]);   }        int[][] times = new int[objectNum+1][objectNum+1];   for(int i=0;i<=objectNum;i++){    for(int j=0; j<=objectNum;j++){     times[i][j] = times[j][i] = (xLocs[i]-xLocs[j])*(xLocs[i]-xLocs[j])+(yLocs[i]-yLocs[j])*(yLocs[i]-yLocs[j]);    }   }             bitMasks[0] = 0;        for (int i=0; i<(1<<objectNum); i++){    if(bitMasks[i]==-1) {    }else{     for(int j=0; j<objectNum; j++){      if(((1<<j)&i) == 0){       int curState = (1<<j) | i;       int curTime = bitMasks[i] + 2*times[objectNum][j];        if(bitMasks[curState] == -1 || curTime < bitMasks[curState]){        bitMasks[curState] = curTime;        previous[curState] = i;       }        for(int k=0; k<objectNum; k++){        if(((1<<k) & curState) == 0){         int kState = ((1<<k) | curState);                  int kTime = bitMasks[i] + times[objectNum][j] + times[j][k] + times[k][objectNum];         if(bitMasks[kState] == -1 || kTime < bitMasks[kState]){          bitMasks[kState] = kTime;          previous[kState] = i;         }        }       }       break;      }     }    }   }   int finalState = (1<<objectNum)-1;   System.out.println(bitMasks[finalState]);   Deque<Integer> outputQ = new ArrayDeque<Integer>();   outputQ.add(0);   int curState = finalState;   while(curState>0){           int difference = curState ^ previous[curState];    int firstItem = -1;    int secondItem = -1;    for(int i=0; i<objectNum; i++){     if(((1<<i)&difference)>0){      secondItem=firstItem;      firstItem=i;     }    }    if(secondItem!=-1){          outputQ.add(firstItem+1);     outputQ.add(secondItem+1);     outputQ.add(0);    }    else{     outputQ.add(firstItem + 1);     outputQ.add(0);    }    curState = previous[curState];   }   System.out.print(outputQ.removeLast());   while(!outputQ.isEmpty()){    System.out.print(" ");    System.out.print(outputQ.removeLast());   }  } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, PrintWriter out) {   int n=in.nextInt();   int arr[]=new int[n];   in.getArray(arr);   int arrc[]=new int[n];   for(int i=0;i<n;i++){    arrc[i]=arr[i];   }   Library.sort(arrc);   int c=0;   for(int i=0;i<n;i++){    if(arrc[i]!=arr[i]){     c++;    }   }   if(c>2){    out.println("NO");   }   else{    out.println("YES");   } } } class InputReader{  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream){   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }  public String next(){   while (tokenizer == null||!tokenizer.hasMoreTokens()){    try{     tokenizer = new StringTokenizer(reader.readLine());    }    catch (IOException e){     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt(){   return Integer.parseInt(next());  }  public void getArray(int arr[]){   for(int i=0;i<arr.length;i++){    arr[i]=nextInt();   }  }  } class Library{  public static void sort(int n[]){   int len=n.length;   int l1=len/2;   int l2=len-l1;   int n1[]=new int[l1];   int n2[]=new int[l2];   for(int i=0;i<l1;i++){    n1[i]=n[i];   }   for(int i=0;i<l2;i++){    n2[i]=n[i+l1];   }   if(l1!=0){    sort(n1);    sort(n2);   }   int ind1=0;   int ind2=0;   int ind=0;   for(int i=0;i<len&&ind1<l1&&ind2<l2;i++){    if(n1[ind1]<n2[ind2]){     n[i]=n1[ind1];     ind1++;    }    else{     n[i]=n2[ind2];     ind2++;    }    ind++;   }   if(ind1<l1){    for(int i=ind1;i<l1;i++){     n[ind]=n1[i];     ind++;    }   }   if(ind2<l2){    for(int i=ind2;i<l2;i++){     n[ind]=n2[i];     ind++;    }   }  }   }
0	public class trafficerules {   public static void main(String[] args) throws Exception {  if ("Satayev".equals(System.getProperty("user.name"))) {  long start = System.nanoTime();  new trafficerules().solve(new FileInputStream("input"));  System.err.printf("Time elapsed: %d ms.\n", (System.nanoTime()-start)/1000000);  }  else  new trafficerules().solve(System.in);  }  void solve(InputStream is) throws Exception {  Scanner in = new Scanner(is);   double a = in.nextDouble(), maxv = in.nextDouble(), s = in.nextDouble(), d = in.nextDouble(), w = in.nextDouble();   if (maxv < w)  w = maxv;   double t = 0;      double t1 = w / a;  double s1 = a*t1*t1/2;  double v1 = w;  if ( s1 < d ) {  v1 = w;    if (v1 >= maxv)   t1 += (d-s1)/v1;  else {   double tt = (maxv - v1)/a;   double ss = v1*tt+a*tt*tt/2;   ss *= 2;   if (s1 + ss < d)   t1 += tt*2 + (d-s1-ss)/maxv;   else {   ss = (d-s1)/2;      double A = a/2;   double B = v1;   double C = -ss;   double D = B*B - 4 * A * C;   tt = (-B + Math.sqrt(D))/2/A;   t1 += tt*2;   }  }    s1 = d;  }  if (s1 > d) {  s1 = d;  t1 = Math.sqrt(2*s1/a);  v1 = a * t1;  }   t += t1;   double t2 = (maxv - v1) / a;  double s2 = v1*t2 + a*t2*t2/2;  double v2 = maxv;  if (s1 + s2 < s) {  v2 = maxv;  t2 += (s-s1-s2)/v2;  }  if (s1 + s2 > s) {  s -= s1;      double A = a/2;  double B = v1;  double C = -s;  double D = B*B - 4*A*C;    t2 = (-B + Math.sqrt(D))/2/A;  }   t += t2;   System.out.println(t);  } }
2	public class C {  private static final String REGEX = " "; private static final Boolean DEBUG = false; private static final String FILE_NAME = "input.txt";  public static void main(String[] args) throws IOException {  if (DEBUG) {  generate();  }  Solver solver = new Solver();  solver.readData();  solver.solveAndPrint(); }  private static void generate() throws IOException {  }  private static class Solver {  long n, s;  void readData() throws IOException {  InputStream in = DEBUG ? new FileInputStream(FILE_NAME) : System.in;  Scanner scanner = new Scanner(in);  n = scanner.nextLong();  s = scanner.nextLong();  scanner.close();  }  void solveAndPrint() {  long cur = s + 1;  long sum = getSum(cur);  long res = 0;  while (cur <= n) {   if (cur - sum >= s) {   System.out.println(n - cur + 1);   return;   }   cur++;   if (cur % 10 != 0) {   sum++;   } else {   sum = getSum(cur);   }  }  System.out.println(0);  }  long getSum(long cur) {  long res = 0;  while (cur > 0) {   res += cur % 10;   cur /= 10;  }  return res;  }   @SuppressWarnings("SameParameterValue")  int[] splitInteger(String string, int n) {  final String[] split = string.split(REGEX, n);  int[] result = new int[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Integer.parseInt(split[i]);  }  return result;  }  public int[] splitInteger(String string) {  return splitInteger(string, 0);  }   @SuppressWarnings("SameParameterValue")  long[] splitLong(String string, int n) {  final String[] split = string.split(REGEX, n);  long[] result = new long[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Long.parseLong(split[i]);  }  return result;  }  public long[] splitLong(String string) {  return splitLong(string, 0);  }  @SuppressWarnings("SameParameterValue")  double[] splitDouble(String string, int n) {  final String[] split = string.split(REGEX, n);  double[] result = new double[split.length];  for (int i = 0; i < n; ++i) {   result[i] = Double.parseDouble(split[i]);  }  return result;  }  public double[] splitDouble(String string) {  return splitDouble(string, 0);  }  @SuppressWarnings("SameParameterValue")  String[] splitString(String string, int n) {  return string.split(REGEX, n);  }  public String[] splitString(String string) {  return splitString(string, 0);  }  public int max(int a, int b) {  return Math.max(a, b);  }  public long max(long a, long b) {  return Math.max(a, b);  }  public int min(int a, int b) {  return Math.min(a, b);  }  public long min(long a, long b) {  return Math.min(a, b);  }  public double max(double a, double b) {  return Math.max(a, b);  }  public double min(double a, double b) {  return Math.min(a, b);  }  private final static int MOD = 1000000009;  int multMod(int a, int b) {  return ((a % MOD) * (b % MOD)) % MOD;  }  int sumMod(int a, int b) {  return ((a % MOD) + (b % MOD)) % MOD;  }  long multMod(long a, long b) {  return ((a % MOD) * (b % MOD)) % MOD;  }  long sumMod(long a, long b) {  return ((a % MOD) + (b % MOD)) % MOD;  } }  }
1	public class Main {  public static void main(String [] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));     StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int a = Integer.parseInt(st.nextToken());  int b = Integer.parseInt(st.nextToken());  st = new StringTokenizer(f.readLine());  HashMap<Integer,Integer> in = new HashMap<Integer,Integer>();  int[][] locs = new int[n][2];  for (int i=0;i<n;i++) {  int num = Integer.parseInt(st.nextToken());  locs[i] = new int[]{num,i};  in.put(num,i);  }     boolean ok = true;  int swap = 0;  if (a>b) {swap = 1;  int t = a;  a = b;  b = t;  }  Arrays.sort(locs,new Comparator<int[]>() {  public int compare(int[] a, int[] b) {   return (new Integer(a[0])).compareTo(b[0]);  }  });  int[] inB = new int[n];  for (int[] i: locs) {  if (in.containsKey(b-i[0])) {   inB[i[1]] = 1-swap;   in.remove(b-i[0]);  } else if (in.containsKey(a-i[0])) {   inB[i[1]] = swap;   in.remove(a-i[0]);  } else ok = false;  }    StringBuffer p = new StringBuffer();  for (int i=0;i<n-1;i++) {  p.append(inB[i]);  p.append(" ");  }  p.append(inB[n-1]);  if (ok) {  out.println("YES");  out.println(p.toString());  } else {  out.println("NO");  }     out.close();  System.exit(0); } }
1	public class B implements Runnable{  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in; OutputWriter out; StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args){  new Thread(null, new B(), "", 128 * (1L << 20)).start(); }    void init() throws FileNotFoundException{  Locale.setDefault(Locale.US);   if (ONLINE_JUDGE){  in = new BufferedReader(new InputStreamReader(System.in));  out = new OutputWriter(System.out);  }else{  in = new BufferedReader(new FileReader("input.txt"));  out = new OutputWriter("output.txt");  } }    long timeBegin, timeEnd;  void time(){  timeEnd = System.currentTimeMillis();  System.err.println("Time = " + (timeEnd - timeBegin)); }  void debug(Object... objects){  if (ONLINE_JUDGE){  for (Object o: objects){   System.err.println(o.toString());  }  } }    public void run(){  try{  timeBegin = System.currentTimeMillis();  Locale.setDefault(Locale.US);    init();  solve();    out.close();  time();  }catch (Exception e){  e.printStackTrace(System.err);  System.exit(-1);  } }    String delim = " ";  String readString() throws IOException{  while(!tok.hasMoreTokens()){  try{   tok = new StringTokenizer(in.readLine());  }catch (Exception e){   return null;  }  }   return tok.nextToken(delim); }  String readLine() throws IOException{  return in.readLine(); }    final char NOT_A_SYMBOL = '\0';  char readChar() throws IOException{  int intValue = in.read();   if (intValue == -1){  return NOT_A_SYMBOL;  }   return (char) intValue; }  char[] readCharArray() throws IOException{  return readLine().toCharArray(); }    int readInt() throws IOException {  return Integer.parseInt(readString()); }  int[] readIntArray(int size) throws IOException {  int[] array = new int[size];   for (int index = 0; index < size; ++index){  try {   array[index] = readInt();  } catch (Exception e) {   System.err.println(index);   return null;  }  }   return array; }  int[] readSortedIntArray(int size) throws IOException {  Integer[] array = new Integer[size];   for (int index = 0; index < size; ++index) {  array[index] = readInt();  }  Arrays.sort(array);   int[] sortedArray = new int[size];  for (int index = 0; index < size; ++index) {  sortedArray[index] = array[index];  }   return sortedArray; }  int[] readIntArrayWithDecrease(int size) throws IOException {  int[] array = readIntArray(size);   for (int i = 0; i < size; ++i) {  array[i]--;  }   return array; }    int[][] readIntMatrix(int rowsCount, int columnsCount) throws IOException {  int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {  matrix[rowIndex] = readIntArray(columnsCount);  }   return matrix; }  int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) throws IOException {  int[][] matrix = new int[rowsCount][];   for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {  matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);  }   return matrix; }    long readLong() throws IOException{  return Long.parseLong(readString()); }  long[] readLongArray(int size) throws IOException{  long[] array = new long[size];   for (int index = 0; index < size; ++index){  array[index] = readLong();  }   return array; }    double readDouble() throws IOException{  return Double.parseDouble(readString()); }  double[] readDoubleArray(int size) throws IOException{  double[] array = new double[size];   for (int index = 0; index < size; ++index){  array[index] = readDouble();  }   return array; }     BigInteger readBigInteger() throws IOException {  return new BigInteger(readString()); }  BigDecimal readBigDecimal() throws IOException {  return new BigDecimal(readString()); }    Point readPoint() throws IOException{  int x = readInt();  int y = readInt();  return new Point(x, y); }  Point[] readPointArray(int size) throws IOException{  Point[] array = new Point[size];   for (int index = 0; index < size; ++index){  array[index] = readPoint();  }   return array; }    List<Integer>[] readGraph(int vertexNumber, int edgeNumber) throws IOException{  @SuppressWarnings("unchecked")  List<Integer>[] graph = new List[vertexNumber];   for (int index = 0; index < vertexNumber; ++index){  graph[index] = new ArrayList<Integer>();  }   while (edgeNumber-- > 0){  int from = readInt() - 1;  int to = readInt() - 1;    graph[from].add(to);  graph[to].add(from);  }   return graph; }    static class IntIndexPair {   static Comparator<IntIndexPair> increaseComparator = new Comparator<B.IntIndexPair>() {    @Override  public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {   int value1 = indexPair1.value;   int value2 = indexPair2.value;     if (value1 != value2) return value1 - value2;     int index1 = indexPair1.index;   int index2 = indexPair2.index;     return index1 - index2;  }  };   static Comparator<IntIndexPair> decreaseComparator = new Comparator<B.IntIndexPair>() {    @Override  public int compare(IntIndexPair indexPair1, IntIndexPair indexPair2) {   int value1 = indexPair1.value;   int value2 = indexPair2.value;     if (value1 != value2) return -(value1 - value2);     int index1 = indexPair1.index;   int index2 = indexPair2.index;     return index1 - index2;  }  };   int value, index;  public IntIndexPair(int value, int index) {  super();  this.value = value;  this.index = index;  }    public int getRealIndex() {  return index + 1;  } }  IntIndexPair[] readIntIndexArray(int size) throws IOException {  IntIndexPair[] array = new IntIndexPair[size];   for (int index = 0; index < size; ++index) {  array[index] = new IntIndexPair(readInt(), index);  }   return array; }    static class OutputWriter extends PrintWriter {  final int DEFAULT_PRECISION = 12;   protected int precision;  protected String format, formatWithSpace;   {  precision = DEFAULT_PRECISION;    format = createFormat(precision);  formatWithSpace = format + " ";  }   public OutputWriter(OutputStream out) {  super(out);  }  public OutputWriter(String fileName) throws FileNotFoundException {  super(fileName);  }   public int getPrecision() {  return precision;  }  public void setPrecision(int precision) {  precision = max(0, precision);  this.precision = precision;    format = createFormat(precision);  formatWithSpace = format + " ";  }   private String createFormat(int precision){  return "%." + precision + "f";  }   @Override  public void print(double d){  printf(format, d);  }   public void printWithSpace(double d){  printf(formatWithSpace, d);  }  public void printAll(double...d){  for (int i = 0; i < d.length - 1; ++i){   printWithSpace(d[i]);  }    print(d[d.length - 1]);  }   @Override  public void println(double d){  printlnAll(d);  }   public void printlnAll(double... d){  printAll(d);  println();  } }    static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};  static final int[][] steps8 = {  {-1, 0}, {1, 0}, {0, -1}, {0, 1},  {-1, -1}, {1, 1}, {1, -1}, {-1, 1} };  static final boolean check(int index, int lim){  return (0 <= index && index < lim); }    static final boolean checkBit(int mask, int bit){  return (mask & (1 << bit)) != 0; }    static final long getSum(int[] array) {  long sum = 0;  for (int value: array) {  sum += value;  }   return sum; }  static final Point getMinMax(int[] array) {  int min = array[0];  int max = array[0];   for (int index = 0, size = array.length; index < size; ++index, ++index) {  int value = array[index];    if (index == size - 1) {   min = min(min, value);   max = max(max, value);  } else {   int otherValue = array[index + 1];     if (value <= otherValue) {   min = min(min, value);   max = max(max, otherValue);   } else {   min = min(min, otherValue);   max = max(max, value);   }  }  }   return new Point(min, max); }    void solve() throws IOException {  int n = readInt();   int a = readInt();  int b = readInt();   Map<Integer, Integer> numbers = new HashMap<>();  int[] p = readIntArray(n);  for (int index = 0; index < n; ++index) {  numbers.put(p[index], index);  }   Set<Integer> used = new HashSet<Integer>();  Deque<Integer> q = new ArrayDeque<Integer>();   int[] answers = new int[n];  for (int i = 0; i < n; ++i) {  if (used.contains(p[i])) continue;    int leftSize = 0;  for (int number = p[i], cur = a, next = b;   numbers.containsKey(number) && !used.contains(number);   number = cur - number, cur = (a ^ b ^ cur), next = (a ^ b ^ next)) {   q.addFirst(number);   used.add(number);     ++leftSize;  }    for (int number = b - p[i], cur = a, next = b;   numbers.containsKey(number) && !used.contains(number);   number = cur - number, cur = (a ^ b ^ cur), next = (a ^ b ^ next)) {   q.addLast(number);   used.add(number);  }    int curColor = (leftSize & 1);  if ((q.size() & 1) == 1) {   int first = q.peekFirst();        if (curColor == 0 && (first << 1) == b    ||   curColor == 1 && (first << 1) == a) {   q.poll();      curColor ^= 1;      int firstIndex = numbers.get(first);   answers[firstIndex] = curColor;   } else {   int last = q.peekLast();         if (curColor == 0 && (last << 1) == a    ||    curColor == 1 && (first << 1) == b) {    q.poll();       int firstIndex = numbers.get(first);    answers[firstIndex] = curColor;   } else {    out.println("NO");    return;   }   }  }    while (q.size() > 0) {   int first = q.poll();   int second = q.poll();     int firstIndex = numbers.get(first);   int secondIndex = numbers.get(second);     answers[firstIndex] = curColor;   answers[secondIndex] = curColor;  }  }   out.println("YES");  for (int answer : answers) {  out.print(answer + " ");  }  out.println(); } }
2	public class Main { private InputStream is; private PrintWriter out; int time = 0, dp[][], DP[][], start[], parent[], end[], val[], black[], MOD = (int)(1e9+7), arr[], arr1[]; int MAX = 10000000, N, K, p; ArrayList<Integer>[] amp, amp1; boolean b[], b1[]; Pair prr[]; char ch[][]; HashSet<Integer> hs = new HashSet<>();  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  public void run() {  try {    } catch (Exception e) {   System.out.println(e);  }  } }, "1", 1 << 26).start();  new Main().soln(); } void solve() {  long n = nl(), s = nl();  long low = 1, high = n+1;  long ans = high;  while(low<=high){  long mid = (high+low)/2;  if((mid - getSum(mid))>=s){   high = mid-1;   ans = mid;  }  else{   low = mid+1;  }  }  System.out.println(Math.max(0, n-ans+1)); } int getSum(long s){  String str = Long.toString(s);  int ans = 0;  for(char ch : str.toCharArray()) ans += (ch-'0');  return ans; } int recur(int x){   int ans = 0;  b[x] = true;  for(int i : amp[x]){  if(!b[i]){   b[i] = true;   ans = Math.max(recur(i), ans);   b[i] = false;  }  }  return 1+ans; } int max = 0; int getParent(int x){   if(parent[x]!=x){  parent[x] = getParent(parent[x]);  }  return parent[x]; } int bfs(int x){  b[x] = true;  Queue<Integer> q = new LinkedList<>();  q.add(x);  while(!q.isEmpty()){  int y = q.poll();  for(int i : amp[y]){   if(!b[i]){   b[i] = true;   val[i] = val[y]+1;   max = Math.max(val[i], max);   q.add(i);   }  }  }  return max; } class Pair implements Comparable<Pair>{  int u, v, r;  Pair(int u, int v){  this.u = u;  this.v = v;  }public int hashCode() {  return Objects.hash();  }  public boolean equals(Object o) {  Pair other = (Pair) o;  return ((u == other.u && v == other.v));  }  public int compareTo(Pair other) {    return Long.compare(u, other.u) != 0 ? (Long.compare(u, other.u)) : (Long.compare(other.v,v));  }  public String toString() {  return "[u=" + u + ", v=" + v + "]";  } } int min(int x,int y){  if(x<y) return x;  return y; } int max(int x,int y){  if(x>y) return x;  return y; } void dfs(int x){  b[x] = true;  for(int i : amp[x]){  if(!b[i]){   dfs(i);  }  } } void buildGraph(int m){  while(m-->0)  {  int x = ni()-1, y = ni()-1;  amp[x].add(y);  amp[y].add(x);  } } long modInverse(long a, long mOD2){   return power(a, mOD2-2, mOD2); } long power(long x, long y, long m) {  if (y == 0)  return 1; long p = power(x, y/2, m) % m; p = (p * p) % m;  return (y%2 == 0)? p : (x * p) % m; } boolean isPrime(int x){  for(int i = 2;i*1L*i<=x;i++) if(x%i==0) return false;  return true; } public long gcd(long a, long b){  if(b==0) return a;  return gcd(b,a%b); } void failFn(String str, int arr[]){  int len = 0;  arr[0] = 0;  int i = 1;  while(i<arr.length){  if(str.charAt(i)==str.charAt(len)){   arr[i++] = ++len;   continue;  }  if(len == 0){   arr[i] = len;   i++;   continue;  }  if(str.charAt(i)!=str.charAt(len)){   len = arr[len-1];  }  } } static class ST1{  int arr[], st[], size;  ST1(int a[]){  arr = a.clone();  size = 10*arr.length;  st = new int[size];  build(0,arr.length-1,1);  }  void build(int ss, int se, int si){  if(ss==se){   st[si] = arr[ss];   return;  }  int mid = (ss+se)/2;  int val = 2*si;  build(ss,mid,val); build(mid+1,se,val+1);  st[si] = (st[val]+ st[val+1]);  }  int get(int ss, int se, int l, int r, int si){  if(l>se || r<ss || l>r) return Integer.MAX_VALUE;  if(l<=ss && r>=se) return st[si];  int mid = (ss+se)/2;  int val = 2*si;  return (get(ss,mid,l,r,val)+ get(mid+1,se,l,r,val+1));  } } static class ST{  int arr[],lazy[],n;  ST(int a){  n = a;  arr = new int[10*n];  lazy = new int[10*n];  }  void up(int l,int r,int val){  update(0,n-1,0,l,r,val);  }  void update(int l,int r,int c,int x,int y,int val){  if(lazy[c]!=0){   lazy[2*c+1]+=lazy[c];   lazy[2*c+2]+=lazy[c];   if(l==r)   arr[c]+=lazy[c];   lazy[c] = 0;  }  if(l>r||x>y||l>y||x>r)   return;  if(x<=l&&y>=r){   lazy[c]+=val;   return ;  }  int mid = l+r>>1;  update(l,mid,2*c+1,x,y,val);  update(mid+1,r,2*c+2,x,y,val);  arr[c] = (arr[2*c+1]+ arr[2*c+2]);  }  int an(int ind){  return ans(0,n-1,0,ind);  }  int ans(int l,int r,int c,int ind){  if(lazy[c]!=0){   lazy[2*c+1]+=lazy[c];   lazy[2*c+2]+=lazy[c];   if(l==r)   arr[c]+=lazy[c];   lazy[c] = 0;  }  if(l==r)   return arr[c];  int mid = l+r>>1;  if(mid>=ind)   return ans(l,mid,2*c+1,ind);  return ans(mid+1,r,2*c+2,ind);  } } public static class FenwickTree {    int[] array;   public FenwickTree(int size) {   array = new int[size + 1];  }  public int rsq(int ind) {   assert ind > 0;   int sum = 0;   while (ind > 0) {    sum += array[ind];        ind -= ind & (-ind);   }   return sum;  }  public int rsq(int a, int b) {   assert b >= a && a > 0 && b > 0;   return rsq(b) - rsq(a - 1);  }  public void update(int ind, int value) {   assert ind > 0;   while (ind < array.length) {    array[ind] += value;        ind += ind & (-ind);   }  }  public int size() {   return array.length - 1;  } } public static int[] shuffle(int[] a, Random gen){  for(int i = 0, n = a.length;i < n;i++)  {   int ind = gen.nextInt(n-i)+i;   int d = a[i];   a[i] = a[ind];  a[ind] = d;  }  return a;  } long power(long x, long y, int mod){  long ans = 1;  while(y>0){  if(y%2==0){   x = (x*x)%mod;   y/=2;  }  else{   ans = (x*ans)%mod;   y--;  }  }  return ans; } void soln() {  is = System.in;  out = new PrintWriter(System.out);  long s = System.currentTimeMillis();  solve();   out.flush();   }    private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if (lenbuf == -1)  throw new InputMismatchException();  if (ptrbuf >= lenbuf) {  ptrbuf = 0;  try {   lenbuf = is.read(inbuf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (lenbuf <= 0)   return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126); }  private int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))  ;  return b; }  private double nd() {  return Double.parseDouble(ns()); }  private char nc() {  return (char) skip(); } private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {        sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {  buf[p++] = (char) b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)  map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o) {  if (!oj)  System.out.println(Arrays.deepToString(o)); } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int m = in.nextInt();   int k = in.nextInt();   int[] a = new int[ n ];   for (int i=0; i<n; i++) a[i] = in.nextInt();   if ( m <= k ) out.println( 0 );   else   {    m -= k - 1;    Arrays.sort( a );    int ans = 0;    for (int i=n-1; i>=0; i--)    {     ans++;         m -= a[ i ];     if ( m <= 0 ) break;     m++;    }    if ( m > 0 ) out.println( -1 );    else out.println( ans );   }  } } class InputReader {  BufferedReader br;  StringTokenizer st;  public InputReader(InputStream in)  {   br = new BufferedReader(new InputStreamReader(in));   st = null;  }  public String next()  {   while (st==null || !st.hasMoreTokens())   {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return st.nextToken();  }  public int nextInt()  {   return Integer.parseInt(next());  } }
3	public class Main {  private static Scanner scanner = new Scanner(System.in);  public static void main(String[] args) {   int n = scanInt();   List<Integer> a = scanList(n);   int m = scanInt();   List<Integer> left = new ArrayList<>();   List<Integer> right = new ArrayList<>();   for (int i = 0; i < m; i++) {    left.add(scanInt());    right.add(scanInt());   }   String even = "even";   String odd = "odd";   int inversions = 0;   for (int i = 0; i < a.size(); i++) {    for (int j = i; j < a.size(); j++) {     if (a.get(i) > a.get(j)) {      ++inversions;     }    }   }   inversions = inversions % 2;   for (int i = 0; i < m; i++) {    inversions = (inversions + (right.get(i) - left.get(i) + 1) / 2 % 2) % 2;    println(inversions % 2 == 0 ? even : odd);   }   }  private static Integer get(int digit, List<Integer> numbers) {   Integer toReturn = null;   for (Integer number : numbers     ) {    if (number <= digit) {     toReturn = number;     break;    }   }   return toReturn;  }  private static List<Integer> toList(char[] chars) {   List<Integer> integers = new ArrayList<>();   for (int i = 0; i < chars.length; i++) {    integers.add(Integer.parseInt(String.valueOf(chars[i])));   }   return integers;  }  private static List<Pair<Integer, Integer>> scanPairs(int amount) {   List<Pair<Integer, Integer>> list = new ArrayList<>();   for (int i = 0; i < amount; i++) {    list.add(new Pair<>(scanInt(), scanInt()));   }   return list;  }  private static int[] scanArray(int length) {   int array[] = new int[length];   for (int i = 0; i < length; i++) {    array[i] = scanner.nextInt();   }   return array;  }  private static List<Integer> scanList(int length) {   List<Integer> integers = new ArrayList<>();   for (int i = 0; i < length; i++) {    integers.add(scanner.nextInt());   }   return integers;  }  public static String scanString() {   return scanner.next();  }  private static int scanInt() {   return scanner.nextInt();  }  private static void println(int n) {   System.out.println(n);  }  private static void print(int n) {   System.out.print(n);  }  private static void println(String s) {   System.out.println(s);  }  private static void print(String s) {   System.out.print(s);  }  private static void print(int a[]) {   for (int i = 0; i < a.length; i++) {    System.out.print(a[i] + " ");   }  } }
3	public class A{  void solve(){   int n=ni();   int P[]=new int[n+1];   for(int i=1;i<=n;i++) P[i]=ni();   a=new int[n+1];   BIT=new long[n+1];   long cnt=0;    long p=0;   for(int i=n;i>=1;i--){    p+=querry(P[i]);    if(p>=M) p%=M;    update(n,P[i],1);   }   int d=0;   if(p%2==0) d=1;   int m=ni();   while(m-->0){    int l=ni(),r=ni();    long sz=r-l+1;    sz=(sz*(sz-1))/2;    if(d==1 && sz%2==0) d=1;    else if(d==1 && sz%2!=0) d=0;    else if(d==0 && sz%2==0) d=0;    else if(d==0 && sz%2!=0) d=1;    if(d==1) pw.println("even");    else pw.println("odd");   }  }  int a[];  long BIT[];  void update(int n,int x,int val){   a[x]=val;   for(;x<=n;x+=(x&-x)) BIT[x]+=val;  }  long querry(int x){   long ans=0;   for(;x>0;x-=(x&-x)) ans+=BIT[x];   return ans;  }  static long d, x, y;  static void extendedEuclid(long A, long B) {   if(B == 0) {    d = A;    x = 1;    y = 0;   }   else {    extendedEuclid(B, A%B);    long temp = x;    x = y;    y = temp - (A/B)*y;   }  }  static long modInverse(long A, long M)  {   extendedEuclid(A,M);   return (x%M+M)%M;  }  long M=(long)1e9+7;  InputStream is;  PrintWriter pw;  String INPUT = "";  void run() throws Exception {   is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());   pw = new PrintWriter(System.out);   long s = System.currentTimeMillis();   solve();   pw.flush();   if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");  }  public static void main(String[] args) throws Exception { new A().run(); }  private byte[] inbuf = new byte[1024];  public int lenbuf = 0, ptrbuf = 0;  private int readByte() {   if(lenbuf == -1)throw new InputMismatchException();   if(ptrbuf >= lenbuf){    ptrbuf = 0;    try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }    if(lenbuf <= 0)return -1;   }   return inbuf[ptrbuf++];  }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }  private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); }  private char nc() { return (char)skip(); }  private String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!(isSpaceChar(b))){    sb.appendCodePoint(b);    b = readByte();   }   return sb.toString();  }  private char[] ns(int n) {   char[] buf = new char[n];   int b = skip(), p = 0;   while(p < n && !(isSpaceChar(b))){    buf[p++] = (char)b;    b = readByte();   }   return n == p ? buf : Arrays.copyOf(buf, p);  }  private char[][] nm(int n, int m) {   char[][] map = new char[n][];   for(int i = 0;i < n;i++)map[i] = ns(m);   return map;  }  private int[] na(int n) {   int[] a = new int[n];   for(int i = 0;i < n;i++)a[i] = ni();   return a;  }  private int ni() {   int num = 0, b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private long nl() {   long num = 0;   int b;   boolean minus = false;   while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));   if(b == '-'){    minus = true;    b = readByte();   }   while(true){    if(b >= '0' && b <= '9'){     num = num * 10 + (b - '0');    }else{     return minus ? -num : num;    }    b = readByte();   }  }  private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Scanner in = new Scanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, Scanner in, PrintWriter out) {    int n = in.nextInt();    int m = in.nextInt();    TaskC.pair[] songs = new TaskC.pair[n];    long sum = 0;    for (int i = 0; i < n; i++) {     songs[i] = new TaskC.pair(in.nextInt(), in.nextInt());     sum += songs[i].a;    }    Arrays.sort(songs);    int res = 0;    int idx = n - 1;    while (sum > m) {     if (idx < 0) {      break;     }     sum -= (songs[idx].a - songs[idx].b);     res++;     idx--;    }    if (sum > m) {     out.println(-1);    } else {     out.println(res);    }   }   static class pair implements Comparable<TaskC.pair> {    int a;    int b;    pair(int a, int b) {     this.a = a;     this.b = b;    }    public int compareTo(TaskC.pair p) {     return (this.a - this.b) - (p.a - p.b);    }   }  }  static class Scanner {   StringTokenizer st;   BufferedReader br;   public Scanner(InputStream s) {    br = new BufferedReader(new InputStreamReader(s));   }   public Scanner(String s) {    try {     br = new BufferedReader(new FileReader(s));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = new int[n];    for (int i = 0; i < n; i++) {     a[i] = in.nextInt();    }    int inv = 0;    for (int i = 0; i < n; i++) {     for (int j = 0; j < i; j++) {      if (a[j] > a[i]) {       inv++;      }     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt();     int r = in.nextInt();     int s = (r - l + 1) * (r - l) / 2;     inv = (inv + s) % 2;     out.println(inv % 2 == 0 ? "even" : "odd");    }   }  }  static class InputReader {   private BufferedReader reader;   private StringTokenizer stt;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream));   }   public String nextLine() {    try {     return reader.readLine();    } catch (IOException e) {     return null;    }   }   public String next() {    while (stt == null || !stt.hasMoreTokens()) {     stt = new StringTokenizer(nextLine());    }    return stt.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
3	public class Main{  static class Reader  {   final private int BUFFER_SIZE = 1 << 16;   private DataInputStream din;   private byte[] buffer;   private int bufferPointer, bytesRead;    public Reader()   {    din = new DataInputStream(System.in);    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public Reader(String file_name) throws IOException   {    din = new DataInputStream(new FileInputStream(file_name));    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }    public String readLine() throws IOException   {    byte[] buf = new byte[200005];    int cnt = 0, c;    while ((c = read()) != -1)    {     if (c == '\n' || c==' ') {           break;     }     buf[cnt++] = (byte) c;    }    return new String(buf, 0, cnt);   }    public int nextInt() throws IOException   {    int ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do    {     ret = ret * 10 + c - '0';    } while ((c = read()) >= '0' && c <= '9');     if (neg)     return -ret;    return ret;   }    public long nextLong() throws IOException   {    long ret = 0;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();    do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');    if (neg)     return -ret;    return ret;   }    public double nextDouble() throws IOException   {    double ret = 0, div = 1;    byte c = read();    while (c <= ' ')     c = read();    boolean neg = (c == '-');    if (neg)     c = read();     do {     ret = ret * 10 + c - '0';    }    while ((c = read()) >= '0' && c <= '9');     if (c == '.')    {     while ((c = read()) >= '0' && c <= '9')     {      ret += (c - '0') / (div *= 10);     }    }     if (neg)     return -ret;    return ret;   }    private void fillBuffer() throws IOException   {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }    private byte read() throws IOException   {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }    public void close() throws IOException   {    if (din == null)     return;    din.close();   }  }  static class FastScanner {   private final BufferedReader bufferedReader;  private StringTokenizer stringTokenizer;   public FastScanner() {   bufferedReader = new BufferedReader(new InputStreamReader(System.in));  }   public String next() {   while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {    try {     stringTokenizer = new StringTokenizer(bufferedReader.readLine());    } catch (IOException e) {     throw new RuntimeException("Can't read next value", e);    }   }   return stringTokenizer.nextToken();  }   public int nextInt() {   return Integer.parseInt(next());  }   public long nextLong() {   return Long.parseLong(next());  }   public double nextDouble() {   return Double.parseDouble(next());  }   public String nextLine(){   String str = "";   try {    str = bufferedReader.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return str;  } }  static void closeall() throws IOException{  printWriter.close();  sc.close();  in.close(); } static Scanner sc = new Scanner(System.in); static Reader in = new Reader(); static FastScanner fastScanner = new FastScanner(); static PrintWriter printWriter = new PrintWriter(new BufferedOutputStream(System.out)); static BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); static long INF = (long)(1e18);   int V,E; ArrayList<Integer> adj[]; HashMap<Integer,Integer> path; Main(){ } Main(int v,int e){  V=v;  E=e;  adj=new ArrayList[v];  path = new HashMap<Integer,Integer>();  for(int i=0;i<v;i++)  adj[i] = new ArrayList<>(); } void addEdge(int u,int v){  adj[u].add(v);  adj[v].add(u); }   static long power(long a,long k) {  long m = 1000000007;  long ans=1;  long tmp=a%m;  while(k>0)  {   if(k%2==1)    ans=ans*tmp%m;   tmp=tmp*tmp%m;   k>>=1;  }  return ans; }  static class Pair {  long F,S;  Pair(long x,long y){  F = x;  S = y;  }    } static long gcd(long a,long b) {  if(a<b) {  long t = a;  a = b;  b = t;  }  long r = a%b;  if(r==0)  return b;  return gcd(b,r); }  static int lower_bound(int[] a,int low,int high,int val) {  while(low!=high) {  int mid = (low+high)/2;  if(a[mid]<val)   low=mid+1;  else   high=mid;  }  return low; }  static int max(int a,int b) {  return (int)Math.max(a, b); } static long max(long a,long b) {  return (long)Math.max(a, b); } static int min(int a,int b) {  if(a<b)  return a;  return b; } static long mod = 1000000007;  public static void main(String args[])throws IOException{  int n = in.nextInt();  int[] a = new int[n];  for(int i=0;i<n;i++)  a[i] = in.nextInt();  int inv = 0;  for(int i=0;i<n;i++) {  for(int j=0;j<i;j++) {   if(a[j]>a[i])   inv++;  }  }  inv%=2;  int q = in.nextInt();  for(int i=0;i<q;i++) {  int l = in.nextInt();  int r = in.nextInt();  int num = r-l+1;  inv=(inv+num*(num-1)/2)%2;  if(inv==0)   printWriter.println("even");  else   printWriter.println("odd");  }  closeall(); } }
2	public class Solution {  long sum(long n){  long sm = 0;   while(n!=0){  sm+=(n%10);  n/=10;  }   return sm;   }  void solve() throws IOException{   long n = in.nextLong();  long s = in.nextLong();   long l = 0;  long h = n+1;  long ans = -1;   while(l<h){   long mid = (l + h)/2;     long sum = sum(mid);     if(mid - sum >= s){   ans = mid;   h = mid;   }   else   l = mid+1;             }      if(ans==-1)  out.println("0");  else  out.println(n+1-ans);                  }  class FastScanner{  BufferedReader br;  StringTokenizer st;   public FastScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  }   public int nextInt() throws IOException{   if(st.hasMoreTokens())   return Integer.parseInt(st.nextToken());  else{   st = new StringTokenizer(br.readLine());   return nextInt();  }   }   public long nextLong() throws IOException{   if(st.hasMoreTokens())   return Long.parseLong(st.nextToken());  else{   st = new StringTokenizer(br.readLine());   return nextLong();  }   }   public String readLine() throws IOException{  return br.readLine();  } }  FastScanner in = new FastScanner(); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    public static void main(String args[])throws IOException{  new Solution().solve();  out.close(); } }
1	public class Solution {  BufferedReader in;  PrintWriter out;  StringTokenizer st;  int n, k;  boolean[] prime;  int[] primes;  void sieve() {   prime = new boolean[n + 1];   Arrays.fill(prime, true);   prime[0] = prime[1] = false;   int cnt = 0;   for (int i = 2; i <= n; ++i)    if (prime[i]) {     ++cnt;     for (int j = i + i; j <= n; j += i)      prime[j] = false;    }   primes = new int[cnt];   cnt = 0;   for (int i = 0; i <= n; ++i)    if (prime[i])     primes[cnt++] = i;  }  void solve() throws IOException {   n = ni();   k = ni();   sieve();   int cnt = 0;   for (int i = 2; i <= n; ++i) {    if (!prime[i])     continue;    boolean ok = false;    for (int j = 0; j < primes.length - 1; ++j)     if (primes[j] + primes[j + 1] + 1 == i) {      ok = true;      break;     }    if (ok)     ++cnt;   }   if (cnt >= k)    out.println("YES");   else    out.println("NO");  }  public Solution() throws IOException {   Locale.setDefault(Locale.US);   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   in.close();   out.close();  }  String ns() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int ni() throws IOException {   return Integer.valueOf(ns());  }  long nl() throws IOException {   return Long.valueOf(ns());  }  double nd() throws IOException {   return Double.valueOf(ns());  }  public static void main(String[] args) throws IOException {   new Solution();  } }
1	public class Main {  BufferedReader in; StringTokenizer str = null; PrintWriter out;  private String next() throws Exception{  while (str == null || !str.hasMoreElements())  str = new StringTokenizer(in.readLine());  return str.nextToken(); }  private int nextInt() throws Exception{  return Integer.parseInt(next()); }  private long nextLong() throws Exception{  return Long.parseLong(next()); }  private double nextDouble() throws Exception{  return Double.parseDouble(next()); }  Map<Integer, Integer> map; int []p, rank;  public void run() throws Exception{  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  map = new HashMap<Integer, Integer>();  int n = nextInt();  int x = nextInt(), y = nextInt();  int []a = new int[n];  p = new int[n];  for(int i = 1; i < n; ++i) p[i] = i;  rank = new int[n];  for(int i = 0; i < n; ++i) {  a[i] = nextInt();  map.put(a[i], i);  }  int mask[] = new int[n];  for(int i = 0; i < n; ++i) {  if (map.containsKey(x - a[i])) {   union(map.get(x - a[i]), i);   mask[i] |= 1;   }   if (map.containsKey(y - a[i])) {   union(map.get(y - a[i]), i);   mask[i] |= 2;  }  }  int []b = new int[n];  Arrays.fill(b, 3);  for(int i = 0; i < n; ++i) b[find(i)] &= mask[i];  for(int i = 0; i < n; ++i) {  if (b[i] == 0) {   out.println("NO");   out.close();   return;  }  }  out.println("YES");  for(int i = 0; i < n; ++i) {  out.print((b[find(i)] & 1) == 1 ? 0 : 1);  if (i != n - 1) out.print(" ");  }  out.println();  out.close(); }  private int find(int x) {  if (x != p[x])  return p[x] = find(p[x]);  return x; } private void union(int a, int b) {  a = find(a);  b = find(b);  if (rank[a] < rank[b]) {  int tmp = a;  a = b;  b = tmp;  }  p[b] = a;  if (rank[a] == rank[b]) ++rank[a]; }   public static void main(String[] args) throws Exception{  new Main().run(); } }
6	public class C {  public static void main(String[] args) {   new C().run();   }  private void run() {  Scanner sc = new Scanner(System.in);  int sx = sc.nextInt();  int sy = sc.nextInt();  int n = sc.nextInt();  int[] x = new int[n];  int[] y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = sc.nextInt();  y[i] = sc.nextInt();  }  sc.close();  int[] w = new int[n * n];  int[] pMask = new int[n * n];  for (int i = 0; i < n; i++) {  for (int j = i; j < n; j++) {   int ind = i * n + j;   if (i == j) {   w[ind] = 2 * dist(sx, sy, x[i], y[i]);   pMask[ind] = 1 << i;   } else {   w[ind] = dist(sx, sy, x[i], y[i]) + dist(x[i], y[i], x[j], y[j]) + dist(x[j], y[j], sx, sy);   pMask[ind] = 1 << i | 1 << j;   }  }  }  int max = 1 << n;  int[] p = new int[max];  int[] dist = new int[max];  Arrays.fill(dist, Integer.MAX_VALUE / 2);  dist[0] = 0;  int[] available = new int[n * n];  for (int mask = 0; mask < max; mask++) {  int ac = 0;  for (int i = 0; i < n; i++) {   if (((mask >> i) & 1) == 0) {   available[ac++] = i;   }  }  int s = 0;     for (int j = s; j < ac; j++) {   int a = available[s];   int b = available[j];   int ind = a * n + b;   int nextMask = mask | pMask[ind];   int newD = dist[mask] + w[ind];   if (newD < dist[nextMask]) {    dist[nextMask] = newD;       p[nextMask] = ind;   }   }    }  System.out.println(dist[max - 1]);  ArrayList<Integer> steps = new ArrayList<Integer>();  int mask = max - 1;  while (mask > 0) {  int msk = p[mask];  steps.add(msk);  int a = msk / n;  int b = msk % n;  if (a == b) {   mask ^= 1 << a;  } else {   mask ^= 1 << a;   mask ^= 1 << b;  }  }  System.out.print(0);  for (int i = steps.size() - 1; i >= 0; i--) {  int msk = steps.get(i);  int a = msk / n;  int b = msk % n;  if (a == b) {   System.out.printf(" %d 0", a + 1);  } else {   System.out.printf(" %d %d 0", a + 1, b + 1);  }  }  System.out.println(); }  private int dist(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } }
6	public class Main {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new Main().run();  }  int n;  int[] x, y;  int[][] time;  int status;  int[] dp;  int[] pre;   void run() throws IOException {   int xs = in.nextInt(), ys = in.nextInt();   n = in.nextInt();   x = new int[n+1];   y = new int[n+1];   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   x[n] = xs;   y[n] = ys;   computeTime();   status = (1<<n);   dp = new int[1<<n];   pre = new int[1<<n];   Arrays.fill(dp, -1);   dp[0] = 0;   for (int i = 0; i < status; i++) {    if (dp[i] == -1)     continue;    for (int j = 0; j < n; j++) {     if (((1<<j) & i) == 0) {      int t1 = ((1<<j) | i), temp1 = dp[i] + 2 * time[n][j];      if (dp[t1] == -1 || dp[t1] > temp1) {       dp[t1] = temp1;       pre[t1] = i;      }      for (int k = 0; k < n; k++) {       if (((1<<k) & t1) == 0) {        int t2 = ((1<<k) | t1),          temp2 = dp[i] + time[n][j] + time[j][k] + time[k][n];        if (dp[t2] == -1 || dp[t2] > temp2) {         dp[t2] = temp2;         pre[t2] = i;        }       }      }      break;     }    }   }   int cur = (1 << n) - 1;   out.println(dp[cur]);   out.print(0);   while (cur > 0) {    int last = pre[cur], diff = cur ^ last;    int obj1 = -1, obj2 = -1;    for (int i = 0; i < n; i++) {     if (((1<<i) & diff) > 0) {      obj2 = obj1;      obj1 = i;     }    }    if (obj2 >= 0)     out.printf(" %d %d %d", obj1+1, obj2+1, 0);    else     out.printf(" %d %d", obj1+1, 0);    cur = last;   }   out.flush();  }  void computeTime() {   time = new int[n+1][n+1];   for (int i = 0; i <= n; i++) {    for (int j = i+1; j <= n; j++)     time[i][j] = time[j][i] = (x[i]- x[j])*(x[i]- x[j]) +       (y[i]- y[j])*(y[i]- y[j]);   }  }  static class Reader {   BufferedReader reader;   StringTokenizer tokenizer;   public Reader(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));    tokenizer = new StringTokenizer("");   }      String nextToken() throws IOException {    while ( ! tokenizer.hasMoreTokens() ) {         tokenizer = new StringTokenizer( reader.readLine() );    }    return tokenizer.nextToken();   }   String readLine() throws IOException {    return reader.readLine();   }   int nextInt() throws IOException {    return Integer.parseInt( nextToken() );   }   long nextLong() throws IOException {    return Long.parseLong( nextToken() );   }   double nextDouble() throws IOException {    return Double.parseDouble( nextToken() );   }  } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) {  int count = in.readInt();  int[] array = IOUtils.readIntArray(in, count);  int[] sorted = array.clone();  ArrayUtils.sort(sorted, IntComparator.DEFAULT);  int differs = 0;  for (int i = 0; i < count; i++) {  if (array[i] != sorted[i])   differs++;  }  if (differs <= 2)  out.printLine("YES");  else  out.printLine("NO"); } } class InputReader {  private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter;  public InputReader(InputStream stream) {  this.stream = stream; }  public int read() {  if (numChars == -1)  throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars <= 0)   return -1;  }  return buf[curChar++]; }  public int readInt() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  public interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); }  public OutputWriter(Writer writer) {  this.writer = new PrintWriter(writer); }  public void print(Object...objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(Object...objects) {  print(objects);  writer.println(); }  public void close() {  writer.close(); }  } class IOUtils {  public static int[] readIntArray(InputReader in, int size) {  int[] array = new int[size];  for (int i = 0; i < size; i++)  array[i] = in.readInt();  return array; }  } class ArrayUtils {  private static int[] tempInt = new int[0];  public static int[] sort(int[] array, IntComparator comparator) {   return sort(array, 0, array.length, comparator);  }  public static int[] sort(int[] array, int from, int to, IntComparator comparator) {   ensureCapacityInt(to - from);   System.arraycopy(array, from, tempInt, 0, to - from);   sortImpl(array, from, to, tempInt, 0, to - from, comparator);   return array;  }  private static void ensureCapacityInt(int size) {   if (tempInt.length >= size)    return;   size = Math.max(size, tempInt.length << 1);   tempInt = new int[size];  }  private static void sortImpl(int[] array, int from, int to, int[] temp, int fromTemp, int toTemp, IntComparator comparator) {   if (to - from <= 1)    return;   int middle = (to - from) >> 1;   int tempMiddle = fromTemp + middle;   sortImpl(temp, fromTemp, tempMiddle, array, from, from + middle, comparator);   sortImpl(temp, tempMiddle, toTemp, array, from + middle, to, comparator);   int index = from;   int index1 = fromTemp;   int index2 = tempMiddle;   while (index1 < tempMiddle && index2 < toTemp) {    if (comparator.compare(temp[index1], temp[index2]) <= 0)     array[index++] = temp[index1++];    else     array[index++] = temp[index2++];   }   if (index1 != tempMiddle)    System.arraycopy(temp, index1, array, index, tempMiddle - index1);   if (index2 != toTemp)    System.arraycopy(temp, index2, array, index, toTemp - index2);  }  } interface IntComparator {  public static final IntComparator DEFAULT = new IntComparator() {   public int compare(int first, int second) {    if (first < second)     return -1;    if (first > second)     return 1;    return 0;   }  };  public int compare(int first, int second); }
4	public class Codechef { public static void main (String[] args) throws java.lang.Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int t = Integer.parseInt(br.readLine());  for(int q=0;q<t;q++){   String s = br.readLine();   int n = Integer.parseInt(s);   int a[] = new int[1000];   int index=0;   for(int i=0;i<n;i++){     int x = Integer.parseInt(br.readLine());     for(int j=index;j>=0;j--){      if(x-1==a[j]){        a[j]=x;            for(int k=0;k<j;k++){        System.out.print(a[k]+".");      }      System.out.print(a[j]);      System.out.println();      for(int k=j+1;k<1000;k++){        if(a[k]!=0)        a[k]=0;        else        break;      }      index=j+1;            break;      }     }   }  } } }
3	public class prob3{   static Parser sc=new Parser(System.in);  static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  static int p[]=new int[100005]; public static void main(String[] args) throws IOException {     int n=sc.nextInt();  int arr[]=new int[n];  for(int i=0;i<n;i++){  arr[i]=sc.nextInt();  }  int swap=0;  for(int i=0;i<n;i++){  for(int j=0;j<i;j++){   if(arr[i]<arr[j]){    swap++;   }  }  }  swap%=2;   int m=sc.nextInt();  for(int i=0;i<m;i++){   int a=sc.nextInt(),b=sc.nextInt();  swap+=((b-a)*((b-a)+1))/2;   swap%=2;   if(swap%2==0){System.out.println("even");}  else{System.out.println("odd");}  }     }   public static void union(int a,int b){   int i=find(a);   int j=find(b);   if(p[i]!=j){   p[i]=j;   }  }   public static int find(int a){   while(p[a]!=a){   a=p[a];   }   return a;  }       static class Parser {   final private int BUFFER_SIZE = 1 << 20;   private InputStream din;    private byte[] buffer;    private int bufferPointer;   private int bytesRead;    private SpaceCharFilter filter;   public Parser(InputStream in) {    din = in;    buffer = new byte[BUFFER_SIZE];    bufferPointer = bytesRead = 0;   }      public int nextInt() throws IOException {    int result = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();   while (c >= '0' && c <= '9') {     result = result * 10 + c - '0';     c = read();    }  if (neg) return -result;    return result;   }   public int nextLong() throws IOException {    int result = 0;    byte c = read();    while (c <= ' ') c = read();    boolean neg = (c == '-');    if (neg) c = read();   while (c >= '0' && c <= '9') {     result = result * 10 + c - '0';     c = read();    }  if (neg) return -result;    return result;   }   public String nextLine()throws IOException {   int c = read();   while (isSpaceChar(c))   c = read();   StringBuilder res = new StringBuilder();   do {   res.appendCodePoint(c);   c = read();   } while (!isEndOfLine(c)==true);   return res.toString();  }   public boolean isSpaceChar(int c) {   if (filter != null)   return filter.isSpaceChar(c);   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }    private boolean isEndOfLine(int c) {   return c == '\n' || c == '\r' || c == -1;  }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  }      public byte read() throws IOException {    if (bufferPointer == bytesRead)     fillBuffer();    return buffer[bufferPointer++];   }      private void fillBuffer() throws IOException {    bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);    if (bytesRead == -1)     buffer[0] = -1;   }  } }
5	public class Sockets {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   PrintWriter out = new PrintWriter(System.out);   int n = in.nextInt(), m = in.nextInt(), socket = in.nextInt();   int[] filters = new int[n];   for (int i = 0; i < n; i++ ) {    filters[i] = in.nextInt();   }   Arrays.sort(filters);   int result = 0, index = n - 1;   while ( m > socket && index >= 0) {    socket += filters[index] - 1;    result += 1;    index -= 1;   }   out.println(m > socket ? -1 : result);   out.close();  } }
0	public class ProblemD { public static void main(String[] args) throws IOException {  BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String[] data = s.readLine().split(" ");  double a = Double.valueOf(data[0]);  double v = Double.valueOf(data[1]);   String[] line = s.readLine().split(" ");  double l = Double.valueOf(line[0]);  double d = Double.valueOf(line[1]);  double w = Double.valueOf(line[2]);  double ans = solve(a, v, l, d, w);  out.println(String.format("%.07f", ans));   out.flush(); }  private static double solve(double a, double v, double l, double d, double w) {  double maxSpeedAtD = Math.sqrt(2 * d / a) * a;  if (v <= w || maxSpeedAtD <= w) {    double maxSpeedAtL = Math.sqrt(2 * l / a) * a;  if (maxSpeedAtL <= v) {   return Math.sqrt(2 * l / a);  } else {   double timeToMaxSpeed = v / a;   double leftDist = l - 0.5 * a * timeToMaxSpeed * timeToMaxSpeed;   return timeToMaxSpeed + leftDist / v;  }  }   double time = 0.0d;  double maxSpeedTime = Math.sqrt((d / a) + (w * w / (2 * a * a)));  double maxSpeed = maxSpeedTime * a;  if (maxSpeed <= v) {  time = maxSpeedTime + (a * maxSpeedTime - w) / a;  } else {  double vtime = (2 * a * d + w * w - 2 * v * v) / (2 * a * v);  time = v / a + vtime + (v - w) / a;  }     double timeToV = (v - w) / a;  double timeToVLen = timeToV * w + 0.5 * timeToV * (v - w);  if (timeToVLen <= l - d) {  double leftLen = l - d - timeToVLen;  time += timeToV + leftLen / v;  } else {  time += (-w + Math.sqrt(w*w + a * (2 * l - 2 * d))) / a;  }  return time; }  public static void debug(Object... os){  System.err.println(Arrays.deepToString(os)); } }
3	public class maestro{  public static long inversions(long[] arr) {   long x = 0;   int n = arr.length;   for (int i = n - 2; i >= 0; i--) {    for (int j = i + 1; j < n; j++) {     if (arr[i] > arr[j]) {      x++;          }             }   }   return x;  }  public static void main(String[] args){   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   long[] arr = new long[n];   for (int i=0;i<n;i++) arr[i] = sc.nextLong();   long m = sc.nextLong();   long x = inversions(arr)%2;   for (int i=0;i<m;i++){    int l = sc.nextInt()-1;    int r = sc.nextInt()-1;    if ((r-l+1)%4>1) x=(x+1)%2;    if (x==1) System.out.println("odd");    else System.out.println("even");   }    } }
6	public class LookingForOrder {  static int[] x, y; static int[] dp; static int n;  static int dist(int i, int j) {  return ((x[i] - x[j]) * (x[i] - x[j]))   + ((y[i] - y[j]) * (y[i] - y[j])); }  static int solve(int mask) {  if (mask == (1 << n) - 1)  return 0;  if (dp[mask] != -1)  return dp[mask];  int ans = Integer.MAX_VALUE;  int j = 0;  for (int i = 1; i < n; i++)  if ((mask & (1 << i)) == 0) {   if (j == 0) {   ans = Math    .min(ans, 2 * dist(0, i) + solve(mask | (1 << i)));   j = i;   } else   ans = Math.min(ans, dist(0, i) + dist(i, j) + dist(j, 0)    + solve(mask | (1 << i) | (1 << j)));  }  return dp[mask] = ans; }  static void prnt(int mask) {  if (mask == (1 << n) - 1)  return;  int j = 0;  for (int i = 1; i < n; i++)  if ((mask & (1 << i)) == 0) {   if (j == 0) {   j = i;   if (dp[mask] == 2 * dist(0, i) + solve(mask | (1 << i))) {    out.print(" " + i + " 0");    prnt(mask | (1 << i));    return;   }   } else if (dp[mask] == dist(0, i) + dist(i, j) + dist(j, 0)    + solve(mask | (1 << i) | (1 << j))) {   out.print(" " + i + " " + j + " 0");   prnt(mask | (1 << i) | (1 << j));   return;   }  } }  public static void main(String[] args) throws IOException {  sc = new StringTokenizer(br.readLine());  int a = nxtInt();  int b = nxtInt();  n = nxtInt() + 1;  x = new int[n];  y = new int[n];  dp = new int[1 << n];  Arrays.fill(dp, -1);  x[0] = a;  y[0] = b;  for (int i = 1; i < n; i++) {  x[i] = nxtInt();  y[i] = nxtInt();  }  out.println(solve(1 << 0));  out.print(0);  prnt(1 << 0);  out.println();  br.close();  out.close(); }  static BufferedReader br = new BufferedReader(new InputStreamReader(  System.in)); static PrintWriter out = new PrintWriter(System.out);  static StringTokenizer sc;  static String nxtTok() throws IOException {  while (!sc.hasMoreTokens())  sc = new StringTokenizer(br.readLine());  return sc.nextToken(); }  static int nxtInt() throws IOException {  return Integer.parseInt(nxtTok()); }  static long nxtLng() throws IOException {  return Long.parseLong(nxtTok()); } }
4	public class C {  public static void main(String[] args) {  FastScanner sc = new FastScanner();  int T = sc.nextInt();  StringBuilder sb = new StringBuilder();  while(T-->0) {  int n = sc.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++) {   arr[i] = sc.nextInt();  }  int[] p = new int[n];  int[] base = new int[n];  p[0] = -1;  base[0] = -1;  boolean[] used = new boolean[n];  for(int i = 1; i < n; i++) {   if(arr[i] == 1) {   p[i] = i-1;   base[i] = i-1;   }   else {   for(int j = i-1; j >= 0; j--) {    if(used[j]) continue;    if(arr[j] == arr[i]-1) {    p[i] = j; used[j] = true;     base[i] = base[j]; break;    }    else used[j] = true;   }   }  }  StringBuilder[] res = new StringBuilder[n];  res[0] = new StringBuilder("1");  sb.append("1\n");  for(int i = 1; i < n; i++) {   if(base[i] == -1) {    res[i] = new StringBuilder();   }   else {   res[i] = new StringBuilder(res[base[i]]);   res[i].append(".");   }   res[i].append(arr[i]+"");   sb.append(res[i]);   sb.append("\n");  }  }  PrintWriter pw = new PrintWriter(System.out);  pw.println(sb.toString().trim());  pw.flush(); } static class FastScanner {  public BufferedReader reader;  public StringTokenizer tokenizer;  public FastScanner() {  reader = new BufferedReader(new InputStreamReader(System.in), 32768);  tokenizer = null;  }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   tokenizer = new StringTokenizer(reader.readLine());   } catch (IOException e) {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public int nextInt() {  return Integer.parseInt(next());  }  public long nextLong() {  return Long.parseLong(next());  }  public double nextDouble() {  return Double.parseDouble(next());  }  public String nextLine() {  try {   return reader.readLine();  } catch(IOException e) {   throw new RuntimeException(e);  }  } } }
4	public class C {  public static void main(String[] args) {  FastScanner fs=new FastScanner();  int T=fs.nextInt();  PrintWriter out=new PrintWriter(System.out);  for (int tt=0; tt<T; tt++) {  int n=fs.nextInt();  int[] a=fs.readArray(n);  int[] stack=new int[n];  int size=0;  for (int i:a) {   if (i==1) {   stack[size++]=i;   }   else {   while (stack[size-1]!=i-1) {    size--;   }   size--;   stack[size++]=i;   }   for (int j=0; j<size; j++) {   out.print(stack[j]);   if (j!=size-1) out.print('.');   }   out.println();  }                       }  out.close(); }  static void sort(int[] a) {  ArrayList<Integer> l=new ArrayList<>();  for (int i:a) l.add(i);  Collections.sort(l);  for (int i=0; i<a.length; i++) a[i]=l.get(i); }  static class FastScanner {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st=new StringTokenizer("");  String next() {  while (!st.hasMoreTokens())   try {   st=new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  return st.nextToken();  }   int nextInt() {  return Integer.parseInt(next());  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++) a[i]=nextInt();  return a;  }  long nextLong() {  return Long.parseLong(next());  } }  }
0	public class A{ public static BufferedReader k; public static BufferedWriter z;    public static void main(String [] args)throws IOException{  k = new BufferedReader(new InputStreamReader(System.in));  z = new BufferedWriter(new OutputStreamWriter(System.out));      String[] dat = k.readLine().split(" ");    long l = Long.parseLong(dat[0]);   long r = Long.parseLong(dat[1]);    if(r-l<=1){   z.write(-1+"\n");  }  else if(r-l == 2){        if((l&1)!=0){   z.write(-1+"\n");   }   else{   z.write(l+" "+(l+1)+" "+r+"\n");   }     }  else{   if(l%2==0){   z.write(l+" "+(l+1)+" "+(l+2)+"\n");   }   else{   z.write((l+1)+" "+(l+2)+" "+(l+3)+"\n");   }  }           z.flush();  } }
2	public class TestClass {  static PrintWriter out = new PrintWriter(System.out);  public static void main(String args[] ) throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s[] = in.readLine().split(" ");  long n = Long.parseLong(s[0]);  long k = Long.parseLong(s[1]);  long x = bs(n,k);  out.println(n-x+1);   out.close();  }  public static long bs(long n,long k)  {  long l=0,h=n;  while(l<=h)  {   long mid = l + (h-l)/2;   long x = mid - sum(mid);   if(x>=k)   {   h = mid-1;   }   else   {   l = mid+1;   }  }  return l;  }  public static long sum(long x)  {  long ans=0;  while(x>0)  {   ans += x%10;   x=x/10;  }  return ans;  } }
3	public final class EcRound35DApplication {  public static void main(String[] args) {  Input input = new Input();  input = SystemInput();  List<String> resultList = run(input);  for(String result:resultList){  System.out.println(result);  }  }   private static void tester(Integer no,List<Integer> inputList,List<String> answer) {  Input input = new Input();  input.setInput(inputList);  List<String> result = run(input);  if(result.equals(answer)) {  System.out.println("No." + no + ":OK");  }  else {  System.out.println("No." + no + ":failed");  System.out.println("result:" + result);  System.out.println("answer:" + answer);  } }   private static Input SystemInput() {  Input input = new Input();  Scanner sc = new Scanner(System.in);  List<Integer> inputList = new ArrayList<Integer>();  while(sc.hasNextInt()) {  inputList.add(sc.nextInt());  }  input.setInput(inputList);  sc.close();  return input; }   private static List<String> run(Input input) {  List<String> result = new ArrayList<String>();  List<Integer> permutation = input.getPermutationList();  Integer count;  count = inversion(permutation);  for(Integer i = 0;i < input.getQueryNum();i++) {  count = count + change(input.getQuery(i));   result.add(evenOdd(count));  }  return result; }   private static Integer inversion(List<Integer>permutation) {  String result = new String();  Integer inversionCount = 0;  for(Integer i = 0; i < permutation.size(); i++) {  for(Integer j = i + 1; j < permutation.size(); j++) {   if(permutation.get(i) > permutation.get(j)) {   inversionCount++;   }  }  }  return inversionCount;  }   private static Integer change(Query query) {  Integer result;  result = query.getLength() * (query.getLength() - 1) / 2;  return result; }   private static String evenOdd(Integer i) {  if(i % 2 == 0) {  return "even";  }  else {  return "odd";  } }   private static class Query{  private Integer l;  private Integer r;  public void setQuery(Integer l,Integer r) {  this.l = l;  this.r = r;  }  public Integer getL() {  return l;  }  public void setL(Integer l) {  this.l = l;  }  public Integer getR() {  return r;  }  public void setR(Integer r) {  this.r = r;  }  public Integer getLength(){  return r - l + 1;  }  }    private static class Input{  private Integer length;  private List<Integer> permutationList = new ArrayList<Integer>();  private Integer queryNum;  private List<Query> queryList = new ArrayList<Query>();  public void setInput(List<Integer> inputList) {  this.length = inputList.get(0);   setPermutationList(inputList.subList(1, length+1));   this.queryNum = inputList.get(length+1);   for(Integer j = length+2; j < inputList.size()-1; j = j + 2) {   addQueryList(inputList.get(j),inputList.get(j+1));  }   }  public void checkInput() {  System.out.println("permutation length:" + permutationList.size());   System.out.println("permutation:" + permutationList);   System.out.println("query length:" + queryList.size());  System.out.println("queries:");  for(Integer i = 0;i < queryList.size();i++) {   System.out.println(this.getQueryL(i) + " " + this.getQueryR(i));  }  }  public Integer getLength() {  return length;  }  public void setLength(Integer length) {  this.length = length;  }  public List<Integer> getPermutationList() {  return permutationList;  }  public void setPermutationList(List<Integer> permutationList) {  this.permutationList = permutationList;  }  public Integer getPermutation(Integer i) {  return permutationList.get(i);  }  public void addPermutationList(Integer newPermutation) {  this.permutationList.add(newPermutation);  }  public Integer getQueryNum() {  return queryNum;  }  public void setQueryNum(Integer queryNum) {  this.queryNum = queryNum;  }  public Query getQuery(Integer i) {  return queryList.get(i);  }  public Integer getQueryL(Integer i) {  return queryList.get(i).getL();  }  public Integer getQueryR(Integer i) {  return queryList.get(i).getR();  }  public List<Query> getQueryList() {  return queryList;  }  public void setQueryList(List<Query> queryList) {  this.queryList = queryList;  }  public void addQueryList(Query newQuery) {  this.queryList.add(newQuery);  }  public void addQueryList(Integer l,Integer r) {  Query newQuery = new Query();  newQuery.setQuery(l, r);  addQueryList(newQuery);  }  } }
4	public class Main {  static MyScanner scan;  static PrintWriter pw;  static long MOD = 1_000_000_007;  static long INF = 2_000_000_000_000_000_000L;  static long inf = 2_000_000_000;  public static void main(String[] args) {   new Thread(null, null, "_", 1 << 27) {    public void run() {     try {      solve();     } catch (Exception e) {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws java.lang.Exception {     initIo(false, "");   StringBuilder sb = new StringBuilder();   int t = ni();   while (t-->0) {    int n = ni();    ArrayList<ArrayList<Integer>> ans = new ArrayList<>();    ArrayList<Integer> prev = new ArrayList<>();    prev.add(1);    ni();    for(int i=1;i<n;i++) {     int x = ni();     ans.add(prev);     ArrayList<Integer> next = new ArrayList<>();     int idx = -1;     for(int j=prev.size()-1;j>=0;--j) {      if(prev.get(j)==x-1) {       for(int k=0;k<j;++k) {        next.add(prev.get(k));       }       next.add(x);       idx = j;       break;      }     }     if(idx==-1) {      assert_in_range("x", x, 1, 1);      for(int e : prev) {       next.add(e);      }      next.add(1);     }     prev = next;    }    ans.add(prev);    for(ArrayList<Integer> list: ans) {     print(list);    }   }   pw.flush();   pw.close();  }  static void print(ArrayList<Integer> list) {   for(int i=0;i<list.size();i++) {    pw.print(list.get(i));    if(i==list.size()-1) {     continue;    }    pw.print(".");   }   pl();  }  static void assert_in_range(String varName, int n, int l, int r) {   if (n >=l && n<=r) return;   System.out.println(varName + " is not in range. Actual: "+n+" l : "+l+" r: "+r);   System.exit(1);  }  static void assert_in_range(String varName, long n, long l, long r) {   if (n>=l && n<=r) return;   System.out.println(varName + " is not in range. Actual: "+n+" l : "+l+" r: "+r);   System.exit(1);  }  static void initIo(boolean isFileIO, String suffix) throws IOException {   scan = new MyScanner(isFileIO, suffix);   if(isFileIO) {    pw = new PrintWriter("/Users/dsds/Desktop/output"+suffix+".txt");   }   else {    pw = new PrintWriter(System.out, true);   }  }  static int ni() throws IOException  {   return scan.nextInt();  }  static long nl() throws IOException  {   return scan.nextLong();  }  static double nd() throws IOException  {   return scan.nextDouble();  }  static String ne() throws IOException  {   return scan.next();  }  static String nel() throws IOException  {   return scan.nextLine();  }  static void pl()  {   pw.println();  }  static void p(Object o)  {   pw.print(o+" ");  }  static void pl(Object o)  {   pw.println(o);  }  static void psb(StringBuilder sb)  {   pw.print(sb);  }  static void pa(String arrayName, Object arr[])  {   pl(arrayName+" : ");   for(Object o : arr)    p(o);   pl();  }  static void pa(String arrayName, int arr[])  {   pl(arrayName+" : ");   for(int o : arr)    p(o);   pl();  }  static void pa(String arrayName, long arr[])  {   pl(arrayName+" : ");   for(long o : arr)    p(o);   pl();  }  static void pa(String arrayName, double arr[])  {   pl(arrayName+" : ");   for(double o : arr)    p(o);   pl();  }  static void pa(String arrayName, char arr[])  {   pl(arrayName+" : ");   for(char o : arr)    p(o);   pl();  }  static void pa(String arrayName, TreeSet<Integer> set)  {   pl(arrayName+" : ");   for(Object o : set)    p(o);   pl();  }  static void pa(String arrayName, boolean arr[])  {   pl(arrayName+" : ");   for(boolean o : arr)    p(o);   pl();  }  static void pa(String listName, List list)  {   pl(listName+" : ");   for(Object o : list)    p(o);   pl();  }  static void pa(String arrayName, Object[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(Object o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, int[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(int o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, long[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(long o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, char[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(char o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, double[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(double o : arr[i])     p(o);    pl();   }  }  static void pa(String arrayName, boolean[][] arr) {   pl(arrayName+" : ");   for(int i=0;i<arr.length;++i) {    for(boolean o : arr[i])     p(o);    pl();   }  }  static class MyScanner  {   BufferedReader br;   StringTokenizer st;   MyScanner(boolean readingFromFile, String suffix) throws IOException   {    if(readingFromFile) {     br = new BufferedReader(new FileReader("/Users/ddfds/Desktop/input"+suffix+".txt"));    }    else {     br = new BufferedReader(new InputStreamReader(System.in));    }   }   String nextLine()throws IOException   {    return br.readLine();   }   String next() throws IOException   {    if(st==null || !st.hasMoreTokens())     st = new StringTokenizer(br.readLine());    return st.nextToken();   }   int nextInt() throws IOException   {    return Integer.parseInt(next());   }   long nextLong() throws IOException   {    return Long.parseLong(next());   }   double nextDouble() throws IOException   {    return Double.parseDouble(next());   }  } }
1	public class TwoSets<V> {  private static int n;  private static int a;  private static int b;  private static List<Node<Integer>> nodes = new LinkedList<Node<Integer>>();  private static Map<Integer, Node<Integer>> datas = new HashMap<Integer, Node<Integer>>();  private static Node<Integer> first;  private static Node<Integer> second;  private static TwoSets<Integer> sets = new TwoSets<Integer>();  private static class Node<V> {  V node;  Node<V> parent;  int rank;  int color = -1;  boolean inprogress;  public Node() {  this.parent = this; }  @Override public String toString() {  return String.format("{node: %s, parent: %s, rank: %s, color:%s}",   node, parent.node, rank, color); }  }  public Node<V> makeSet(V x) {  Node<V> node = new Node<V>();  node.node = x; node.parent = node; node.rank = 0;  return node;  }  public void link(Node<V> x, Node<V> y) {  if (x.rank > y.rank) {  y.parent = x; } else {  x.parent = y;  if (x.rank == y.rank) {  y.rank++;  } }  }  public Node<V> findSet(Node<V> x) {  if (x.parent != x) {  x.parent = findSet(x.parent); }  return x.parent;  }  public void union(Node<V> x, Node<V> y) {  Node<V> rtX = findSet(x); Node<V> rtY = findSet(y); if (rtX.parent != rtY.parent) {  link(rtX, rtY); }  }  public V getNode(Node<V> x) { return x.node;  }  private int getColor(Node<V> node) {  int color; Node<V> parent = findSet(node); color = parent.color;  return color;  }  private void setColor(Node<V> node, int color) { Node<V> parent = findSet(node); parent.color = color;  }  private static Node<Integer> getOrInitNode(Integer key) {  Node<Integer> node = datas.get(key);  if (node == null) {  node = sets.makeSet(key);  datas.put(key, node); }  return node;  }  private static void initNodes(Scanner scanner) {  int key; Node<Integer> node; for (int i = 0; i < n; i++) {  key = scanner.nextInt();  node = getOrInitNode(key);  nodes.add(node); }  }  private static void unionAll(Node<Integer> value) {  int color = sets.getColor(value); if (color == 0) {  if (first == null) {  first = value;  } else {  sets.union(first, value);  } } else if (color == 1) {  if (second == null) {  second = value;  } else {  sets.union(second, value);  } }  }  private static int getKey(Node<Integer> value, int color) {  int key = value.node;  if (color == 0) {  key = a - key; } else {  key = b - key; }  return key;  }  private static boolean checkOpposite(Node<Integer> value, int color) {  boolean valid;  if (value.inprogress) {  valid = Boolean.TRUE; } else {  value.inprogress = Boolean.TRUE;  int opColor = 1 - color;  int key = getKey(value, opColor);  Node<Integer> node = datas.get(key);  valid = (value.node.equals(key)) || (node == null);  if (!valid) {  key = getKey(node, color);  Node<Integer> child = datas.get(key);  valid = (child != null);  if (valid) {   valid = checkOpposite(child, color);   if (valid) {  sets.union(value, node);  sets.union(value, child);  value.inprogress = Boolean.FALSE;   }  }  }  value.inprogress = Boolean.FALSE; }  return valid;  }  private static boolean checkNodes(Node<Integer> value, int color) {  boolean valid;  int key = getKey(value, color); int opColor = 1 - color; Node<Integer> node = datas.get(key); valid = (value.node.equals(key)) || (node != null); if (valid) {  valid = checkOpposite(value, color);  if (valid) {  sets.union(value, node);  sets.setColor(value, color);  } else if (color == 0) {  valid = checkNodes(value, opColor);  } } else if (color == 0) {  valid = checkNodes(value, opColor); }  return valid;  }  private static void format(StringBuilder builder, int i) {  if (i > 0) {  builder.append(' '); }  }  private static String printNodes() {  String text;  StringBuilder builder = new StringBuilder(); Iterator<Node<Integer>> iterator = nodes.iterator(); int i = 0; Node<Integer> node; while (iterator.hasNext()) {  format(builder, i);  node = iterator.next();  builder.append(sets.getColor(node));  i++; } text = builder.toString().trim();  return text;  }  private static boolean checkNodes(int color) {  boolean valid = Boolean.TRUE;  for (Node<Integer> value : nodes) {  if (sets.getColor(value) == -1) {  valid = checkNodes(value, color);  if (valid) {   unionAll(value);  } else {   break;  }  } }  return valid;  }  private static void calculate() {  int color = 0; boolean valid = checkNodes(color); String message = "NO"; if (valid) {  message = "YES";  String array = printNodes();  System.out.println(message);  System.out.println(array); } else {  System.out.println(message); }  }  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in); try {  n = scanner.nextInt();  a = scanner.nextInt();  b = scanner.nextInt();  initNodes(scanner);  calculate(); } finally {  scanner.close(); }  } }
3	public class Main {   public static void main(String[] args) throws Exception{   IO io = new IO(null,null);   int n = io.getNextInt(),ans = 0;   int [] A = new int[n];   for (int i = 0;i < n;i++) {    A[i] = io.getNextInt();    for (int j = 0;j < i;j++)     ans ^= (A[j] > A[i]) ? 1 : 0;   }   String [] word = {"even","odd"};   int m = io.getNextInt();   for (int i = 0;i < m;i++) {    int l = io.getNextInt(),r = io.getNextInt();    int len = r - l + 1;    long tot = len*(len - 1L)/2;    ans ^= tot & 1;    io.println(word[ans]);   }   io.close();  } }  class IO{  private BufferedReader br;  private StringTokenizer st;  private PrintWriter writer;  private String inputFile,outputFile;  public boolean hasMore() throws IOException{   if(st != null && st.hasMoreTokens()) return true;   if(br != null && br.ready()) return true;   return false;  }  public String getNext() throws FileNotFoundException, IOException{   while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());   return st.nextToken();  }  public String getNextLine() throws FileNotFoundException, IOException{   return br.readLine().trim();  }  public int getNextInt() throws FileNotFoundException, IOException{   return Integer.parseInt(getNext());  }  public long getNextLong() throws FileNotFoundException, IOException{   return Long.parseLong(getNext());  }  public void print(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f" ,x);  }  public void println(double x,int num_digits) throws IOException{   writer.printf("%." + num_digits + "f\n" ,x);  }  public void print(Object o) throws IOException{   writer.print(o.toString());  }  public void println(Object o) throws IOException{   writer.println(o.toString());  }  public IO(String x,String y) throws FileNotFoundException, IOException{   inputFile = x;   outputFile = y;   if(x != null) br = new BufferedReader(new FileReader(inputFile));   else br = new BufferedReader(new InputStreamReader(System.in));   if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));   else writer = new PrintWriter(new OutputStreamWriter(System.out));  }  protected void close() throws IOException{   br.close();   writer.close();  }  public void outputArr(Object [] A) throws IOException{   int L = A.length;   for (int i = 0;i < L;i++) {    if(i > 0) writer.print(" ");    writer.print(A[i]);   }   writer.print("\n");  } }
4	public class C { InputStream is; FastWriter out; String INPUT = "";  void solve() {  for(int T = ni();T > 0;T--)go(); }  void go() {  int n = ni();  int[] st = new int[n];  int sp = 0;  for(int i = 0;i < n;i++){  int x = ni();  if(x == 1){   st[sp++] = 1;  }else{   while(sp > 0){   if(st[sp-1] + 1 == x){    st[sp-1]++;    break;   }else{    sp--;   }   }  }  for(int j = 0;j < sp;j++){   if(j > 0)out.print(".");   out.print(st[j]);  }  out.println();  } }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new FastWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new C().run(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private long[] nal(int n) {  long[] a = new long[n];  for(int i = 0;i < n;i++)a[i] = nl();  return a; }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[][] nmi(int n, int m) {  int[][] map = new int[n][];  for(int i = 0;i < n;i++)map[i] = na(m);  return map; }  private int ni() { return (int)nl(); }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }  while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  public static class FastWriter {  private static final int BUF_SIZE = 1<<13;  private final byte[] buf = new byte[BUF_SIZE];  private final OutputStream out;  private int ptr = 0;  private FastWriter(){out = null;}  public FastWriter(OutputStream os)  {  this.out = os;  }  public FastWriter(String path)  {  try {   this.out = new FileOutputStream(path);  } catch (FileNotFoundException e) {   throw new RuntimeException("FastWriter");  }  }  public FastWriter write(byte b)  {  buf[ptr++] = b;  if(ptr == BUF_SIZE)innerflush();  return this;  }  public FastWriter write(char c)  {  return write((byte)c);  }  public FastWriter write(char[] s)  {  for(char c : s){   buf[ptr++] = (byte)c;   if(ptr == BUF_SIZE)innerflush();  }  return this;  }  public FastWriter write(String s)  {  s.chars().forEach(c -> {   buf[ptr++] = (byte)c;   if(ptr == BUF_SIZE)innerflush();  });  return this;  }  private static int countDigits(int l) {  if (l >= 1000000000) return 10;  if (l >= 100000000) return 9;  if (l >= 10000000) return 8;  if (l >= 1000000) return 7;  if (l >= 100000) return 6;  if (l >= 10000) return 5;  if (l >= 1000) return 4;  if (l >= 100) return 3;  if (l >= 10) return 2;  return 1;  }  public FastWriter write(int x)  {  if(x == Integer.MIN_VALUE){   return write((long)x);  }  if(ptr + 12 >= BUF_SIZE)innerflush();  if(x < 0){   write((byte)'-');   x = -x;  }  int d = countDigits(x);  for(int i = ptr + d - 1;i >= ptr;i--){   buf[i] = (byte)('0'+x%10);   x /= 10;  }  ptr += d;  return this;  }  private static int countDigits(long l) {  if (l >= 1000000000000000000L) return 19;  if (l >= 100000000000000000L) return 18;  if (l >= 10000000000000000L) return 17;  if (l >= 1000000000000000L) return 16;  if (l >= 100000000000000L) return 15;  if (l >= 10000000000000L) return 14;  if (l >= 1000000000000L) return 13;  if (l >= 100000000000L) return 12;  if (l >= 10000000000L) return 11;  if (l >= 1000000000L) return 10;  if (l >= 100000000L) return 9;  if (l >= 10000000L) return 8;  if (l >= 1000000L) return 7;  if (l >= 100000L) return 6;  if (l >= 10000L) return 5;  if (l >= 1000L) return 4;  if (l >= 100L) return 3;  if (l >= 10L) return 2;  return 1;  }  public FastWriter write(long x)  {  if(x == Long.MIN_VALUE){   return write("" + x);  }  if(ptr + 21 >= BUF_SIZE)innerflush();  if(x < 0){   write((byte)'-');   x = -x;  }  int d = countDigits(x);  for(int i = ptr + d - 1;i >= ptr;i--){   buf[i] = (byte)('0'+x%10);   x /= 10;  }  ptr += d;  return this;  }  public FastWriter write(double x, int precision)  {  if(x < 0){   write('-');   x = -x;  }  x += Math.pow(10, -precision)/2;    write((long)x).write(".");  x -= (long)x;  for(int i = 0;i < precision;i++){   x *= 10;   write((char)('0'+(int)x));   x -= (int)x;  }  return this;  }  public FastWriter writeln(char c){  return write(c).writeln();  }  public FastWriter writeln(int x){  return write(x).writeln();  }  public FastWriter writeln(long x){  return write(x).writeln();  }  public FastWriter writeln(double x, int precision){  return write(x, precision).writeln();  }  public FastWriter write(int... xs)  {  boolean first = true;  for(int x : xs) {   if (!first) write(' ');   first = false;   write(x);  }  return this;  }  public FastWriter write(long... xs)  {  boolean first = true;  for(long x : xs) {   if (!first) write(' ');   first = false;   write(x);  }  return this;  }  public FastWriter writeln()  {  return write((byte)'\n');  }  public FastWriter writeln(int... xs)  {  return write(xs).writeln();  }  public FastWriter writeln(long... xs)  {  return write(xs).writeln();  }  public FastWriter writeln(char[] line)  {  return write(line).writeln();  }  public FastWriter writeln(char[]... map)  {  for(char[] line : map)write(line).writeln();  return this;  }  public FastWriter writeln(String s)  {  return write(s).writeln();  }  private void innerflush()  {  try {   out.write(buf, 0, ptr);   ptr = 0;  } catch (IOException e) {   throw new RuntimeException("innerflush");  }  }  public void flush()  {  innerflush();  try {   out.flush();  } catch (IOException e) {   throw new RuntimeException("flush");  }  }  public FastWriter print(byte b) { return write(b); }  public FastWriter print(char c) { return write(c); }  public FastWriter print(char[] s) { return write(s); }  public FastWriter print(String s) { return write(s); }  public FastWriter print(int x) { return write(x); }  public FastWriter print(long x) { return write(x); }  public FastWriter print(double x, int precision) { return write(x, precision); }  public FastWriter println(char c){ return writeln(c); }  public FastWriter println(int x){ return writeln(x); }  public FastWriter println(long x){ return writeln(x); }  public FastWriter println(double x, int precision){ return writeln(x, precision); }  public FastWriter print(int... xs) { return write(xs); }  public FastWriter print(long... xs) { return write(xs); }  public FastWriter println(int... xs) { return writeln(xs); }  public FastWriter println(long... xs) { return writeln(xs); }  public FastWriter println(char[] line) { return writeln(line); }  public FastWriter println(char[]... map) { return writeln(map); }  public FastWriter println(String s) { return writeln(s); }  public FastWriter println() { return writeln(); } }  public void trnz(int... o) {  for(int i = 0;i < o.length;i++)if(o[i] != 0)System.out.print(i+":"+o[i]+" ");  System.out.println(); }   public void trt(long... o) {  Queue<Integer> stands = new ArrayDeque<>();  for(int i = 0;i < o.length;i++){  for(long x = o[i];x != 0;x &= x-1)stands.add(i<<6|Long.numberOfTrailingZeros(x));  }  System.out.println(stands); }  public void tf(boolean... r) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println(); }  public void tf(boolean[]... b) {  for(boolean[] r : b) {  for(boolean x : r)System.out.print(x?'#':'.');  System.out.println();  }  System.out.println(); }  public void tf(long[]... b) {  if(INPUT.length() != 0) {  for (long[] r : b) {   for (long x : r) {   for (int i = 0; i < 64; i++) {    System.out.print(x << ~i < 0 ? '#' : '.');   }   }   System.out.println();  }  System.out.println();  } }  public void tf(long... b) {  if(INPUT.length() != 0) {  for (long x : b) {   for (int i = 0; i < 64; i++) {   System.out.print(x << ~i < 0 ? '#' : '.');   }  }  System.out.println();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
2	public class C817 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long s = nl();  long l = 1;  long r = n;  long ans = 0;  while(l<=r){  long mid = (l+r)/2;  long sum = 0;  long temp = mid;  while(temp!=0){   sum += temp%10;   temp/=10;  }  if(mid-sum<s){   ans = mid;   l = mid+1;  }else   r = mid - 1;  }  out.println(n-ans); }  void run() throws Exception {  is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);  long s = System.currentTimeMillis();  solve();  out.flush();  if (!INPUT.isEmpty())  tr(System.currentTimeMillis() - s + "ms"); }  public static void main(String[] args) throws Exception {  new Thread(null, new Runnable() {  public void run() {   try {   new C817().run();   } catch (Exception e) {   e.printStackTrace();   }  }  }, "1", 1 << 26).start(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if (lenbuf == -1)  throw new InputMismatchException();  if (ptrbuf >= lenbuf) {  ptrbuf = 0;  try {   lenbuf = is.read(inbuf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (lenbuf <= 0)   return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126); }  private int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))  ;  return b; }  private double nd() {  return Double.parseDouble(ns()); }  private char nc() {  return (char) skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(isSpaceChar(b))) {        sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(isSpaceChar(b))) {  buf[p++] = (char) b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)  map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = readByte();  }  while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = readByte();  } }  private void tr(Object... o) {  System.out.println(Arrays.deepToString(o)); } }
4	public class Main { public static void main(String[] args) throws Exception {  FastIO io = new FastIO();  int test=io.nextInt();  while(test>0)  {   int n=io.nextInt();   int arr[]=new int[n];   for(int i=0;i<n;i++)arr[i]=io.nextInt();   List<int[]> list=new ArrayList<>();   Stack<int[]> stk=new Stack<>();   int temp[]={1};   list.add(temp);   stk.push(temp);   for(int i=1;i<n;i++)   {    if(arr[i]==1)    {     int t[]=stk.peek();     int nt[]=new int[t.length+1];     for(int j=0;j<t.length;j++)nt[j]=t[j];     nt[nt.length-1]=arr[i];     stk.push(nt);     list.add(nt);     continue;    }    while(stk.size()>0)    {     int t[]=stk.peek();     if(t[t.length-1]+1==arr[i]){      int nt[]=new int[t.length];      for(int j=0;j<t.length-1;j++)nt[j]=t[j];      nt[t.length-1]=arr[i];      stk.pop();      stk.push(nt);      list.add(nt);      break;     }     else     {      stk.pop();     }    }   }   for(int i=0;i<list.size();i++)   {    StringBuilder sb=new StringBuilder();    sb.append(list.get(i)[0]);    for(int j=1;j<list.get(i).length;j++)    {     sb.append("."+list.get(i)[j]);    }    io.println(sb.toString());   }   test--;  }  io.close(); } }  class FastIO extends PrintWriter { private InputStream stream; private byte[] buf = new byte[1<<16]; private int curChar, numChars;   public FastIO() { this(System.in,System.out); } public FastIO(InputStream i, OutputStream o) {  super(o);  stream = i; }  public FastIO(String i, String o) throws IOException {  super(new FileWriter(o));  stream = new FileInputStream(i); }   private int nextByte() {  if (numChars == -1) throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars == -1) return -1;  }  return buf[curChar++]; }  public String nextLine() {  int c; do { c = nextByte(); } while (c <= '\n');  StringBuilder res = new StringBuilder();  do { res.appendCodePoint(c); c = nextByte(); } while (c > '\n');  return res.toString(); }  public String next() {  int c; do { c = nextByte(); } while (c <= ' ');  StringBuilder res = new StringBuilder();  do { res.appendCodePoint(c); c = nextByte(); } while (c > ' ');  return res.toString(); }  public int nextInt() {  int c; do { c = nextByte(); } while (c <= ' ');  int sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res = 10*res+c-'0';  c = nextByte();  } while (c > ' ');  return res * sgn; }  public long nextLong() {  int c; do { c = nextByte(); } while (c <= ' ');  long sgn = 1; if (c == '-') { sgn = -1; c = nextByte(); }  long res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res = 10*res+c-'0';  c = nextByte();  } while (c > ' ');  return res * sgn; }  public double nextDouble() { return Double.parseDouble(next()); } }
0	public class D5 implements Runnable {  final double eps = 1e-9;  private void Solution() throws IOException {  double a = nextDouble(), v = nextDouble();  double l = nextDouble(), d = nextDouble(), w = nextDouble();  double t = 0;  if (w + eps > v) {  double s = v * v / (2 * a);  if (s + eps > l)   t = Math.sqrt(2 * l / a);  else {   double ta = v / a;   double sa = a * ta * ta / 2;   t = ta + (l - sa) / v;  }  } else {  double sv = v * v / (2 * a);  double sw = w * w / (2 * a);  if (sw + eps > d) {   if (sv + eps > l)   t = Math.sqrt(2 * l / a);   else {   double ta = v / a;   double sa = a * ta * ta / 2;   t = ta + (l - sa) / v;   }  } else {   double sd = (w * w - v * v) / (-2 * a);   if (sv + sd < eps + d)   t = v / a + (d - sv - sd) / v + (v - w) / a;   else {   double f = Math.sqrt(d * a + w * w / 2);   t = f / a + (f - w) / a;   }   if (sd + eps > l - d) {   double lv = Math.sqrt((l - d) * 2 * a + w * w);   t += (lv - w) / a;   } else {   t += (v - w) / a + (l - d - sd) / v;   }  }  }  out.printf("%.12f", t); }  public static void main(String[] args) {  new D5().run(); }  BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  Solution();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(0);  } }  void print(Object... obj) {  for (int i = 0; i < obj.length; i++) {  if (i != 0)   out.print(" ");  out.print(obj[i]);  } }  void println(Object... obj) {  print(obj);  print("\n"); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next()); }  String nextLine() throws IOException {  return in.readLine(); }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(nextLine());  return tokenizer.nextToken(); } }
6	public class Main {  final static boolean debug = false;  final static String fileName = "";  final static boolean useFiles = false;  public static void main(String[] args) throws FileNotFoundException {   long start;   if (debug)    start = System.nanoTime();   InputStream inputStream;   OutputStream outputStream;   if (useFiles) {    inputStream = new FileInputStream(fileName + ".in");    outputStream = new FileOutputStream(fileName + ".out");   } else {    inputStream = System.in;    outputStream = System.out;   }   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task(in, out);   solver.solve();   if(debug)    out.println((System.nanoTime() - start) / 1e+9);   out.close();  } } class Task {  int[][] dist, pre;  int[] x, y, d, prev;  String[] leafDescription;  String[] linerDescription;  String[][] allDescriptions;  int xs, ys, n;  int dist(int i, int j) {   return (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  void go(int[] prev, String[] leafDescription, int[] d, int len, int add, String description){   for (int mask = 0; mask < d.length; mask++) {    if ((mask & add) != add)     continue;    int newValue = d[mask & (~add)] + len;    if (d[mask] > newValue){     d[mask] = newValue;     leafDescription[mask] = description;     prev[mask] = mask & (~add);    }   }  }  int rec(int mask) {   if (d[mask] != -1)    return d[mask];   int lowest = 0;   for (; ((1 << lowest) & mask) == 0; lowest++) ;   int newMask = mask & (~(1 << lowest));   d[mask] = rec(newMask) + dist[lowest][n];   prev[mask] = newMask;   leafDescription[mask] = linerDescription[lowest];   for (int bit = lowest + 1; bit < n; bit++) {    if (((1 << bit) & mask) > 0) {     newMask = mask & (~(1 << bit)) & (~(1 << lowest));     int newValue = rec(newMask) + pre[bit][lowest];     if (newValue < d[mask]) {      d[mask] = newValue;      prev[mask] = newMask;      leafDescription[mask] = allDescriptions[lowest][bit];     }    }   }   return d[mask];  }  public void solve() {   final int inf = (int) 1e+9;   xs = in.nextInt();   ys = in.nextInt();   n = in.nextInt();   x = new int[n + 1];   y = new int[n + 1];   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   x[n] = xs;   y[n] = ys;   allDescriptions = new String[n][n];   for (int i = 0; i < n; i++){    for (int j = 0; j < n; j++){     allDescriptions[i][j] = (i + 1) + " " + (j + 1) + " ";    }   }   linerDescription = new String[n];   for (int i = 0; i < n; i++){    linerDescription[i] = (i + 1) + " ";   }   dist = new int[n + 1][n + 1];   pre = new int[n + 1][n + 1];   for (int i = 0; i <= n; i++) {    for (int j = 0; j <= n; j++) {     dist[i][j] = 2 * dist(i, j);     pre[i][j] = dist(i, n) + dist(i, j) + dist(j, n);    }   }   d = new int[1 << n];   Arrays.fill(d, -1);   d[0] = 0;   prev = new int[1 << n];   leafDescription = new String[1 << n];              int result = rec((1 << n) - 1);   String answer = "";   for (int curr = d.length - 1; prev[curr] != curr; curr = prev[curr] ){    answer += "0 " + leafDescription[curr];   }   answer += "0";   out.println(result);   out.println(answer);  }  private InputReader in;  private PrintWriter out;  Task(InputReader in, PrintWriter out) {   this.in = in;   this.out = out;  } } class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream), 32768);   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public double nextDouble(){   return Double.parseDouble(next());  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong(){   return Long.parseLong(next());  }  public byte nextByte(){   return Byte.parseByte(next());  } }
3	public class A {  InputStream in; PrintWriter out;  void solve()  {  int n=ni();  int a[]=na(n);  int INV=0;  for (int i=0;i<n;i++)  for (int j=i+1;j<n;j++)   if (a[i]>a[j])   INV++;  boolean even=INV%2==0;  int q=ni();  while (q-->0)  {  int l=ni();  int r=ni();  int len=r-l+1;  len=(len-1)*(len)/2;  if (len%2==1)   even=!even;  if (even)   out.println("even");  else   out.println("odd");  } }  int MAX = (int)1e5; long factorial[]; void findfactorial()  {  factorial = new long[MAX + 1];  factorial[0] = 1;  for (int i = 1; i < MAX + 1; i++)  {  factorial[i] = mul(i,factorial[i - 1]);  } }  long mod=(long)1e9+7; long add(long a,long b) {  long x=(a+b);  while(x>=mod) x-=mod;  return x;   }   long sub(long a,long b) {  long x=(a-b);  while(x<0) x+=mod;  return x;   }   long mul(long a,long b) {  a%=mod;  b%=mod;  long x=(a*b);  return x%mod;   }  int max(int a,int b) {  if(a>b)  return a;  else  return b; }  int min(int a,int b) {  if(a>b)  return b;  else   return a; }  long max(long a,long b) {  if(a>b)  return a;  else  return b;   }   long min(long a,long b) {  if(a>b)  return b;  else   return a;   }   void run() throws Exception  {  String INPUT = "C:/Users/ayubs/Desktop/input.txt";  in = oj ? System.in : new FileInputStream(INPUT);  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis() - s + "ms");   } public static void main(String[] args) throws Exception  {  new A().run(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte()  {  if (lenbuf == -1)  throw new InputMismatchException();  if (ptrbuf >= lenbuf)  {  ptrbuf = 0;  try   {   lenbuf = in.read(inbuf);  }  catch (IOException e)   {   throw new InputMismatchException();  }  if (lenbuf <= 0)   return -1;  }  return inbuf[ptrbuf++]; }  private boolean inSpaceChar(int c)  {  return !(c >= 33 && c <= 126); }  private int skip()  {  int b;  while ((b = readByte()) != -1 && inSpaceChar(b))  ;  return b; }  private double nd()  {  return Double.parseDouble(ns()); }  private char nc()  {  return (char) skip(); }  private String ns()  {  int b = skip();  StringBuilder sb = new StringBuilder();  while (!(inSpaceChar(b)))  {   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n)  {  char[] buf = new char[n];  int b = skip(), p = 0;  while (p < n && !(inSpaceChar(b)))  {  buf[p++] = (char) b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m)  {  char[][] map = new char[n][];  for (int i = 0; i < n; i++)  map[i] = ns(m);  return map; }  private int[] na(int n)  {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = ni();  return a; }  private int ni()  {  int num = 0, b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-')  {  minus = true;  b = readByte();  }   while (true)  {  if (b >= '0' && b <= '9')   {   num = num * 10 + (b - '0');  }   else   {   return minus ? -num : num;  }  b = readByte();  } }  private long nl()  {  long num = 0;  int b;  boolean minus = false;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-')  {  minus = true;  b = readByte();  }   while (true)  {  if (b >= '0' && b <= '9')   {   num = num * 10 + (b - '0');  }  else   {   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null;  private void tr(Object... o)  {  if (!oj)  System.out.println(Arrays.deepToString(o)); }  }
1	public class B {  void solve() throws IOException {   int n=nextInt();   int a=nextInt();   int b=nextInt();   int[] p=new int[n];   for(int i=0;i<n;i++)p[i]=nextInt();     TreeSet<Integer>[] s=new TreeSet[n];   for(int i=0;i<n;i++)s[i]=new TreeSet<Integer>();   HashMap<Integer,Integer> m=new HashMap<Integer, Integer>();   for(int i=0;i<n;i++)    m.put(p[i],i);   for(int i=0;i<n;i++){    if(m.containsKey(a-p[i])){     s[i].add(a-p[i]);     s[m.get(a-p[i])].add(p[i]);    }    if(m.containsKey(b-p[i])){     s[i].add(b-p[i]);     s[m.get(b-p[i])].add(p[i]);    }   }   int last=-1;   LinkedList<Integer> q=new LinkedList<Integer>();   for(int i=0;i<n;i++){    if(s[i].size()==0){     out.println("NO");     return;    }    if(s[i].size()==1){     q.add(i);    }   }   int[] ans=new int[n];   while(last!=n){    while(!q.isEmpty()){     int cur=q.poll();     if(s[cur].size()==0)continue;     int x=p[cur];     int y=s[cur].first();     if(x==a-y){      ans[cur]=1;      ans[m.get(y)]=1;     }     else{      ans[cur]=2;      ans[m.get(y)]=2;     }     for(Integer u:s[m.get(y)]){      int o=m.get(u);      if(o!=m.get(y)) {       s[o].remove(y);       if (s[o].size() == 1) q.add(o);      }     }     for(Integer u:s[cur]){      int o=m.get(u);      if(o!=m.get(y)) {       s[o].remove(y);       if (s[o].size() == 1) q.add(o);      }     }    }    last++;    while(last!=n){     if(s[last].size()!=0&&ans[last]==0)break;     last++;    }    if(last!=n){     q.add(last);    }   }   for(int i=0;i<n;i++)    if(ans[i]==0){     out.println("NO");     return;    }   out.println("YES");   for(int i=0;i<n;i++)    out.print((ans[i]-1)+" ");  }  public static void main(String[] args) throws IOException {   new B().run();  }  void run() throws IOException {   reader = new BufferedReader(new InputStreamReader(System.in));   tokenizer = null;   out = new PrintWriter(new OutputStreamWriter(System.out));   solve();   reader.close();   out.flush();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
1	public class B138 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int a[] = new int[100004];   int b[] = new int[100004];   int n, m, ans = 0, dau, cuoi=-1;   n = sc.nextInt();   m = sc.nextInt();   for(int i=0;i<100004;i++) a[i] = 0;   for(int i=0;i<n;i++){    b[i] = sc.nextInt();    if(a[b[i]]==0){     a[b[i]] = 1;     ans++;     if(ans==m){      cuoi = i+1;      break;     }    }   }   for(int i=cuoi-1;i>=00;i--){    if(a[b[i]]==1){     a[b[i]] = 0;     ans--;     if(ans==0){      System.out.println((i+1)+" "+cuoi);      System.exit(0);     }    }   }   System.out.println("-1 -1");  } }
1	public class D909 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   char[] line = br.readLine().toCharArray();   int n = line.length;   int l = 0;   ArrayList<Node> groups = new ArrayList<>();   Node node = new Node(line[0], 1);   groups.add(node);   for (int i = 1; i < n; i++) {    if (line[i] == groups.get(l).letter) {     groups.get(l).count++;    } else {     node = new Node(line[i], 1);     groups.add(node);     l++;    }   }   int moves = 0;   ArrayList<Node> temp = new ArrayList<>();   while (groups.size() > 1) {    moves++;    l = groups.size();    groups.get(0).count--;    groups.get(l - 1).count--;    for (int i = 1; i < l - 1; i++) {     groups.get(i).count -= 2;    }    int p;    for (p = 0; p < l; p++) {     if (groups.get(p).count > 0) {      temp.add(groups.get(p));      break;     }    }    int lTemp = temp.size();    for (p++; p < l; p++) {     if (groups.get(p).count <= 0) {      continue;     }     if (groups.get(p).letter == temp.get(lTemp - 1).letter) {      temp.get(lTemp - 1).count += groups.get(p).count;     } else {      temp.add(groups.get(p));      lTemp++;     }    }    groups.clear();    groups.addAll(temp);    temp.clear();   }   System.out.println(moves);  }  private static class Node {   char letter;   int count;   Node(char letter, int count) {    this.letter = letter;    this.count = count;   }  } }
6	public class AMain { static int n; static int[] best; static int[][] dist; static int[] home; static LinkedList<Integer> ret; public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  State curr = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));  n = Integer.parseInt(br.readLine());  State[] list = new State[n];  for(int i = 0; i < n; i++) {  st = new StringTokenizer(br.readLine());  list[i] = new State(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));  }  dist = new int[n][n];  home = new int[n];  for(int i = 0; i < n; i++) {  home[i] = dist(curr, list[i]);  }  for(int i = 0; i < n; i++) {  dist[i][i] = 2 * home[i];  for(int j = i+1; j < n; j++) {   dist[i][j] = dist(list[i], list[j]) + home[i] + home[j];  }  }  best = new int[1 << (n)];  Arrays.fill(best, -1);  best[0] = 0;  System.out.println(solve(-1 + (1<<n)));  ret = new LinkedList<Integer>();  resolve(-1 + (1<<n));  for(int x: ret)  System.out.print(x + " "); } public static int dist(State a, State b) {  int x = a.x-b.x;  int y = a.y-b.y;  return x*x+y*y; } public static void resolve(int curr) {  ret.addLast(0);  for(int i = 0; i < n; i++) {  if((curr & (1<<i)) == 0)   continue;  for(int j = i+1; j < n; j++) {   if((curr & (1 << j)) == 0) {   continue;   }   if(dist[i][j] + solve(curr ^ (1<<i) ^ (1 << j)) == best[curr]) {   ret.addLast(i+1);   ret.addLast(j+1);   resolve(curr - (1<<i) - (1<<j));   return;   }  }  if(best[curr] == dist[i][i] + solve(curr ^ (1<<i))) {   ret.addLast(i+1);   resolve(curr - (1<<i));   return;  }  } } public static int solve(int curr) {  if(best[curr] != -1)  return best[curr];  int ret = Integer.MAX_VALUE;  for(int i = 0; i < n; i++) {  if((curr & (1<<i)) == 0)   continue;  for(int j = i+1; j < n; j++) {   if((curr & (1 << j)) == 0) {   continue;   }   ret = Math.min(ret, dist[i][j] + solve(curr ^ (1<<i) ^ (1 << j)));  }  ret = Math.min(ret, dist[i][i] + solve(curr ^ (1<<i)));  break;  }  best[curr] = ret;  return ret; } static class State {  public int x,y;  public State(int a, int b) {  x=a;  y=b;  } } }
5	public class Solution implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer st;  String nextToken() throws Exception {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int nextInt() throws Exception {  return Integer.parseInt(nextToken()); }  long nextLong() throws Exception {  return Long.parseLong(nextToken()); }  double nextDouble() throws Exception {  return Double.parseDouble(nextToken()); }  int fu(int[] a, int l) {  for (int i = l; i < a.length - 1; i++) {  if (a[i] > a[i + 1]) return i;  }  return a.length; }  void swap(int[] a, int q, int w) {  int t = a[q]; a[q] = a[w]; a[w] = t; }  void solve() throws Exception {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) a[i] = nextInt();  int q = fu(a, 0);  if (q == n) out.println("YES"); else {  int w = fu(a, q + 1);  if (w < n) {   boolean ans = false;   swap(a, q, w);   ans |= fu(a, 0) == n;   swap(a, q, w);   if (q < n - 1) {   swap(a, q + 1, w);   ans |= fu(a, 0) == n;   swap(a, q + 1, w);   }   if (w < n - 1) {   swap(a, q, w + 1);   ans |= fu(a, 0) == n;   swap(a, q, w + 1);   }   if (q < n - 1 && w < n - 1) {   swap(a, q + 1, w + 1);   ans |= fu(a, 0) == n;   swap(a, q + 1, w + 1);   }   if (ans) out.println("YES"); else out.println("NO");  } else {   int j = q + 1;   while (j < n && a[j] == a[q + 1]) j++;   j--;   swap(a, q, j);   if (fu(a, 0) == n) out.println("YES"); else {   swap(a, q, j);   q++;   j = q - 1;   while (j >= 0 && a[j] == a[q - 1]) j--;   j++;   swap(a, q, j);   if (fu(a, 0) == n) out.println("YES"); else out.println("NO");   }  }  } }  public void run() {  try {  Locale.setDefault(Locale.UK);  in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();  } catch (Exception e) {  e.printStackTrace();  System.exit(1);  } finally {  out.close();  } }  public static void main(String[] args) {   (new Solution()).run(); } }
6	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, InputReader in, PrintWriter out) {    Point bag = new Point(in.ni(), in.ni());    int n = in.ni();    Point[] arr = new Point[n];    for (int i = 0; i < n; ++i)     arr[i] = new Point(in.ni(), in.ni());    int[] dist = new int[n];    for (int i = 0; i < n; ++i) {     int dx = arr[i].x - bag.x;     int dy = arr[i].y - bag.y;     dist[i] = dx * dx + dy * dy;    }    int[][] d = new int[n][n];    for (int i = 0; i < n; ++i) {     for (int j = 0; j < n; ++j) {      int dx = arr[i].x - arr[j].x;      int dy = arr[i].y - arr[j].y;      d[i][j] = dx * dx + dy * dy + dist[i] + dist[j];     }    }    int lim = (1 << n);    int[] dp = new int[lim];    Arrays.fill(dp, Integer.MAX_VALUE);    dp[0] = 0;    int[] p = new int[lim];    Arrays.fill(p, -1);    for (int mask = 0; mask < lim; ++mask) {     if (dp[mask] == Integer.MAX_VALUE)      continue;     int minBit = -1;     for (int bit = 0; bit < n; ++bit) {      if (checkBit(mask, bit))       continue;      if (minBit == -1 || (dist[minBit] > dist[bit]))       minBit = bit;     }     if (minBit == -1)      continue;     for (int bit = 0; bit < n; ++bit) {      if (checkBit(mask, bit))       continue;      int newMask = (mask | (1 << minBit) | (1 << bit));      if (dp[newMask] > dp[mask] + d[minBit][bit]) {       dp[newMask] = dp[mask] + d[minBit][bit];       p[newMask] = minBit * n + bit;      }     }    }    out.println(dp[lim - 1]);    int curMask = lim - 1;    while (p[curMask] != -1) {     out.print("0 ");     int first = p[curMask] / n;     int second = p[curMask] % n;     out.print(first + 1 + " ");     curMask ^= (1 << first);     if (first != second) {      out.print(second + 1 + " ");      curMask ^= (1 << second);     }    }    out.println(0);   }   boolean checkBit(int mask, int bitNumber) {    return (mask & (1 << bitNumber)) != 0;   }  }  static class InputReader {   BufferedReader br;   StringTokenizer st;   public InputReader(InputStream inputStream) {    br = new BufferedReader(new InputStreamReader(inputStream));   }   public String n() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public int ni() {    return Integer.parseInt(n());   }  } }
0	public class problemA {  public static long GCD(long number1, long number2) {     if(number2 == 0){    return number1;   }   return GCD(number2, number1%number2);  }  public static void main(String[] args) throws NumberFormatException, IOException {  BufferedReader br = new BufferedReader (new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(br.readLine());   long b = Long.parseLong(st.nextToken());   long c = Long.parseLong(st.nextToken());   if(c-b<2 ||((c-b==2)&& GCD(c,b)==1) ){    System.out.println("-1");   }else{     if(b%2==0 ){      System.out.println(b+" "+(b+1)+" "+(b+2));    }else     System.out.println((b+1)+" "+(b+2)+" "+(b+3));      }       } }
5	public class A {  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  static Random rnd;  void solve() throws IOException {   int n = nextInt();   int[] arr = new int[n];   Integer[] arrCopy = new Integer[n];   for (int i = 0; i < n; i++)    arr[i] = arrCopy[i] = nextInt();   Arrays.sort(arrCopy);   int bad = 0;   for (int i = 0; i < n; i++)    if (arr[i] != arrCopy[i])     ++bad;   boolean fail = bad > 2;   out.println(!fail ? "YES" : "NO");  }  public static void main(String[] args) {   new A().run();  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    rnd = new Random();    solve();    out.close();   } catch (IOException e) {    e.printStackTrace();    System.exit(42);   }  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    String line = in.readLine();    if (line == null)     return null;    st = new StringTokenizer(line);   }   return st.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
1	public class A { public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String s = new String(in.readLine());   String[] t=s.split(" ");   int n = Integer.parseInt(t[0]);   int k = Integer.parseInt(t[1]);   boolean[] prime=new boolean[n+1];   for (int i=2;i<Math.sqrt(n);i++) {   for (int j=i+i;j<=n;j=j+i) {    prime[j]=true;   }   }   int size=0;   for (int i=2;i<=n;i++) {   if (!prime[i]) {    size++;   }   }   int[] pn=new int[size];   int index=0;   for (int i=2;i<=n;i++) {   if (!prime[i]) {    pn[index]=i;    index++;   }     }   for (int i=2;i<size;i++) {   for (int j=0;j<i;j++) {    if (pn[i]==pn[j]+pn[j+1]+1) {     k--;    }   }   }   if (k<=0) {   System.out.println("YES");   } else {   System.out.println("NO");   } } }
3	public class D {   String INPUT = "4\n" +     "1 2 4 3\n" +     "4\n" +     "1 1\n" +     "1 4\n" +     "1 4\n" +     "2 3";   void solve()   {     int n = i();     int[] a = ia(n);     int count = 0 ;     for(int i = 0 ; i<n-1 ; i++)     {       for(int j = i+1; j<n ; j++)       {         if(a[j]<a[i])         {           count++;         }       }     }     int q = i();     for(int i = 0 ; i<q ; i++)     {       int l = i(), r=i();       int mid = (r-l+1)/2;       if(mid%2==0)       {         out.println(count%2==0?"even":"odd");       }       else       {         count++;         out.println(count%2==0?"even":"odd");       }     }    }     void run() throws Exception{     is = oj ? System.in: new ByteArrayInputStream(INPUT.getBytes());         out = new PrintWriter(System.out);     int t = 1;     while(t-->0) solve();     out.flush();   }   public static void main(String[] args)throws Exception {     new D().run();   }   InputStream is;   PrintWriter out;   private byte[] inbuf = new byte[1024];   public int lenbuf = 0, ptrbuf = 0;   private int readByte()   {     if(lenbuf == -1)throw new InputMismatchException();     if(ptrbuf >= lenbuf){       ptrbuf = 0;       try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }       if(lenbuf <= 0)return -1;     }     return inbuf[ptrbuf++];   }   private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }   private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }   private double d() { return Double.parseDouble(s()); }   private char c() { return (char)skip(); }   private String s()   {     int b = skip();     StringBuilder sb = new StringBuilder();     while(!(isSpaceChar(b))){       sb.appendCodePoint(b);       b = readByte();     }     return sb.toString();   }   private char[] sa(int n)   {     char[] buf = new char[n];     int b = skip(), p = 0;     while(p < n && !(isSpaceChar(b))){       buf[p++] = (char)b;       b = readByte();     }     return n == p ? buf : Arrays.copyOf(buf, p);   }   private char[][] nm(int n, int m)   {     char[][] map = new char[n][];     for(int i = 0;i < n;i++)map[i] = sa(m);     return map;   }   private int[] ia(int n)   {     int[] a = new int[n];     for(int i = 0;i < n;i++)a[i] = i();     return a;   }   private int i()   {     int num = 0, b;     boolean minus = false;     while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));     if(b == '-'){       minus = true;       b = readByte();     }     while(true){       if(b >= '0' && b <= '9'){         num = num * 10 + (b - '0');       }else{         return minus ? -num : num;       }       b = readByte();     }   }   private long l()   {     long num = 0;     int b;     boolean minus = false;     while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));     if(b == '-'){       minus = true;       b = readByte();     }     while(true){       if(b >= '0' && b <= '9'){         num = num * 10 + (b - '0');       }else{         return minus ? -num : num;       }       b = readByte();     }   }   private boolean oj = System.getProperty("ONLINE_JUDGE") != null;   private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class A {  private static Scanner sc = new Scanner(new InputStreamReader(System.in));  public static void main (String[] args) throws IOException {   BitSet b = new BitSet(1001);   BitSet p = primes(1001);   for (int i = 0; i < ps.length - 1; i++) {    b.set(ps[i] + ps[i+1] + 1);   }   int n = sc.nextInt(), k = sc.nextInt();   for (int x = 0; x <= n; x++) {    if (b.get(x) && p.get(x)) k--;   }   System.out.println(k > 0 ? "NO" : "YES");  }  private static BitSet primes (int n) {   BitSet b = new BitSet(n+1);   b.set(2, n);   for (int p = 2; p <= n; p++) {    if (b.get(p)) {     for (int x = p * 2; x <= n; x += p) {      b.clear(x);     }    }   }   return b;  }   private static int [] ps = new int[] {2,     3,     5,     7,     11,     13,     17,     19,     23,     29,     31,     37,     41,     43,     47,     53,     59,     61,     67,     71,     73,     79,     83,     89,     97,     101,     103,     107,     109,     113,     127,     131,     137,     139,     149,     151,     157,     163,     167,     173,     179,     181,     191,     193,     197,     199,     211,     223,     227,     229,     233,     239,     241,     251,     257,     263,     269,     271,     277,     281,     283,     293,     307,     311,     313,     317,     331,     337,     347,     349,     353,     359,     367,     373,     379,     383,     389,     397,     401,     409,     419,     421,     431,     433,     439,     443,     449,     457,     461,     463,     467,     479,     487,     491,     499}; }
3	public class D {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);   int n = in.nextInt();  int[] a = new int[n];  for(int i = 0; i < n; ++i) {  a[i] = in.nextInt();  }  int ans = 0;  for(int i = 0; i < n; ++i) {  for(int j = i+1; j < n; ++j) {   if(a[i] > a[j]) ans++;  }  }   int m = in.nextInt();   for(int i = 0; i < m; ++i) {  int l = in.nextInt();  int r = in.nextInt();    int size = r-l + 1;    int x = size * size - size;  x = x >> 1;    ans = ans^x;  if(ans%2 == 0) System.out.println("even");  else System.out.println("odd");    } }   }
3	public class Problem911D {   public static void main(String args[]) throws IOException {     Scanner sc = new Scanner(System.in);     int n = sc.nextInt(), i, j;     int ar[] = new int[n];     int inv = 0;         for(i = 0; i < n; i++) {       ar[i] = sc.nextInt();     }         for(i = 0; i < n; i++) {       for(j = 0; j < n; j++) {         if(i > j && ar[i] < ar[j]) {           inv = (inv + 1) % 2;         }       }     }         int q = sc.nextInt();         for(i = 0; i < q; i++) {       int l = sc.nextInt();       int r = sc.nextInt();             int c = ( ((r-l)*(r-l+1))/2 ) % 2;       inv = (inv + c) % 2;             if(inv == 0)         System.out.println("even");       else         System.out.println("odd");     }   } }
0	public class A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  BigInteger l = sc.nextBigInteger();  BigInteger r = sc.nextBigInteger();  BigInteger a = l.add(BigInteger.ZERO);  while (a.compareTo(r) < 0) {  BigInteger b = a.add(BigInteger.ONE);  while (b.compareTo(r) < 0) {   try {   a.modInverse(b);   } catch (ArithmeticException e) {   b = b.add(BigInteger.ONE);   continue;   }   BigInteger c = b.add(BigInteger.ONE);   while (c.compareTo(r) <= 0) {   try {    b.modInverse(c);    try {    a.modInverse(c);    } catch (ArithmeticException e) {    System.out.printf("%s %s %s\n", a.toString(), b.toString(), c.toString());    return;    }   } catch (ArithmeticException e) {       }   c = c.add(BigInteger.ONE);   }   b = b.add(BigInteger.ONE);  }  a = a.add(BigInteger.ONE);  }  System.out.println("-1"); } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   atskb solver = new atskb();   solver.solve(1, in, out);   out.close();  }  static class atskb {   long s;   public void solve(int testNumber, InputReader in, PrintWriter out) {    long n = in.nextLong();    s = in.nextLong();    long ans = binarysearch(0, (long) Math.pow(10, 18) + 20 * 9);    if (ans > n) {     out.print(0);    } else {     out.print(n - ans + 1);    }   }   public long binarysearch(long l, long r) {    if (l == r) {     if (check(l))      return l;     return -1;    }    if (l - r == -1) {     if (check(l))      return l;     if (check(r)) {      return r;     }         }    long mid = l + (r - l) / 2;    if (check(mid))     return binarysearch(l, mid);    return binarysearch(mid + 1, r);   }   public boolean check(long m) {    String str = m + "";    long sum = 0;    for (int i = 0; i < str.length(); i++) {     sum += str.charAt(i) - '0';    }    if (sum + s <= m)     return true;    return false;   }  }  static class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar;   private int snumChars;   public InputReader(InputStream st) {    this.stream = st;   }   public int read() {    if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }   public long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
3	public class Main {  static int dx[] = {-1,1,0,0};  static int dy[] = {0,0,1,-1};  static long MOD = 1000000007;  static int INF = Integer.MAX_VALUE/10;  static PrintWriter pw;  static Reader scan;     static int ni() throws IOException{return scan.nextInt();}  static long nl() throws IOException{return scan.nextLong();}  static double nd() throws IOException{return scan.nextDouble();}  static void pl() throws IOException{pw.println();}  static void pl(Object o) throws IOException{pw.println(o);}  static void p(Object o) throws IOException {pw.print(o+" ");}  static void psb(StringBuilder sb) throws IOException {pw.print(sb);}  public static void main(String[] args){   new Thread(null,null,"BaZ",99999999)   {    public void run()    {     try     {      solve();     }     catch(Exception e)     {      e.printStackTrace();      System.exit(1);     }    }   }.start();  }  static void solve() throws IOException  {   Calendar CAL1 = Calendar.getInstance();   CAL1.setTime(new Date());   scan = new Reader();        pw = new PrintWriter(System.out,true);     StringBuilder sb = new StringBuilder();   int n = ni();   int inv = 0;   int arr[] = new int[n];   for(int i=0;i<n;++i)   {    arr[i] = ni();    for(int j=0;j<i;++j)     if(arr[j]>arr[i])      inv = 1-inv;   }   int q = ni();   while(q-->0)   {    int l = ni();    int r = ni();    int par = c2(r-l+1);    par&=1;    if(par!=0)     inv = 1-inv;    if(inv==0)     sb.append("even\n");    else sb.append("odd\n");   }   psb(sb);   Calendar CAL2 = Calendar.getInstance();   CAL2.setTime(new Date());   double Execution_Time = (double)(CAL2.getTimeInMillis()-CAL1.getTimeInMillis())/1000.000;     pw.flush();   pw.close();  }  static int c2(int n)  {   return (n*(n-1))>>1;  }  static class Reader {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;  public Reader() {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public Reader(String file_name) throws IOException {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }  public String readLine() throws IOException {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1) {    if (c == '\n') break;    buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }  public int nextInt() throws IOException {   int ret = 0;   byte c = read();   while (c <= ' ') c = read();   boolean neg = (c == '-');   if (neg) c = read();   do {    ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg) return -ret;   return ret;  }  public long nextLong() throws IOException {   long ret = 0;   byte c = read();   while (c <= ' ') c = read();   boolean neg = (c == '-');   if (neg) c = read();   do {    ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg) return -ret;   return ret;  }  public double nextDouble() throws IOException {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ') c = read();   boolean neg = (c == '-');   if (neg) c = read();   do {    ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);   if (neg) return -ret;   return ret;  }  private void fillBuffer() throws IOException {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1) buffer[0] = -1;  }  private byte read() throws IOException {   if (bufferPointer == bytesRead) fillBuffer();   return buffer[bufferPointer++];  }  public void close() throws IOException {   if (din == null) return;   din.close();  } }  static class MyFileReader            {   StringTokenizer st;   BufferedReader br;   MyFileReader() throws IOException   {    br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/input.txt"));   }   String nextLine() throws IOException   {    return br.readLine();   }   String next() throws IOException   {    if(st==null || !st.hasMoreTokens())     st = new StringTokenizer(nextLine());    return st.nextToken();   }   int nextInt() throws IOException   {    return Integer.parseInt(next());   }   long nextLong() throws IOException   {    return Long.parseLong(next());   }   double nextDouble() throws IOException   {    return Double.parseDouble(next());   }  }  static class MyFileReader1            {   StringTokenizer st;   BufferedReader br;   MyFileReader1() throws IOException   {    br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/output.txt"));   }   String nextLine() throws IOException   {    return br.readLine();   }   String next() throws IOException   {    if(st==null || !st.hasMoreTokens())     st = new StringTokenizer(nextLine());    return st.nextToken();   }   int nextInt() throws IOException   {    return Integer.parseInt(next());   }   long nextLong() throws IOException   {    return Long.parseLong(next());   }   double nextDouble() throws IOException   {    return Double.parseDouble(next());   }  } }
4	public class C {  static int ar[]; static HashMap<String, ArrayList<String>> map; static int location = 0; static StringBuilder sb; static int N;  public static void main(String[] args) throws NumberFormatException, IOException {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  int t = Integer.parseInt(br.readLine());   while(t --> 0) {    int n = Integer.parseInt(br.readLine());  ar = new int[n];  location = 0;  map = new HashMap<String, ArrayList<String>>();  sb = new StringBuilder();  N = n;      for(int i = 0; i < n; i++) {     ar[i] = Integer.parseInt(br.readLine());     }    int idx = 2;  location = 1;    sb.append("1\n");    while(location < n) {     if(ar[location] == 1) {      nl((idx-1)+".");      }else {      sb.append(idx+"\n");   idx++;   location++;      }     }    System.out.println(sb);    }   }  public static void nl(String l) {   int idx = 1;     while(location < N) {      if(idx == ar[location]) {     sb.append(l + idx + "\n");   idx++;   location++;     }else if(ar[location] == 1) {     nl(l + (idx-1) + ".");     }else {     return;     }    }   } }
1	public class CodeForces {  static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  void runCase(int caseNum) throws IOException {   int n = nextInt();   int k = nextInt();   int[] nums = new int[n];   int distinct = 0;   int L = -1, R = -1;   int minLen = Integer.MAX_VALUE;   int maxNum = 0;   for (int i = 0; i < n; ++i) {    nums[i] = nextInt();    maxNum = Math.max(maxNum, nums[i]);   }   int[] count = new int[maxNum + 1];   int j = 0;   for (int i = 0; i < n; ++i) {    ++count[nums[i]];    if (count[nums[i]] == 1) {     ++distinct;     if (distinct >= k) {      for (; j <= i; ++j) {       --count[nums[j]];       if (count[nums[j]] <= 0) {        --distinct;        if (distinct < k) {         if (i - j < minLen) {          minLen = i - j;          L = j + 1;          R = i + 1;         }         break;        }       }      }     }    }   }   out.print(L + " " + R);  }   public static void main(String[] args) throws IOException {   if (ONLINE_JUDGE){    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }else{    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   }   new CodeForces().runIt();   out.flush();   out.close();   return;  }  static BufferedReader in;  private StringTokenizer st;  static PrintWriter out;  String next() throws IOException {   while (!st.hasMoreTokens()) {    String line = in.readLine();    if (line == null) {     return null;    }    st = new StringTokenizer(line, " ");   }   return st.nextToken();  }  int nextInt() throws IOException {   return Integer.parseInt(next());  }  double nextDouble() throws IOException {   return Double.parseDouble(next());  }  long nextLong() throws IOException {   return Long.parseLong(next());  }   void runIt() throws IOException {   st = new StringTokenizer("");     runCase(0);   out.flush();  } }
3	public class CODE2{      private static InputStream stream;       private static byte[] buf = new byte[1024];       private static int curChar,MAX;       private static int numChars;       private static SpaceCharFilter filter;       private static PrintWriter pw;       private static long count = 0,mod=1000000007;       static int BIT[];       private static boolean primer[];      public final static int INF = (int) 1E9; public static void main(String args[]) {  InputReader(System.in);  pw = new PrintWriter(System.out);  new Thread(null ,new Runnable(){   public void run(){    try{     solve();         pw.close();    } catch(Exception e){     e.printStackTrace();    }   }  },"1",1<<26).start();  }  static StringBuilder sb;  public static void test(){   sb=new StringBuilder();   int t=nextInt();   while(t-->0){       solve();      }   pw.println(sb);  }  public static long pow(long n, long p,long mod) {   if(p==0)    return 1;   if(p==1)    return n%mod;   if(p%2==0){    long temp=pow(n, p/2,mod);   return (temp*temp)%mod;   }else{     long temp=pow(n,p/2,mod);     temp=(temp*temp)%mod;     return(temp*n)%mod;        }  }  public static long pow(long n, long p) {   if(p==0)    return 1;   if(p==1)    return n;   if(p%2==0){    long temp=pow(n, p/2);   return (temp*temp);   }else{     long temp=pow(n,p/2);     temp=(temp*temp);     return(temp*n);        }  }  public static void Merge(long a[],int p,int r){   if(p<r){    int q = (p+r)/2;    Merge(a,p,q);    Merge(a,q+1,r);    Merge_Array(a,p,q,r);   }  }  public static void Merge_Array(long a[],int p,int q,int r){   long b[] = new long[q-p+1];   long c[] = new long[r-q];   for(int i=0;i<b.length;i++)    b[i] = a[p+i];   for(int i=0;i<c.length;i++)    c[i] = a[q+i+1];   int i = 0,j = 0;   for(int k=p;k<=r;k++){    if(i==b.length){     a[k] = c[j];     j++;    }    else if(j==c.length){     a[k] = b[i];     i++;    }    else if(b[i]<c[j]){     a[k] = b[i];     i++;    }    else{     a[k] = c[j];     j++;    }   }  }    public static long gcd(long x, long y) {   if (x == 0)    return y;   else    return gcd( y % x,x);  }    public static boolean isPrime(int n) {   if (n <= 1)    return false;   if (n <= 3)    return true;    if (n % 2 == 0 || n % 3 == 0)    return false;    for (int i = 5; i * i <= n; i = i + 6)    if (n % i == 0 || n % (i + 2) == 0)     return false;    return true;  }    static LinkedList<Integer> adj[];   static boolean Visited[];   static HashSet<Integer> exc;   static long oddsum[]=new long[1000001];   static long co=0,ans=0;   static int parent[];   static int size[],color[],res[],k;   static ArrayList<Integer> al[];   static long MOD = (long)1e9 + 7;   private static void buildgraph(int n){    adj=new LinkedList[n+1];    Visited=new boolean[n+1];    levl=new int[n+1];       for(int i=0;i<=n;i++){     adj[i]=new LinkedList<Integer>();       }    }       static int[] levl;   static int[] eat;     static int price[];    static boolean check(char c)  {  if(c!='a' && c!='e' && c!='i' && c!='o' && c!='u' )   return true;  else   return false;  }   public static void solve(){         int n= nextInt();  int a[]=new int[n];  a=nextIntArray(n);     int invcount=0;  for(int i=0;i<n;i++)  {  for(int j=i+1;j<n;j++)  {   if(a[i]>a[j])   invcount++;  }  }     int m=nextInt();   int initial = invcount%2;  while(m--!=0)  {  int l=nextInt();  int r=nextInt();      int diff = r-l+1;  int totalpair = (diff*(diff-1))/2;    if(((totalpair%2)+initial)%2==1)  {   pw.println("odd");   initial=1;  }  else  {   pw.println("even");   initial=0;  }    }     }     static void seive2(int n)   {   primer=new boolean[n+1];   Arrays.fill(primer,true);   primer[0]=false;   primer[1]=false;   primer[2]=true;      for(int i=2;i*i<=n;i++)   {    if(primer[i])    {    for(int j=2*i;j<=n;j=j+i)    {     primer[j]=false;    }    }   }   }            static int BITsum(int x)    {   int sum=0;   while(x>0)   {    sum+=BIT[x];    x-= (x & -x);   }    return sum;    }    static boolean union(int x,int y)   {   int xr=find(x);   int yr=find(y);   if(xr==yr)    return false;   if(size[xr]<size[yr])   {    size[yr]+=size[xr];    parent[xr]=yr;   }   else   {    size[xr]+=size[yr];    parent[yr]=xr;       }   return true;      }   static int find(int x)   {   if(parent[x]==x)    return x;   else   {    parent[x]=find(parent[x]);    return parent[x];   }      }   public static class Edge implements Comparable<Edge>   {   int u, v,s;  public Edge(int u, int v)   {   this.u = u;   this.v = v;     }  public int hashCode()   {   return Objects.hash();  }  public int compareTo(Edge other)   {  return (Integer.compare(u, other.u) != 0 ? (Integer.compare(u, other.u)):(Integer.compare(v, other.v)));       }  public String toString()  {   return this.u + " " + this.v;  }   }     static int col[];  public static boolean isVowel(char c){   if(c=='a' || c=='e'||c=='i' || c=='o' || c=='u')    return true;   return false;  } static int no_vert=0;  private static void dfs(int start){  Visited[start]=true;  if(al[color[start]].size()>=k)  {  res[start]=al[color[start]].get(al[color[start]].size()-k);  }  al[color[start]].add(start);  for(int i:adj[start]){   if(!Visited[i])    {    dfs(i);    }  }  (al[color[start]]).remove(al[color[start]].size()-1);   }   public static String reverseString(String s) {   StringBuilder sb = new StringBuilder(s);   sb.reverse();   return (sb.toString());  }           static int indeg[];          static HashSet<Integer> hs;                 static boolean prime[];      static int spf[];      public static void sieve(int n){       prime=new boolean[n+1];       spf=new int[n+1];             Arrays.fill(spf, 1);       Arrays.fill(prime, true);      prime[1]=false;       spf[2]=2;            for(int i=4;i<=n;i+=2){       spf[i]=2;      }      for(int i=3;i<=n;i+=2){       if(prime[i]){        spf[i]=i;        for(int j=2*i;j<=n;j+=i){                 prime[j]=false;        if(spf[j]==1){         spf[j]=i;        }        }       }      }                  }                   public static void sort(long a[]){       Merge(a, 0, a.length-1);      }      public static void InputReader(InputStream stream1) {       stream = stream1;      }       private static boolean isWhitespace(int c) {       return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;      }       private static boolean isEndOfLine(int c) {       return c == '\n' || c == '\r' || c == -1;      }       private static int read() {       if (numChars == -1)        throw new InputMismatchException();       if (curChar >= numChars) {        curChar = 0;        try {         numChars = stream.read(buf);        } catch (IOException e) {         throw new InputMismatchException();        }        if (numChars <= 0)         return -1;       }       return buf[curChar++];      }       private static int nextInt() {       int c = read();       while (isSpaceChar(c))        c = read();       int sgn = 1;       if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do {   if (c < '0' || c > '9')    throw new InputMismatchException();   res *= 10;   res += c - '0';        c = read();       } while (!isSpaceChar(c));       return res * sgn;      }       private static long nextLong() {       int c = read();       while (isSpaceChar(c))        c = read();       int sgn = 1;       if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')    throw new InputMismatchException();   res *= 10;   res += c - '0';        c = read();       } while (!isSpaceChar(c));       return res * sgn;      }       private static String nextToken() {       int c = read();       while (isSpaceChar(c))        c = read();       StringBuilder res = new StringBuilder();       do {        res.appendCodePoint(c);        c = read();       } while (!isSpaceChar(c));       return res.toString();      }       private static String nextLine() {       int c = read();       while (isSpaceChar(c))        c = read();       StringBuilder res = new StringBuilder();       do {        res.appendCodePoint(c);        c = read();       } while (!isEndOfLine(c));       return res.toString();      }       private static int[] nextIntArray(int n) {       int[] arr = new int[n];       for (int i = 0; i < n; i++) {        arr[i] = nextInt();       }       return arr;      }       private static long[][] next2dArray(int n, int m) {       long[][] arr = new long[n][m];       for (int i = 0; i < n; i++) {        for (int j = 0; j < m; j++) {         arr[i][j] = nextLong();        }       }       return arr;      }      private static char[][] nextCharArray(int n,int m){       char [][]c=new char[n][m];       for(int i=0;i<n;i++){        String s=nextLine();        for(int j=0;j<s.length();j++){         c[i][j]=s.charAt(j);        }       }       return c;      }       private static long[] nextLongArray(int n) {       long[] arr = new long[n];       for (int i = 0; i < n; i++) {        arr[i] = nextLong();       }       return arr;      }       private static void pArray(int[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static void pArray(long[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static void pArray(boolean[] arr) {       for (int i = 0; i < arr.length; i++) {        pw.print(arr[i] + " ");       }       pw.println();       return;      }       private static boolean isSpaceChar(int c) {       if (filter != null)        return filter.isSpaceChar(c);       return isWhitespace(c);      }       private interface SpaceCharFilter {       public boolean isSpaceChar(int ch);      }       }
4	public class C {  static BufferedReader br;  static StringTokenizer st;  static PrintWriter pw;  static String nextToken() {   try {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(br.readLine());    }   } catch (IOException e) {    e.printStackTrace();   }   return st.nextToken();  }  static int nextInt() {   return Integer.parseInt(nextToken());  }  static long nextLong() {   return Long.parseLong(nextToken());  }  static double nextDouble() {   return Double.parseDouble(nextToken());  }  static String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    e.printStackTrace();   }   return null;  }  public static void main(String[] args) {   br = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);   solve();   pw.close();  }  private static void solve() {   int t = nextInt();   int[] stack = new int[1000000];   for (int i = 0; i < t; i++) {    int n = nextInt();    stack[0] = nextInt();    int id = 1;    pp(stack, id);    for (int j = 1; j < n; j++) {     int x = nextInt();     if (x == 1) {      stack[id++] = x;     } else {      while (true) {       int p = stack[--id];       if (p + 1 == x) {        stack[id++] = x;        break;       }      }     }     pp(stack, id);    }   }  }  private static void pp(int[] stack, int size) {   for (int i = 0; i < size - 1; i++) {    pw.print(stack[i] + ".");   }   pw.println(stack[size - 1]);  }  }
1	public class NewClass {  static Scanner in=new Scanner(System.in);  public static void main(String[] args) {   int n = in.nextInt(),ans=Integer.MAX_VALUE,t=0;   String x = in.next();   for (int i = 0; i < n; i++) {    if(x.charAt(i)=='-')t--;    else t++;    ans=Math.min(ans,t);   }    if(ans <= 0)     System.out.println(Math.abs(ans)+t);    else     System.out.println(t);  }  }
1	public class Main implements Runnable { BufferedReader in;  StringTokenizer st = new StringTokenizer("");  public static void main(String [] args) throws Exception {  new Thread(new Main()).start(); }  void printExit(String s) {  System.out.println(s);  System.exit(0); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  int n = nextInt();  int k = nextInt();  int max = 5000;  ArrayList <Integer> primes = new ArrayList <Integer> ();  boolean [] p = new boolean [max];  Arrays.fill(p, true);  for (int i = 2; i < max; i++) {   if (p[i]) {   primes.add(i);   for (int j = i * i; j < max; j += i)    p[j] = false;   }      }   HashSet <Integer> good = new HashSet <Integer> ();  for (int i = 0; i < primes.size() - 1; i++) {   good.add(primes.get(i) + primes.get(i + 1) + 1);  }   int have = 0, pos = 0;  while (true) {   int i = primes.get(pos);    if (i > n) break;   if (good.contains(i)) have++;   pos++;  }  System.out.println(have >= k ? "YES" : "NO");  }  catch (Exception e) {  e.printStackTrace();  } }  boolean seekForToken() {  try {  while (!st.hasMoreTokens()) {   String s = in.readLine();   if (s == null) {    return false;   }   st = new StringTokenizer(s);  }  return true;  }  catch (IOException e) {   e.printStackTrace();   return false;  }  }   int nextInt() {  return Integer.parseInt(nextToken());  }   long nextLong() {  return Long.parseLong(nextToken());  }   double nextDouble() {  return Double.parseDouble(nextToken());  }   BigInteger nextBigInteger() {   return new BigInteger(nextToken());  }   String nextToken() {   seekForToken();   return st.nextToken();  } }
3	public class Main implements Runnable { static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  public InputReader(InputStream stream)  {  this.stream = stream;  }   public int read()  {  if (numChars==-1)   throw new InputMismatchException();    if (curChar >= numChars)  {   curChar = 0;   try   {   numChars = stream.read(buf);   }   catch (IOException e)   {   throw new InputMismatchException();   }     if(numChars <= 0)     return -1;  }  return buf[curChar++];  }   public String nextLine()  {  String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }   public static void main(String args[]) throws Exception {  new Thread(null, new Main(),"Main",1<<26).start(); }   public void run() {  InputReader sc = new InputReader(System.in);  PrintWriter w = new PrintWriter(System.out);      int n = sc.nextInt();    int a[] = new int[n];    for(int i = 0; i < n; ++i)    a[i] = sc.nextInt();    int cnt = 0;    for(int i = 0; i < n; ++i) {    for(int j = 0; j < i; ++j) {    if(a[i] < a[j])     cnt ^= 1;    }   }    int m = sc.nextInt();    for(int i = 0; i < m; ++i) {    int l = sc.nextInt();    int r = sc.nextInt();    long size = (long)(r - l + 1);    long subarr = size * (size - 1) / 2;    int type = (int)(subarr % 2);    if(type == 1) {    cnt ^= 1;    }    if(cnt == 0)    w.println("even");    else    w.println("odd");   }   w.close();  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int[] ar = new int[n];    for (int i = 0; i < n; i++) {     ar[i] = in.nextInt();    }    long ninv = 0;    for (int i = 0; i < n - 1; i++) {     for (int j = i + 1; j < n; j++) {      if (ar[i] > ar[j])       ninv++;     }    }    int m = in.nextInt();    for (int i = 0; i < m; i++) {     int l = in.nextInt();     int r = in.nextInt();     int s = (r - l) * (r - l + 1) / 2;     ninv += s;     if (ninv % 2 == 0)      out.println("even");     else      out.println("odd");    }   }  }  static class InputReader {   StringTokenizer st;   BufferedReader br;   public InputReader(InputStream is) {    BufferedReader br = new BufferedReader(new InputStreamReader(is));    this.br = br;   }   public String next() {    if (st == null || !st.hasMoreTokens()) {     String nextLine = null;     try {      nextLine = br.readLine();     } catch (IOException e) {      throw new RuntimeException(e);     }     if (nextLine == null)      return null;     st = new StringTokenizer(nextLine);    }    return st.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   int[]b=a.clone();   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");     }  private boolean sorted(int[] a) {   for(int i=0;i+1<a.length;i++)    if(a[i]>a[i+1])     return false;   return true;  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;   writer=new PrintWriter(new PrintWriter(System.out));     solve();   reader.close();   writer.close();  }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
5	public class Solution { public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  Comp c1 = getComp(scanner);  Comp c2 = getComp(scanner);  c1.sortByPrice();  c2.sortByPrice();  int i = 0;  int j = 0;  while(i < c1.num || j < c2.num) {  Elem xi = (i < c1.num) ? c1.elems.get(i) : null;  Elem yj = (j < c2.num) ? c2.elems.get(j) : null;  if(xi != null && yj != null) {   if(xi.price >= yj.price) {   if(!c2.resultSet.contains(xi)) {    c1.resultSet.add(xi);   }   i++;   } else {   if(!c1.resultSet.contains(yj)) {    c2.resultSet.add(yj);   }   j++;   }  } else  if(xi != null) {   if(!c2.resultSet.contains(xi)) {   c1.resultSet.add(xi);   }   i++;  } else {   if(!c1.resultSet.contains(yj)) {   c2.resultSet.add(yj);   }   j++;  }    }   long result = c1.getResultPrice() + c2.getResultPrice();  System.out.println(result);  }   private static Comp getComp(Scanner scanner) {  Comp c = new Comp();  c.num = scanner.nextInt();  for(int i = 0; i < c.num; i++) {   c.addElem(scanner.nextLong(), scanner.nextLong());  }  return c;  } } class Comp { int num; List<Elem> elems = new ArrayList<>(); Set<Elem> resultSet = new HashSet<>();  void addElem(long el, long pr) {  Elem elem = new Elem(el, pr);  elems.add(elem); }  void sortByPrice() {  Collections.sort(elems); }  long getResultPrice() {  long sumPrice = 0;  for(Elem elem : resultSet) {  sumPrice += elem.price;  }   return sumPrice; } } class Elem implements Comparable<Elem> { long elem; long price;  public Elem(long el, long pr) {  this.elem = el;  this.price = pr; }  public int compareTo(Elem other) {  return (int) (other.price - price); }  public boolean equals(Object o) {  if(!(o instanceof Elem)) {  return false;  }   Elem other = (Elem) o;  return (other.elem == elem); }  public int hashCode() {  return (int) elem; }  public String toString() {  return "(" + elem + ", " + price + ")"; } }
3	public class Main {  final static int mod = 1_000_000_007;  public static void main(String[] args) throws Exception {  STDIN scan = new STDIN();  PrintWriter pw = new PrintWriter(System.out);   int n = scan.nextInt();  boolean even = true;  int[] a = new int[n];  for(int i = 0; i < n; i++) {  a[i] = scan.nextInt();  for(int j = 0; j < i; j++)   if(a[i] < a[j]) even = !even;  }  int q = scan.nextInt();  while(q-- > 0) {  int l = scan.nextInt(), r = scan.nextInt();  int len = r - l + 1;  int permutations = len * (len - 1) / 2;  if(permutations % 2 != 0) even = !even;  pw.println(even ? "even" : "odd");  }   pw.flush(); }   static class STDIN {  BufferedReader br;  StringTokenizer st;  public STDIN() {  br = new BufferedReader(new InputStreamReader(System.in));  st = null;  }  boolean hasNext() throws Exception {  if (!st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.hasMoreTokens();  }  int nextInt() throws Exception {  return Integer.parseInt(next());  }  long nextLong() throws Exception {  return Long.parseLong(next());  }  double nextDouble() throws Exception {  return Double.parseDouble(next());  }  String next() throws Exception {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  String nextLine() throws Exception {  return br.readLine();  } } }
2	public class ReallyBigNumbers {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();   long m = s;   while(m-digitAdd(m)<s && m<=n){  m++;  }  System.out.println(Math.max(n-m+1, 0)); }  private static int digitAdd(long s){  int sum = 0;   for(long i = 0,j=1L;i<(int)Math.log10(s)+1; i++,j*=10){  sum += (s/j)%10;  }   return sum; } }
3	public class D {  public static class BIT {  int[] dat;   public BIT(int n){  dat = new int[n + 1];  }   public void add(int k, int a){   for(int i = k + 1; i < dat.length; i += i & -i){   dat[i] += a;   }  }   public int sum(int s, int t){   if(s > 0) return sum(0, t) - sum(0, s);    int ret = 0;  for(int i = t; i > 0; i -= i & -i) {   ret += dat[i];  }  return ret;  } }  public static void main(String[] args) {  try (final Scanner sc = new Scanner(System.in)) {  final int N = sc.nextInt();  int[] array = new int[N];  for(int i = 0; i < N; i++){   array[i] = sc.nextInt() - 1;  }    long inv = 0;  BIT bit = new BIT(N);  for(int i = 0; i < N; i++){   inv += bit.sum(array[i], N);   bit.add(array[i], 1);  }      int mod2 = (int)(inv % 2);  final int M = sc.nextInt();  for(int i = 0; i < M; i++){   final int l = sc.nextInt() - 1;   final int r = sc.nextInt() - 1;     final long size = (r - l) + 1;   if(size > 1){      if((size * (size - 1) / 2) % 2 == 1){    mod2 = 1 - mod2;   }   }     System.out.println((mod2 == 0) ? "even" : "odd");  }  } }  public static class Scanner implements Closeable {  private BufferedReader br;  private StringTokenizer tok;  public Scanner(InputStream is) {  br = new BufferedReader(new InputStreamReader(is));  }  private void getLine() {  try {   while (!hasNext()) {   tok = new StringTokenizer(br.readLine());   }  } catch (IOException e) {   }  }  private boolean hasNext() {  return tok != null && tok.hasMoreTokens();  }  public String next() {  getLine();  return tok.nextToken();  }  public int nextInt() {  return Integer.parseInt(next());  }   public long nextLong() {  return Long.parseLong(next());  }  public void close() {  try {   br.close();  } catch (IOException e) {   }  } } }
6	public class Main {   static final int MAXN = 24;  int[] x = new int[MAXN];  int[] y = new int[MAXN];  int[][] dist = new int[MAXN][MAXN];  int[] single = new int[MAXN];   int sqr(int x) { return x * x; }   void run(int nT) {   int xs = cin.nextInt();   int ys = cin.nextInt();   int n = cin.nextInt();   for (int i = 0; i < n; ++i) {    x[i] = cin.nextInt();    y[i] = cin.nextInt();   }   for (int i = 0; i < n; ++i) {    for (int j = i + 1; j < n; ++j) {     dist[i][j] = sqr(x[i] - xs) + sqr(y[i] - ys)      + sqr(x[i] - x[j]) + sqr(y[i] - y[j]) + sqr(x[j] - xs) + sqr(y[j] - ys);    }   }   for (int i = 0; i < n; ++i) {    single[i] = (sqr(x[i] - xs) + sqr(y[i] - ys)) * 2;   }   int[] dp = new int[1 << n];   int[] pre = new int[1 << n];   int tot = 1 << n;   for (int s = 1; s < tot; ++s) {    int i;    for (i = 0; i < n; ++i) {     if ((s & (1 << i)) != 0) break;    }    dp[s] = dp[s^(1<<i)] + single[i];    pre[s] = i + 1;    for (int j = i + 1; j < n; ++j) {     if ((s & (1 << j)) != 0) {      int cur = dp[s^(1 << i) ^(1<<j)] + dist[i][j];      if (cur < dp[s]) {       dp[s] = cur;       pre[s] = (i + 1) * 100 + (j + 1);      }     }    }   }   out.println(dp[tot - 1]);   int now = tot - 1;   out.print("0");   while (now > 0) {    int what = pre[now];    int px = what % 100 - 1;    int py = what / 100 - 1;    if (px >= 0) {     out.print(" ");     out.print(px + 1);     now ^= 1 << px;    }    if (py >= 0) {     out.print(" ");     out.print(py + 1);     now ^= 1 << py;    }    out.print(" ");    out.print("0");   }   out.println("");  }  public static void main(String[] argv) {   Main solved = new Main();   int T = 1;     for (int nT = 1; nT <= T; ++nT) {    solved.run(nT);   }   solved.out.close();  }  InputReader cin = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out); } class InputReader {  BufferedReader reader;  StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream));   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  } }
3	public class DD { public static void main(String[] args)throws Throwable {  MyScanner sc=new MyScanner();  PrintWriter pw=new PrintWriter(System.out);   int n=sc.nextInt();  int [] a=new int [n];  for(int i=0;i<n;i++)  a[i]=sc.nextInt();  int c=0;  for(int i=0;i<n;i++)  for(int j=i+1;j<n;j++)   if(a[i]>a[j])   c^=1;  int m=sc.nextInt();  while(m-->0){  int l=sc.nextInt()-1;  int r=sc.nextInt()-1;  int d=r-l+1;  d=d*(d-1)/2;  c^=(d%2);  pw.println(c==0? "even" : "odd");  }   pw.flush();  pw.close(); }  static class MyScanner {  BufferedReader br;  StringTokenizer st;  public MyScanner() {  br = new BufferedReader(new InputStreamReader(System.in));  }  String next() {while (st == null || !st.hasMoreElements()) {  try {st = new StringTokenizer(br.readLine());}  catch (IOException e) {e.printStackTrace();}}  return st.nextToken();}  int nextInt() {return Integer.parseInt(next());}  long nextLong() {return Long.parseLong(next());}  double nextDouble() {return Double.parseDouble(next());}  String nextLine(){String str = "";  try {str = br.readLine();}  catch (IOException e) {e.printStackTrace();}  return str;} } }
3	public class inversions {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int N = sc.nextInt();   int[] values = new int[N];   for(int i=0;i<N;i++){    values[i] = sc.nextInt();   }   int query = sc.nextInt();   int[][] tasks = new int[query][2];   for(int i=0;i<query;i++){    tasks[i][0] = sc.nextInt();    tasks[i][1] = sc.nextInt();   }   int startinversions = 0;   for(int i=1;i<values.length;i++){    for(int j=i-1;j>=0;j--){     if(values[i]<values[j]){      startinversions++;     }    }   }   int value = startinversions%2;   for(int[] task : tasks){    int n = task[1]-task[0];    if(n*(n+1)/2 % 2 != 0){     value = (value+1)%2;    }    if(value==1){     System.out.println("odd");    }    else{     System.out.println("even");    }   }  } }
2	public class Solution {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long s = scanner.nextLong();   long myLong = s;   long count =0;  while(true){   if(myLong>n){   break;   }   char[] num = (""+myLong).toCharArray();  int sum = 0;  for (int j = 0; j < num.length; j++)   sum += num[j] - '0';     if(myLong- sum>=s){      break;   }     myLong++;  }  System.out.println(Math.max(n-myLong+1,0));   scanner.close();  } }
1	public class Main {  static StringTokenizer st;  static PrintWriter out = new PrintWriter(System.out,true);  static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  public static int nextInt() throws Exception {   if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());   return Integer.parseInt(st.nextToken());  }  public static long nextLong() throws Exception {   if(st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());   return Long.parseLong(st.nextToken());  }  public static void main(String[] args) throws Exception {   HashSet<Integer> set = new HashSet<>();   int n = nextInt();   int k = nextInt();   int[] m = new int[n];   int[] d = new int[n];   for(int i = 0;i < n;i++) m[i] = nextInt();   int l = -1;   int r = -1;   for(int i = 0;i < n;i++) {    set.add(m[i]);    d[i] = set.size();    if(d[i] == k) {     r = i;     break;    }   }   if(r == -1) {    out.println("-1 -1");    return;   }   for(int i = r;i >= 0;i--) {    set.remove(m[i]);    if(set.size() == 0) {     l = i;     break;    }   }   out.println((l+1)+" "+(r+1));  } }
0	public class Counterexample {  public static void main(String[] args) {   System.out.println(new Counterexample().solve());  }  String solve() {   Scanner sc = new Scanner(System.in);   final long l = sc.nextLong();   final long r = sc.nextLong();   if ((r - l) > 1) {    long a = l;    long b = l + 1;    long c = l + 2;    while (a < (r - 1)) {     while (b < r) {      while (c <= r) {       if (gcd(a,b) == 1         && gcd(b,c) == 1         && gcd(a,c) > 1) {        return Long.toString(a)         + " "         + Long.toString(b)         + " "         + Long.toString(c);         }       c += 1;      }      c = b + 1;      b += 1;     }     b = a + 1;     a += 1;    }   }   return "-1";  }  long gcd(long a, long b) {   while (b != 0) {    long t = b;    b = a % b;    a = t;   }   return a;  } }
6	public class LookingOrder {  public static void main(String[] args) throws IOException{   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));   String[] line=in.readLine().split("\\s+");   int xs= Integer.parseInt(line[0]);   int ys= Integer.parseInt(line[1]);   int n=Integer.parseInt(in.readLine());   int []x=new int[n];   int []y=new int[n];   for(int i=0;i<n;++i){    line=in.readLine().split("\\s+");    x[i]= Integer.parseInt(line[0]);    y[i]= Integer.parseInt(line[1]);   }   int maxBitmap=1<<n;   long[] dis=new long[maxBitmap];   int[] last=new int[maxBitmap];   dis[0]=0;   int ci=0;   int[][] dismap=new int[n][n];     for(int i=0;i<n;++i){    for(int j=0;j<=i;++j){     int delx,dely;     if(i==j){      delx=x[i]-xs;      dely=y[i]-ys;     }else{      delx=x[i]-x[j];      dely=y[i]-y[j];     }     dismap[i][j]=delx*delx+dely*dely;    }   }     for(int i=1;i<maxBitmap;++i){    if((i&(1<<ci))==0)     ++ci;    int i2=i-(1<<ci);       long min=dis[i2]+2*dismap[ci][ci];    last[i]=ci;    for(int j=0;j<ci;++j){     if((i&(1<<j))!=0){      long m=dis[i2-(1<<j)]+dismap[ci][ci]+dismap[j][j]+dismap[ci][j];      if(m<min){       min=m;       last[i]=j;      }     }    }    dis[i]=min;   }     out.write(""+dis[maxBitmap-1]);   out.newLine();   out.write("0");     int bmap=maxBitmap-1;   ci=n-1;   while(bmap!=0){    while((bmap&(1<<ci))==0&&ci>=0)--ci;    int ci2=last[bmap];    if(ci2!=ci){     out.write(" "+(ci+1)+" "+(ci2+1)+ " 0");     bmap-=(1<<ci)+(1<<ci2);    }else{     out.write(" "+(ci+1)+" 0");     bmap-=1<<ci;    }   }   out.close();  } }
0	public class Main { static boolean LOCAL = System.getSecurityManager() == null; Scanner sc = new Scanner(System.in);  void run() {  double a = sc.nextDouble(), v = sc.nextDouble();  double L = sc.nextDouble(), d = sc.nextDouble(), w = sc.nextDouble();  w = min(w, v);  double t = 0;  if (w * w / (2 * a) <= d) {  if ((v * v + 2 * v * (v - w) - (v - w) * (v - w)) / (2 * a) <= d) {   t = (2 * v - w) / a + (d - (v * v + 2 * v * (v - w) - (v - w) * (v - w)) / (2 * a)) / v;  } else {   double A = a, B = w, C = (w * w) / (2 * a) - d;   t = w / a + (-B + sqrt(max(0, B * B - A * C))) / A * 2;  }  if ((2 * w * (v - w) + (v - w) * (v - w)) / (2 * a) <= L - d) {   t += (v - w) / a + (L - d - (2 * w * (v - w) + (v - w) * (v - w)) / (2 * a)) / v;  } else {   double A = a, B = w, C = -2 * (L - d);   t += (-B + sqrt(max(0, B * B - A * C))) / A;  }  } else if (v * v / (2 * a) <= L) {  t = v / a + (L - (v * v / (2 * a))) / v;  } else {  t = sqrt(2 * L / a);  }  System.out.printf("%.10f%n", t); }  class Scanner {  BufferedReader br;  StringTokenizer st;  Scanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(in));  eat("");  }  void eat(String s) {  st = new StringTokenizer(s);  }  String nextLine() {  try {   return br.readLine();  } catch (IOException e) {   throw new RuntimeException(e);  }  }  boolean hasNext() {  while (!st.hasMoreTokens()) {   String s = nextLine();   if (s == null) return false;   eat(s);  }  return true;  }  String next() {  hasNext();  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  } }  void debug(Object...os) {  System.err.println(deepToString(os)); }  public static void main(String[] args) {  if (LOCAL) {  try {   System.setIn(new FileInputStream("in.txt"));  } catch (Throwable e) {   LOCAL = false;  }  }  if (!LOCAL) {  try {   Locale.setDefault(Locale.US);   System.setOut(new PrintStream(new BufferedOutputStream(System.out)));  } catch (Throwable e) {  }  }  new Main().run();  System.out.flush(); } }
1	public class A {  public static void main(String[] args) throws Exception {  boolean submit = true;   Scanner sc = submit ? new Scanner(System.in) : new Scanner(new File("A.in"));  while(sc.hasNext()) {  int n = sc.nextInt(), k = sc.nextInt();  boolean p[] = sieveOfEratosthenes(1001);  ArrayList<Integer> nolds = new ArrayList<Integer>();     for(int i = 0, prev = 0; i < p.length; i++) {   if(p[i]) {   nolds.add(prev+i + 1);   prev = i;   }     }        int c = 0;  for(int i : nolds)   if(i >= 2 && i <= n && p[i])   c++;    System.out.println(c >= k ? "YES" : "NO");    }          }    static boolean[] sieveOfEratosthenes(int n) {   boolean prime[] = new boolean[n+1];   fill(prime, 2, n, true);   for(int i = 2; i <= n; i++)    if(prime[i])     for(int j = i*i; j <= n; j+=i)      prime[j] = false;   return prime;  } }
2	public class ed817Q3 { public static void main(String[] args){  InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int t = 1;  for(int zxz=0;zxz<t;zxz++){    long n = in.nextLong();  long s = in.nextLong();  long start=0,end=n;  long ans=n+1;  while(start<=end){   long mid = start+(end-start)/2;   if(mid-digitSum(mid)>=s){   ans = mid;   end = mid-1;   }   else{   start=mid+1;   }  }  System.out.println(n-ans+1);    } } static int digitSum(long n){  int sum=0;  while(n>0){  sum+=n%10;  n=n/10;  }  return sum; } static class InputReader {     private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream) {    this.stream = stream;   }    public int snext() {    if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars) {     curChar = 0;     try {      snumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }    public int nextInt() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    int res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public long nextLong() {    int c = snext();    while (isSpaceChar(c))     c = snext();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = snext();    }    long res = 0;    do {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public int[] nextIntArray(int n) {    int a[] = new int[n];    for (int i = 0; i < n; i++)     a[i] = nextInt();    return a;   }    public String readString() {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public boolean isSpaceChar(int c) {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  } }
5	public class Main {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);     int n = s.nextInt();   int m = s.nextInt();   int k = s.nextInt();     int a[] = new int [n];   for (int i = 0; i < a.length; i++) {    a[i] = s.nextInt();   }   int ans = 0;     while(k < m){    k--;    int max = -1;    int ix = -1;    for (int i = 0; i < a.length; i++) {     if(a[i] > max){      max = a[i];      ix = i;     }    }    if(ix == -1){     System.out.println("-1");     return ;    }    k += a[ix];    a[ix] = -1;    ans++;   }   System.out.println(ans);  } }
1	public class Main {  public static void main(String[] args) throws Exception {     in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);     int n = nextInt(), k = nextInt();   int[] primes = new int[n + 1];   for (int i = 2; i <= n; i++) {    if (primes[i] == 0) {     primes[i] = 1;     for (int j = i * 2; j <= n; j += i)      primes[j] = 2;    }   }   ArrayList<Integer> res = new ArrayList<Integer>();   HashSet<Integer> p = new HashSet<Integer>(), v = new HashSet<Integer>();   for (int i = 2; i <= n; i++) {    if (primes[i] == 1) {     res.add(i);     p.add(i);    }   }   int c = 0;   if (res.size() >= 3) {    for (int i = 2; i < res.size(); i++) {     int zz = res.get(i - 2) + res.get(i - 1) + 1;     if (p.contains(zz))      v.add(zz);    }    c = v.size();   }   if (c >= k) {    out.println("YES");   } else {    out.println("NO");   }   in.close();   out.close();  }  static BufferedReader in;  static PrintWriter out;  static StringTokenizer st;  static String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextString());  }  static double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  } }
6	public class c8 {  static int n;  static int[] ds;  static int[][] g; public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int x = input.nextInt(), y = input.nextInt();  n = input.nextInt();  int[] xs = new int[n], ys = new int[n];  for(int i = 0; i<n; i++)  {   xs[i] = input.nextInt();   ys[i] = input.nextInt();  }  ds = new int[n];  g = new int[n][n];  for(int i = 0; i<n; i++)  {   ds[i] = (x - xs[i]) * (x - xs[i]) + (y - ys[i]) * (y - ys[i]);   for(int j = 0; j<n; j++)   {    g[i][j] = (xs[i] - xs[j]) * (xs[i] - xs[j]) + (ys[i] - ys[j]) * (ys[i] - ys[j]);   }  }  int[] dp = new int[1<<n];  Arrays.fill(dp, 987654321);  dp[0] = 0;  for(int i = 0; i<(1<<n); i++)  {   if(dp[i] == 987654321) continue;   for(int a = 0; a<n; a++)   {    if((i & (1<<a)) > 0) continue;    dp[i | (1<<a)] = Math.min(dp[i | (1<<a)], dp[i] + 2*ds[a]);    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) > 0) continue;     dp[i | (1<<a) | (1<<b)] = Math.min(dp[i | (1<<a) | (1<<b)], dp[i] + ds[a] + ds[b] + g[a][b]);    }    break;   }  }  Stack<Integer> stk = new Stack<Integer>();  stk.add(0);  int i = (1<<n) - 1;    trace:  while(i > 0)  {     for(int a = 0; a<n; a++)   {    if((i & (1<<a)) == 0) continue;    if( dp[i] == dp[i - (1<<a)] + 2*ds[a])    {     stk.add(a+1);     stk.add(0);     i -= (1<<a);     continue trace;    }    for(int b = a+1; b<n; b++)    {     if((i & (1<<b)) == 0) continue;     if(dp[i] == dp[i - (1<<a) - (1<<b)] + ds[a] + ds[b] + g[a][b])     {      stk.add(a+1);      stk.add(b+1);      stk.add(0);      i -= (1<<a) + (1<<b);      continue trace;     }    }      }  }  System.out.println(dp[(1<<n) - 1]);  while(!stk.isEmpty()) System.out.print(stk.pop()+" "); } }
6	public class Solution {   static StringTokenizer st; static BufferedReader reader; public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  int xs = NextInt();  int ys = NextInt();  int n = NextInt();   int x[] = new int[n];  int y[] = new int[n];  int single[] = new int[n];  int pair[][] = new int[n][n];  for (int i = 0; i < n; ++i) {  x[i] = NextInt();  y[i] = NextInt();  }  for (int i = 0; i < n; ++i)   single[i] = 2 * dist(xs, ys, x[i], y[i]);  for (int i = 0; i < n; ++i)  for (int j = 0; j < n; ++j)   pair[i][j] = dist(xs, ys, x[i], y[i]) +     dist(x[i], y[i], x[j], y[j]) +     dist(x[j], y[j], xs, ys);  int dp[] = new int[1 << n];  int prev[] = new int[1 << n];  for (int mask = 0; mask < (1 << n); ++mask) {  int p = -1;  for (int i = 0; i < n; ++i)   if (((mask >> i) & 1) != 0) {   p = i;   break;   }  if (p == -1) continue;  dp[mask] = dp[mask ^ (1 << p)] + single[p];  prev[mask] = p;  for (int j = p + 1; j < n; ++j) {   if (((mask >> j) & 1) != 0) {   int res = pair[p][j] + dp[mask ^ (1 << p) ^ (1 << j)];   if (res < dp[mask]) {    dp[mask] = res;    prev[mask] = p + 100 * j;   }   }  }  }  int cur = (1 << n) - 1;  System.out.printf("%d\n0 ", dp[cur]);  while(cur != 0) {  if (prev[cur] < 100) {   System.out.printf("%d %d ", prev[cur] + 1, 0);   cur ^= (1 << prev[cur]);  } else {   int i = prev[cur] / 100;   int j = prev[cur] % 100;   System.out.printf("%d %d %d ", i + 1, j + 1, 0);   cur = cur ^ (1 << i) ^ (1 << j);  }  } } static int dist(int x0, int y0, int x1, int y1) {  return (x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1);  } static int NextInt() throws NumberFormatException, IOException {  return Integer.parseInt(NextToken()); } static String NextToken() throws IOException {  while(st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(reader.readLine());  }  return st.nextToken(); } }
6	public class Problem_8C { private static int dis(int x1, int y1, int x2, int y2) {  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); }  public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int ox = sc.nextInt();  int oy = sc.nextInt();  int n = sc.nextInt();  int[] ix = new int[n];  int[] iy = new int[n];  int[] single = new int[n];  int[][] pair = new int[n][n];  for (int i = 0; i < n; i++) {  ix[i] = sc.nextInt();  iy[i] = sc.nextInt();  single[i] = dis(ox, oy, ix[i], iy[i]) * 2;  for (int j = 0; j < i; j++) {   pair[i][j] = pair[j][i] = dis(ix[i], iy[i], ix[j], iy[j]) + (single[i] + single[j]) / 2;  }  }  int[] min = new int[1 << n];  int[] pre = new int[1 << n];  for (int set = 1; set < 1 << n; set++) {  int i;  for (i = 0; i < n; i++) {   if ((set & (1 << i)) != 0) {   break;   }  }  min[set] = min[set ^ (1 << i)] + single[i];  pre[set] = set ^ (1 << i);  for (int j = 0; j < n; j++) {   if ((set & (1 << j)) == 0) {   continue;   }   if (min[set] > min[set ^ (1 << i) ^ (1 << j)] + pair[i][j]) {   min[set] = min[set ^ (1 << i) ^ (1 << j)] + pair[i][j];   pre[set] = set ^ (1 << i) ^ (1 << j);   }  }  }  System.out.println(min[(1 << n) - 1]);  for (int set = (1 << n) - 1; set != 0; set = pre[set]) {  System.out.print("0 ");  for (int i = 0; i < n; i++) {   if (((set ^ pre[set]) & (1 << i)) != 0) {   System.out.print((i + 1) + " ");   }  }  }  System.out.println("0");  sc.close(); } }
5	public class A {  static class Scanner{  BufferedReader br=null;  StringTokenizer tk=null;  public Scanner(){  br=new BufferedReader(new InputStreamReader(System.in));  }  public String next() throws IOException{  while(tk==null || !tk.hasMoreTokens())   tk=new StringTokenizer(br.readLine());  return tk.nextToken();  }  public int nextInt() throws NumberFormatException, IOException{  return Integer.valueOf(next());  }  public double nextDouble() throws NumberFormatException, IOException{  return Double.valueOf(next());  } }  public static void main(String args[]) throws NumberFormatException, IOException{  Scanner sc=new Scanner();  int N=sc.nextInt();  int M=sc.nextInt();  int K=sc.nextInt();  int[] array=new int[N];  for(int i=0;i<N;i++)  array[i]=sc.nextInt();  Arrays.sort(array);  int val=K;  int index=N - 1;  while(index>=0 && val<M){  val--;  val+=array[index];  index--;  }  if (val<M)  System.out.println("-1");  else  System.out.println((N - 1) - index); } }
4	public class C{  private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  private static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));  public static void main (String[] args) throws IOException {   int t = Integer.parseInt(br.readLine());   while(t-- > 0) {    int n = Integer.parseInt(br.readLine());    int prev = 1;    ArrayList<Integer> nums = new ArrayList<>();    nums.add(1);    String till = "1";    for(int i=0;i<n;i++) {     int ln = Integer.parseInt(br.readLine());     if(i == 0) {      bw.write("1\n");      continue;     }     if(ln == 1) {      nums.add(1);     }else if(ln == prev + 1) {      nums.set(nums.size()-1, ln);     }else {      int idx = -1;      for(int j=nums.size()-1;j>=0;j--) {       if(nums.get(j) == ln-1) {        idx = j;        break;       }      }      ArrayList<Integer> temp = new ArrayList<>();      for(int j=0;j<idx;j++) {       temp.add(nums.get(j));      }      temp.add(ln);      nums.clear();      nums = temp;     }     for(int j=0;j<nums.size()-1;j++) {      bw.write(nums.get(j) + ".");     }     bw.write(nums.get(nums.size()-1) + "\n");     prev = ln;    }      }   bw.flush();  } }
2	public class ReallyBigNumbers1 {   public static void main(String[] args)  {   Scanner sc = new Scanner(System.in);   long n = sc.nextLong();   long s = sc.nextLong();     int r = 0 ;     long l = 0L ;   long u = n ;     if( (l-sumDigits(l)< s ) && (u-sumDigits(u)< s ) )   {    System.out.println(0);    return ;   }     long specified = 0L ;   while( true )   {    long m = (l + u) / 2L ;       if( ( m - sumDigits(m) ) >= s && ( (m-1) - sumDigits(m-1) ) < s )    {     specified = m ;     break ;    }       if( l > u )     break ;       else    {     if( ( m - sumDigits(m) ) >= s )      u = m-1 ;     else      l = m+1 ;    }   }     System.out.println( n-specified+1 );       }   public static int sumDigits(long n)  {   char [] a = (n+"").toCharArray();   int sum = 0 ;   for(int k = 0 ; k < a.length ; k++)   {    sum += Integer.parseInt(a[k]+"") ;   }   return sum ;  }  }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, InputReader in, OutputWriter out) {    int n = in.readInt();    int[] a = IOUtils.readIntArray(in, n);    MiscUtils.decreaseByOne(a);    int m = in.readInt();    int parity = inversions(a) % 2;    boolean[] lengthToParityFlip = new boolean[n + 1];    for (int length = 1; length < lengthToParityFlip.length; length++) {     lengthToParityFlip[length] = (((length * (length - 1) / 2) % 2) == 1);    }    for (int query = 0; query < m; query++) {     int l = in.readInt() - 1, r = in.readInt() - 1;     int length = r - l + 1;     if (lengthToParityFlip[length]) {      parity ^= 1;     }     out.printLine(parity == 0 ? "even" : "odd");    }   }   private int inversions(int[] a) {    int res = 0;    for (int j = 0; j < a.length; j++) {     for (int i = j + 1; i < a.length; i++) {      if (a[i] < a[j]) {       res++;      }     }    }    return res;   }  }  static class InputReader {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private InputReader.SpaceCharFilter filter;   public InputReader(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int readInt() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    int res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class OutputWriter {   private final PrintWriter writer;   public OutputWriter(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public OutputWriter(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void print(Object... objects) {    for (int i = 0; i < objects.length; i++) {     if (i != 0) {      writer.print(' ');     }     writer.print(objects[i]);    }   }   public void printLine(Object... objects) {    print(objects);    writer.println();   }   public void close() {    writer.close();   }  }  static class MiscUtils {   public static void decreaseByOne(int[]... arrays) {    for (int[] array : arrays) {     for (int i = 0; i < array.length; i++) {      array[i]--;     }    }   }  }  static class IOUtils {   public static int[] readIntArray(InputReader in, int size) {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = in.readInt();    }    return array;   }  } }
1	public class Main {  static final long MOD = 1000000007L;   public static void main(String[] args) throws Exception {   Scanner scan = new Scanner(System.in);   int n = scan.nextInt();   int k = scan.nextInt();   int res = -1;   int[] arr = new int[n];   for (int i = 0; i < arr.length; i++) {    arr[i] = scan.nextInt();   }   BitSet bits = new BitSet();   int count = 0;   int end = -1;   for (int i = 0; i < arr.length; i++) {    if (!bits.get(arr[i])) {     bits.set(arr[i]);     count++;     if (count == k) {      end = i;      break;     }    }   }   if (end == -1) {    System.out.print("-1 -1");    return;   }   bits = new BitSet();   count = 0;   int start = end;   while (start >= 0) {    if (!bits.get(arr[start])) {     bits.set(arr[start]);     count++;     if (count == k) {      break;     }    }    start--;   }   System.out.println((start + 1) + " " + (end + 1));  } }
0	public class Main{ static final double eps = 1e-10; public static void main(String []args){  Scanner cin = new Scanner(System.in);  double a,v;  double l,d,w;  double time;   a = cin.nextDouble();  v = cin.nextDouble();   l = cin.nextDouble();  d = cin.nextDouble();  w = cin.nextDouble();   if(v < w + eps)  {  double t1 = v / a;  double len_bond = (v * v) / (2 * a);  if(len_bond + eps > l)  {   time = Math.sqrt(2 * l / a);  }  else  {   double t2 = (l - len_bond) / v;   time = t1 + t2;  }  System.out.println(time);  }  else  {  double len_bondv = (v * v) / (2 * a);  double len_bondw = (w * w) / (2 * a);  if(len_bondw + eps > d)  {   if(len_bondv + eps > l)   time = Math.sqrt(2 * l / a);   else{   double t1 = v / a;   double t2 = (l - len_bondv) / v;   time = t1 + t2;   }  }  else  {   double len_bonds = (v * v - w * w) / (2 * a);     if(len_bondv + len_bonds < d + eps)   time = v / a + (d - len_bondv - len_bonds) / v + (v - w) / a;   else   {   double f = Math.sqrt(d * a + w * w / 2);   time = f / a + (f - w) / a;   }   if (len_bonds + eps > l - d) {   double lv = Math.sqrt((l - d) * 2 * a + w * w);   time += (lv - w) / a;   } else {   time += (v - w) / a + (l - d - len_bonds) / v;   }  }    System.out.println(time);  } } }
0	public class A { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  long l = sc.nextLong(), r = sc.nextLong();  if (l % 2 == 0 && r - l >= 2) {  System.out.println(l + " " + (l + 1) + " " + (l + 2));  } else if (l % 2 == 1 && r - l >= 3) {  System.out.println(l + 1 + " " + (l + 2) + " " + (l + 3));  } else {  System.out.println(-1);  } } }
1	public class BOOL {  static char [][]ch;  static int n,m; private static FastReader in =new FastReader();  public static void main(String[] args) {  int n=in.nextInt();  int a[]=new int[1000002];  int dp[]=new int[1000002],ans=0;  for(int i=0;i<n;i++){a[in.nextInt()]=in.nextInt();}  dp[0]=a[0]==0?0:1;  for(int i=1;i<1000002;i++){  if(a[i]==0){dp[i]=dp[i-1];}  else{  if(a[i]>=i){dp[i]=1;}  else{  dp[i]=dp[i-a[i]-1]+1;  }}  if(dp[i]>=ans)ans=dp[i];  }   System.out.println(n-ans);  }} class FastReader  {   BufferedReader br;   StringTokenizer st;    public FastReader()   {    br = new BufferedReader(new      InputStreamReader(System.in));   }    String next()   {    while (st == null || !st.hasMoreElements())    {     try     {      st = new StringTokenizer(br.readLine());     }     catch (IOException e)     {      e.printStackTrace();     }    }    return st.nextToken();   }    int nextInt()   {    return Integer.parseInt(next());   }    long nextLong()   {    return Long.parseLong(next());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   } }
0	public class D {  static Scanner in = new Scanner(new BufferedInputStream(System.in)); static PrintWriter out = new PrintWriter(System.out);  static double getTime(double v, double a, double l, double r) {  return (-v + Math.sqrt(v * v - 2 * a * (l - r))) / a; }  static double getVelocity(double v, double t, double l, double r) {  return t == 0 ? v : (2 * (r - l)) / t - v; }  public static void main(String[] args) throws IOException {  double a = in.nextDouble(), v = in.nextDouble(), l = in.nextDouble(),   d = in.nextDouble(), w = Math.min(v, in.nextDouble());  double x = v * v / (2 * a), y = d - (v * v - w * w) / (2 * a),   z = d + (v * v - w * w) / (2 * a);   double L, R, T = 0, V = 0, t;    L = 0;  R = x;  if (x > y && x < z) {  R = (x + y) / 2;  } else if (x > l) {  R = l;  }  t = getTime(V, a, L, R);  V = getVelocity(V, t, L, R);   T += t;    if (x < y) {  T += (y - x) / v;  }     L = y;  R = d;  if (x > y && x < z) {  L = (x + y) / 2;  } else if (x >= z) {  L = R;  }  t = getTime(V, -a, L, R);  V = getVelocity(V, t, L, R);  T += t;     L = d;  R = z;  if (x >= z) {  R = L;  } else if (z > l) {  R = l;  }  t = getTime(V, a, L, R);  V = getVelocity(V, t, L, R);  T += t;     L = z;  R = l;  if (x > z) {  L = x;  }  if (L < R) {  T += (R - L) / v;  }  out.format(Locale.US, "%.12f%n", T);  out.close(); } }
4	public class Main {  public static void main(String[] args) throws Exception {   Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);   thread.start();   thread.join();  }  static class TaskAdapter implements Runnable {   @Override   public void run() {    InputStream inputStream = System.in;    OutputStream outputStream = System.out;    FastInput in = new FastInput(inputStream);    FastOutput out = new FastOutput(outputStream);    CCompressionAndExpansion solver = new CCompressionAndExpansion();    int testCount = Integer.parseInt(in.next());    for (int i = 1; i <= testCount; i++)     solver.solve(i, in, out);    out.close();   }  }  static class CCompressionAndExpansion {   Node end = new Node(null, -1);   FastOutput out;   public void solve(int testNumber, FastInput in, FastOutput out) {    int n = in.ri();    List<Node> seq = new ArrayList<>(n);    Deque<Node> dq = new ArrayDeque<>(n);    end = new Node(null, -1);    dq.addLast(end);    for (int i = 0; i < n; i++) {     int x = in.ri();     while (true) {      Node last = dq.peekLast();      if (last.nextChild != x) {       dq.removeLast();       continue;      }      last.nextChild++;      dq.addLast(new Node(dq.peekLast(), x));      break;     }     seq.add(dq.peekLast());    }    this.out = out;    for (Node node : seq) {     print(node);     out.println();    }   }   void print(Node root) {    if (root.p != end) {     print(root.p);     out.append('.');    }    out.append(root.index);   }  }  static class FastInput {   private final InputStream is;   private StringBuilder defaultStringBuf = new StringBuilder(1 << 13);   private byte[] buf = new byte[1 << 13];   private int bufLen;   private int bufOffset;   private int next;   public FastInput(InputStream is) {    this.is = is;   }   private int read() {    while (bufLen == bufOffset) {     bufOffset = 0;     try {      bufLen = is.read(buf);     } catch (IOException e) {      bufLen = -1;     }     if (bufLen == -1) {      return -1;     }    }    return buf[bufOffset++];   }   public void skipBlank() {    while (next >= 0 && next <= 32) {     next = read();    }   }   public String next() {    return readString();   }   public int ri() {    return readInt();   }   public int readInt() {    boolean rev = false;    skipBlank();    if (next == '+' || next == '-') {     rev = next == '-';     next = read();    }    int val = 0;    while (next >= '0' && next <= '9') {     val = val * 10 - next + '0';     next = read();    }    return rev ? val : -val;   }   public String readString(StringBuilder builder) {    skipBlank();    while (next > 32) {     builder.append((char) next);     next = read();    }    return builder.toString();   }   public String readString() {    defaultStringBuf.setLength(0);    return readString(defaultStringBuf);   }  }  static class Node {   Node p;   int index;   int nextChild = 1;   public Node(Node p, int index) {    this.p = p;    this.index = index;   }  }  static class FastOutput implements AutoCloseable, Closeable, Appendable {   private static final int THRESHOLD = 32 << 10;   private final Writer os;   private StringBuilder cache = new StringBuilder(THRESHOLD * 2);   public FastOutput append(CharSequence csq) {    cache.append(csq);    return this;   }   public FastOutput append(CharSequence csq, int start, int end) {    cache.append(csq, start, end);    return this;   }   private void afterWrite() {    if (cache.length() < THRESHOLD) {     return;    }    flush();   }   public FastOutput(Writer os) {    this.os = os;   }   public FastOutput(OutputStream os) {    this(new OutputStreamWriter(os));   }   public FastOutput append(char c) {    cache.append(c);    afterWrite();    return this;   }   public FastOutput append(int c) {    cache.append(c);    afterWrite();    return this;   }   public FastOutput println() {    return append('\n');   }   public FastOutput flush() {    try {          os.append(cache);     os.flush();     cache.setLength(0);    } catch (IOException e) {     throw new UncheckedIOException(e);    }    return this;   }   public void close() {    flush();    try {     os.close();    } catch (IOException e) {     throw new UncheckedIOException(e);    }   }   public String toString() {    return cache.toString();   }  } }
1	public class a {  public static long mod = (long) Math.pow(10, 9) + 7; public static int k = 0;  private static class node implements Comparable<node> {  int l;  int r;  int index;  int index2;  int buffer;  node(int l, int r, int i, int b, int i2) {  this.l = l;  this.r = r;  index = i;  buffer = b;  index2 = i2;  }  @Override  public int compareTo(node o) {  if (k == 0) {   if (o.l < l)   return 1;   else if (o.l > l)   return -1;   else if (o.buffer != -1) {   return 1;   } else   return -1;  } else if (k == 1) {   if (r != o.r)   return r - o.r;   return o.index - index;  } else if (k == 2) {   return r - o.r;  } else {   if (o.index < index)   return 1;   else   return -1;  }  } }                              public static class point implements Comparable<point> {  long x;  long y;  point(long x, long y) {  this.x = x;  this.y = y;  }  @Override  public int compareTo(point o) {  return (int) (x - o.x);  } }  public static int ch(long y) {  int r = Long.bitCount(y);  return r; }  public static int gcd(int x, int y) {  if (y == 0)  return x;  return gcd(y, x % y); }  public static int min[]; public static int max[];  public static void build(int s, int e, int p, int a[]) {  if (s == e) {  min[p] = a[s];  max[p] = a[s];  return;  }  int mid = (s + e) / 2;  build(s, mid, p * 2, a);  build(mid + 1, e, p * 2 + 1, a);  min[p] = Math.min(min[p * 2], min[p * 2 + 1]);  max[p] = Math.max(max[p * 2], max[p * 2 + 1]); }  public static int getMin(int s, int e, int p, int from, int to) {  if (s > to || e < from)  return Integer.MAX_VALUE;  if (s >= from && e <= to)  return min[p];  int mid = (s + e) / 2;  int a = getMin(s, mid, p * 2, from, to);  int b = getMin(mid + 1, e, p * 2 + 1, from, to);  return Math.min(a, b);  }  public static int getMax(int s, int e, int p, int from, int to) {  if (s > to || e < from)  return Integer.MIN_VALUE;  if (s >= from && e <= to)  return max[p];  int mid = (s + e) / 2;  int a = getMax(s, mid, p * 2, from, to);  int b = getMax(mid + 1, e, p * 2 + 1, from, to);  return Math.max(a, b);  }  public static boolean ch[]; public static ArrayList<Integer> prime; public static Queue<Integer> pp;  public static void sieve(int k) {  ch[0] = ch[1] = true;  for (int i = 2; i <= k; i++) {  if (!ch[i]) {   prime.add(i);   pp.add(i);   for (int j = i + i; j <= k; j += i) {   ch[j] = true;   }  }  }  }  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder qq = new StringBuilder();  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  String y[] = in.readLine().split(" ");  int n = Integer.parseInt(y[0]);  int a = Integer.parseInt(y[1]);  int b = Integer.parseInt(y[2]);  int arr[] = new int[n];  HashMap<Integer, Integer> mp = new HashMap();  y = in.readLine().split(" ");  boolean flag = true;  for (int i = 0; i < n; i++) {  arr[i] = Integer.parseInt(y[i]);  if (arr[i] >= a && arr[i] >= b) {   flag = false;  }  mp.put(arr[i], i);  }  if (!flag) {  System.out.println("NO");  return;  }  boolean ch[] = new boolean[n];  int ans[] = new int[n];  for (int i = 0; i < n; i++) {  int k = i;   while (true&&!ch[k]) {     if (mp.containsKey(a - arr[k]) && !ch[mp.get(a - arr[k])]    && mp.containsKey(b - arr[k])    && !ch[mp.get(b - arr[k])]) {   break;   } else if (mp.containsKey(a - arr[k])    && !ch[mp.get(a - arr[k])]) {      ch[k] = true;   ans[k] = 0;   ch[mp.get(a - arr[k])] = true;   ans[mp.get(a - arr[k])] = 0;   int s = b - (a - arr[k]);   if (mp.containsKey(s)) {    k = mp.get(s);   } else    break;      } else if (mp.containsKey(b - arr[k])    && !ch[mp.get(b - arr[k])]) {   ans[k] = 1;   ans[mp.get(b - arr[k])] = 1;   ch[k] = true;   ch[mp.get(b - arr[k])] = true;    int s = a - (b - arr[k]);   if (mp.containsKey(s)) {    k = mp.get(s);   } else    break;   } else {      System.out.println("NO");   return;   }  }  }  qq.append("YES\n");  for (int i = 0; i < ans.length; i++) {  qq.append(ans[i] + " ");  }  System.out.println(qq);  } }
2	public class Main {  public static void main(String[] args) throws IOException {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Answer solver = new Answer();   solver.solve(in, out);   out.close();  } } class Answer {  private int sumd(long x) {   int sum = 0;   while (x != 0) {    sum += x % 10;    x /= 10;   }   return sum;  }  private long bin(long l, long r, long s) {   if (l > r) {    return -1;   }   long x = (l + r) >> 1;   int sum = sumd(x);   if (x - sum < s) {    return bin(x + 1, r, s);   }   long t = bin(l, x - 1, s);   if (t != -1) {    return t;   }   return x;  }  public void solve(InputReader in, PrintWriter out) throws IOException {   long n = in.nextLong();   long s = in.nextLong();   long t = bin(1, n, s);   if (t == -1) {    out.print("0");   } else {    long ans = n - t + 1;    out.print(ans);   }  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream), 32768);   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  public long nextLong() {   return Long.parseLong(next());  } }
0	public class D5 {   static StringTokenizer st;  static BufferedReader in;  public static void main(String[] args) throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   double a = nextInt();   double v = nextInt();   double L = nextInt();   double d = nextInt();   double w = nextInt();   double ans = 0;   if (w >= v)    ans = go(0, a, L, v);   else {    ans = go(Math.min(w, Math.sqrt(2*a*d)), a, L-d, v);    if (2*a*d < w*w)     ans += Math.sqrt(2*d/a);    else {     if (d-v*v/(2*a) >= (v*v-w*w)/(2*a))      ans += v/a+(v-w)/a+(d-v*v/(2*a)-(v*v-w*w)/(2*a))/v;     else {      double x = Math.sqrt((w*w+2*a*d)/2);      ans += x/a+(x-w)/a;     }    }   }   System.out.println(ans);   pw.close();  }   private static double go(double v0, double a, double s, double vmax) {   double t = (vmax-v0) / a;   if (v0*t+a*t*t/2 < s)    return t+(s-v0*t-a*t*t/2) / vmax;   else {    double D = v0*v0+2*a*s;    return (-v0+Math.sqrt(D))/a;   }  }   private static int nextInt() throws IOException{   return Integer.parseInt(next());  }   private static long nextLong() throws IOException{   return Long.parseLong(next());  }   private static double nextDouble() throws IOException{   return Double.parseDouble(next());  }   private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  }
1	public class B {   public static void main(String[] args) {  Scanner scr = new Scanner(System.in);  int n = scr.nextInt();  int k = scr.nextInt();   int[] a = new int[n+1];   int[] d = new int[100001];   int tk = 0;  int l = 1;  int r = -1;  boolean find = false;  for (int i = 1; i <= n; i++){  a[i] = scr.nextInt();  if (d[a[i]] == 0){   d[a[i]] = 1;   tk++;   if ((!find) && (tk == k)){   find = true;   r = i;   }   }  }     if (r > 0) {  int[] cd = new int[100001];  tk = 0;  find = false;  for (int j = r; j >= l; j--){   if(cd[a[j]] == 0){   cd[a[j]] = 1;   tk++;   if ((!find) && (tk == k)){    find = true;    l = j;    break;   }   }   }   System.out.println(l + " " + r);  }  else {  System.out.println("-1 -1");  }   } }
0	public class Main {  Reader in = new Reader(System.in);  PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {   new Main().run();  }  int a, v;  int l, d, w;  void run() throws IOException {   a = in.nextInt();   v = in.nextInt();   l = in.nextInt();   d = in.nextInt();   w = in.nextInt();   double totalTime = 0.0;   if (v >= w) {    if (w*w >= 2*a*d) {     double x = Math.sqrt(2*a*d);     totalTime = x / a;     if ((v*v-x*x) >= 2*a*(l-d))      totalTime += (-2*x+Math.sqrt(4*x*x+8*a*(l-d))) / (2*a);     else      totalTime += (v-x)/(1.0*a) + (l-d-(v*v-x*x)/(2.0*a))/v;    } else {     if (2*v*v-w*w <= 2*a*d) {      totalTime = v / (1.0*a) + (v-w) / (1.0*a) + (d-(2*v*v-w*w)/(2.0*a)) / v;     } else {      double x = Math.sqrt((2*a*d+w*w)/2.0);      totalTime = x / a + (x-w) / a;     }     if ((v*v-w*w) >= 2*a*(l-d))      totalTime += (-2*w+Math.sqrt(4*w*w+8*a*(l-d))) / (2*a);     else      totalTime += (v-w)/(1.0*a) + (l-d-(v*v-w*w)/(2.0*a))/v;    }   } else {    if (v*v >= 2*a*l)     totalTime = Math.sqrt(l*2.0/a);    else     totalTime = v / (1.0*a) + (l-v*v/(2.0*a)) / v;   }   out.printf("%.10f", totalTime);   out.flush();  }  void solve() throws IOException {  }  static class Reader {   BufferedReader reader;   StringTokenizer tokenizer;   public Reader(InputStream input) {    reader = new BufferedReader(new InputStreamReader(input));    tokenizer = new StringTokenizer("");   }      String nextToken() throws IOException {    while ( ! tokenizer.hasMoreTokens() ) {         tokenizer = new StringTokenizer( reader.readLine() );    }    return tokenizer.nextToken();   }   String readLine() throws IOException {    return reader.readLine();   }   char nextChar() throws IOException {    return (char)reader.read();   }   int nextInt() throws IOException {    return Integer.parseInt( nextToken() );   }   long nextLong() throws IOException {    return Long.parseLong( nextToken() );   }   double nextDouble() throws IOException {    return Double.parseDouble( nextToken() );   }  } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   Task solver = new Task();   int testCount = 1;   for (int i = 1; i <= testCount; i++)    solver.solve(i, in, out);   out.close();  } } class Task {  int n;  int[] a;  int[] b;  public void solve(int testNumber, InputReader in, PrintWriter out) {   n = in.readInt();   a = new int[n];   b = new int[n];   for (int i = 0; i < n; ++i)    a[i] = b[i] = in.readInt();   sort(0, n - 1);   int different = 0;   for (int i = 0; i < n; ++i)    if (a[i] != b[i])     ++different;   out.println(different <= 2 ? "YES" : "NO");  }  public void sort(int lo, int hi) {   if (lo < hi) {    int mid = (lo + hi) / 2;    sort(lo, mid);    sort(mid + 1, hi);    merge(lo, mid, hi);   }  }  public void merge(int lo, int mid, int hi) {   int n1 = mid - lo + 1;   int n2 = hi - (mid + 1) + 1;   int[] x = new int[n1 + 1];   int[] y = new int[n2 + 1];   for (int i = 0; i < n1; ++i)    x[i] = b[lo + i];   for (int j = 0; j < n2; ++j)    y[j] = b[mid + 1 + j];   x[n1] = y[n2] = Integer.MAX_VALUE;   for (int k = lo, i = 0, j = 0; k <= hi; ++k)    b[k] = x[i] < y[j] ? x[i++] : y[j++];  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public String readString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  public Long readLong() {   return Long.parseLong(readString());  }  public Double readDouble() {   return Double.parseDouble(readString());  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }
4	public class ques3 { public static void main(String[] args)throws Exception{ new ques3().run();}  long mod=1000000000+7;  void solve() throws Exception {  for(int ii=ni();ii>0;ii--)  {  int n=ni();    Stack<Integer> st=new Stack<Integer>();  int x=ni();    st.add(1);  out.println("1");  for(int i=2;i<=n;i++)  {   x=ni();   if(x==1)   {    st.add(1);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    continue;   }   int top=st.peek();   if(top+1==x)   {    st.pop();    st.add(x);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    continue;   }   while(true)   {    top=st.peek();    if(top+1==x)    {    st.pop();    st.add(x);    Stack<Integer> tep=(Stack<Integer>) st.clone();    display(tep);    break;    }    top=st.pop();   }  }  } }   void display(Stack<Integer> st) {  ArrayList<Integer> al = new ArrayList<>();  while(st.size()!=0)  {  int tem=st.pop();  al.add(tem);  }  Collections.reverse(al);  for (int i = 0; i <al.size()-1; i++) {  out.print(al.get(i)+".");  }  out.println(al.get(al.size()-1)); }    private byte[] buf=new byte[1024]; private int index; private InputStream in; private int total; private SpaceCharFilter filter; PrintWriter out;  int min(int... ar){int min=Integer.MAX_VALUE;for(int i:ar)min=Math.min(min, i);return min;} long min(long... ar){long min=Long.MAX_VALUE;for(long i:ar)min=Math.min(min, i);return min;} int max(int... ar) {int max=Integer.MIN_VALUE;for(int i:ar)max=Math.max(max, i);return max;} long max(long... ar) {long max=Long.MIN_VALUE;for(long i:ar)max=Math.max(max, i);return max;} void reverse(int a[]){for(int i=0;i<a.length>>1;i++){int tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}} void reverse(long a[]){for(int i=0;i<a.length>>1;i++){long tem=a[i];a[i]=a[a.length-1-i];a[a.length-1-i]=tem;}} String reverse(String s){StringBuilder sb=new StringBuilder(s);sb.reverse();return sb.toString();}  void shuffle(int a[]) {  ArrayList<Integer> al = new ArrayList<>();  for(int i=0;i<a.length;i++)   al.add(a[i]);   Collections.sort(al);  for(int i=0;i<a.length;i++)   a[i]=al.get(i); } long lcm(long a,long b) {  return (a*b)/(gcd(a,b)); }  int gcd(int a, int b)  {  if (a == 0)   return b;  return gcd(b%a, a);  }  long gcd(long a, long b)  {  if (a == 0)   return b;  return gcd(b%a, a);  }  long expo(long p,long q)  {  long z = 1;  while (q>0) {  if (q%2 == 1) {   z = (z * p)%mod;  }  p = (p*p)%mod;  q >>= 1;  }  return z; } void run()throws Exception {  in=System.in; out = new PrintWriter(System.out);  solve();  out.flush(); } private int scan()throws IOException {  if(total<0)  throw new InputMismatchException();  if(index>=total)  {  index=0;  total=in.read(buf);  if(total<=0)   return -1;  }  return buf[index++]; } private int ni() throws IOException  {  int c = scan();  while (isSpaceChar(c))  c = scan();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = scan();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = scan();  } while (!isSpaceChar(c));  return res * sgn; } private long nl() throws IOException  {  long num = 0;  int b;  boolean minus = false;  while ((b = scan()) != -1 && !((b >= '0' && b <= '9') || b == '-'))  ;  if (b == '-') {  minus = true;  b = scan();  }   while (true) {  if (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');  } else {   return minus ? -num : num;  }  b = scan();  } } private double nd() throws IOException{  return Double.parseDouble(ns()); } private String ns() throws IOException {  int c = scan();  while (isSpaceChar(c))  c = scan();  StringBuilder res = new StringBuilder();  do {  if (Character.isValidCodePoint(c))   res.appendCodePoint(c);  c = scan();  } while (!isSpaceChar(c));  return res.toString(); } private String nss() throws IOException {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  return br.readLine(); } private char nc() throws IOException  {  int c = scan();  while (isSpaceChar(c))  c = scan();  return (char) c; } private boolean isWhiteSpace(int n) {  if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)  return true;  return false; } private boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return isWhiteSpace(c); } private interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
1	public class Main {  static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer;  static int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); }  static long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(nextToken()); }  static double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(nextToken()); }  static String nextToken() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken(); }  public static void main(String[] args) throws IOException {  reader = new BufferedReader(new InputStreamReader(System.in));  writer = new PrintWriter(System.out);  pineapple();  reader.close();  writer.close(); }  static void pineapple() throws NumberFormatException, IOException {  int n = nextInt();  int a = nextInt();  int b = nextInt();  TreeSet<Integer> al = new TreeSet<Integer>();  TreeMap<Integer, Integer> mp = new TreeMap<Integer, Integer>();  int[] ans = new int[n];  Arrays.fill(ans, -1);  TreeSet<Integer> used = new TreeSet<Integer>();  int[] mas = new int[n];  for (int i = 0; i < n; i++) {  int t = nextInt();  al.add(t);  mas[i] = t;  mp.put(t, i);  }  for (int st : al) {  if (used.contains(st))   continue;   {   int pr = st;   int cc = -1;   TreeSet<Integer> u2 = new TreeSet<Integer>();   u2.add(pr);   if (al.contains(a - pr) && !u2.contains(a - pr))   cc = a - pr;   else if (al.contains(b - pr) && !u2.contains(a - pr))   cc = b - pr;   if (cc != -1) {   u2.add(cc);   boolean bGo = true;   while (bGo) {    bGo = false;    int nxt = -1;    if (al.contains(a - cc) && !u2.contains(a - cc))    nxt = a - cc;    else if (al.contains(b - cc) && !u2.contains(b - cc))    nxt = b - cc;    if (nxt != -1) {    bGo = true;    u2.add(nxt);    cc = nxt;    pr = cc;    }   }   st = cc;   }  }   int x = st;  while (x != -1) {   int curr = x;   used.add(curr);   x = -1;   int next1 = a - curr;   if (al.contains(next1)) {   if (!used.contains(next1)) {    x = next1;    int ci = mp.get(curr);    int ni = mp.get(next1);    if (ans[ci] == -1 && ans[ni] == -1) {    ans[ni] = 0;    ans[ci] = 0;    }   }   }   int next2 = b - curr;   if (al.contains(next2)) {   if (!used.contains(next2)) {    x = next2;    int ci = mp.get(curr);    int ni = mp.get(next2);    if (ans[ci] == -1 && ans[ni] == -1) {    ans[ni] = 1;    ans[ci] = 1;    }   }   }  }  }  for (int i = 0; i < n; i++) {  if (ans[i] == -1) {   if (2 * mas[i] == a) {   ans[i] = 0;   continue;   }   if (2 * mas[i] == b) {   ans[i] = 1;   continue;   }   writer.println("NO");   return;  }  }  writer.println("YES");  for (int i = 0; i < n; i++) {  writer.print(ans[i] + " ");  } } }
2	public class Main{  public static boolean check(BigInteger a, BigInteger b){  long n = 0;  String aStr = a.toString();  for (int i=0; i < aStr.length() ;i++ ) {  n += Long.valueOf(aStr.charAt(i)-'0');  }  return a.subtract(BigInteger.valueOf(n)).compareTo(b) >= 0; }  public static void main(String[] args) {  try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){  String[] str = in.readLine().split(" ");  BigInteger n = new BigInteger(str[0]);  BigInteger s = new BigInteger(str[1]);   BigInteger left = BigInteger.ONE;  BigInteger right = new BigInteger(n.toString()).add(BigInteger.TEN);   BigInteger TWO = BigInteger.ONE.add(BigInteger.ONE);   BigInteger t;   while(right.subtract(left).compareTo(BigInteger.ONE)>0){   t = left.add(right.subtract(left).divide(TWO));   if(check(t, s)){   right = t;   }else{   left = t;   }  }  BigInteger result = n.subtract(right).add(BigInteger.ONE);  if (result.compareTo(BigInteger.ZERO)<=0) {   System.out.println(0);  }else{   System.out.println(result);  }  }catch (IOException e) {  e.printStackTrace();  } } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Scanner in = new Scanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, Scanner in, PrintWriter out) {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int[] fs = IOUtils.readIntArray(in, n);  Arrays.sort(fs);  int ptr = fs.length - 1;  int res = 0;  while (ptr >= 0 && k < m) {  k += fs[ptr--] - 1;  res++;  }  if (k < m) out.println(-1);  else out.println(res); } } class IOUtils {  public static int[] readIntArray(Scanner in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.nextInt();   return array;  }  }
3	public class D911 {  public static void main(String[] args) throws IOException {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));   StringTokenizer st;   int n = Integer.parseInt(br.readLine());   st = new StringTokenizer(br.readLine());   int[] num = new int[n];   for (int i = 0; i < n; i++) {    num[i] = Integer.parseInt(st.nextToken());   }   int count = 0;   for (int i = 0; i < n; i++) {    for (int j = 0; j < i; j++) {     if (num[i] < num[j]) {      count++;     }    }   }   boolean ans = count % 2 == 0;   for (int m = Integer.parseInt(br.readLine()); m-- > 0; ) {    st = new StringTokenizer(br.readLine());    int l = Integer.parseInt(st.nextToken());    int r = Integer.parseInt(st.nextToken());    if (((r - l + 1) / 2) % 2 != 0) {     ans = !ans;    }    out.println(ans ? "even" : "odd");   }   out.close();  } }
5	public class LittleElephantAndProblem {  boolean DEBUG = true;  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  StringTokenizer st = null;  String s() throws IOException {   if (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int i() throws IOException {   return Integer.parseInt(s());  }  int i(String s) throws IOException {   return Integer.parseInt(s);  }  long l() throws IOException {   return Long.parseLong(s());  }  long l(String s) throws IOException {   return Long.parseLong(s);  }  double d() throws IOException {   return Double.parseDouble(s());  }  double d(String s) throws IOException {   return Double.parseDouble(s);  }  void D(Object a) {   if (DEBUG) {    int len = getLength(a);    for (int i = 0; i < len; ++i) {     System.out.print(get(a, i) + " ");    }    System.out.println();   }  }  void D(Object[] a) {   if (DEBUG) {    int R = getLength(a), C = getLength(get(a, 0));    for (int i = 0; i < R; ++i) {     for (int j = 0; j < C; ++j) {      System.out.print(get(get(a, i), j) + " ");     }     System.out.println();    }   }  }  void D(String args) {   if (DEBUG) {    System.out.print(args);   }  }  void D(String format, Object... args) {   if (DEBUG) {    System.out.printf(format, args);   }  }  void fl() {   System.out.print(out);  }  int n = i();  public LittleElephantAndProblem() throws IOException {   List<Integer> a = new ArrayList<Integer>();   List<Integer> b = new ArrayList<Integer>();   for (int i = 0; i < n; ++i) {    int x = i();    a.add(x);    b.add(x);   }   sort(b);   int d = 0;   for (int i = 0; i < n; ++i) {    if ((int)a.get(i) != (int)b.get(i)) {     ++d;    }   }   if (d > 2) {    out.append("NO\n");   } else {    out.append("YES\n");   }   fl();  }  public static void main(String[] args) throws IOException {   new LittleElephantAndProblem();  } }
1	public class Pr468B { public static void main(String[] args) throws IOException {  new Pr468B().run(); }  BufferedReader in; PrintWriter out; StringTokenizer st;  String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out, true);  solve();  out.flush(); }  int[] which; boolean[] was; int[] pa; int[] pb;  void dfs(int i, boolean fa) {  was[i] = true;  if (fa) {  if (pa[i] == -1) {   out.println("NO");   out.flush();   System.exit(0);  }  which[i] = 0;  which[pa[i]] = 0;  if (pb[pa[i]] != -1 && !was[pb[pa[i]]]) {   dfs(pb[pa[i]], fa);  }  } else {  if (pb[i] == -1) {   out.println("NO");   out.flush();   System.exit(0);  }  which[i] = 1;  which[pb[i]] = 1;  if (pa[pb[i]] != -1 && !was[pa[pb[i]]]) {   dfs(pa[pb[i]], fa);  }  } }  void solve() throws IOException {  int n = nextInt();  int a = nextInt();  int b = nextInt();  int[] p = new int[n];  HashMap<Integer, Integer> allNums = new HashMap<Integer, Integer>();  for (int i = 0; i < n; i++) {  p[i] = nextInt();  if (p[i] >= Math.max(a, b)) {   out.println("NO");   return;  }  allNums.put(p[i], i);  }  pa = new int[n];  pb = new int[n];  Arrays.fill(pa, -1);  Arrays.fill(pb, -1);  which = new int[n];  Arrays.fill(which, -1);  for (int i = 0; i < n; i++) {  if (pa[i] == -1 && allNums.containsKey(a - p[i])) {   pa[i] = allNums.get(a - p[i]);   pa[pa[i]] = i;  }  if (pb[i] == -1 && allNums.containsKey(b - p[i])) {   pb[i] = allNums.get(b - p[i]);   pb[pb[i]] = i;  }  if (pa[i] == -1 && pb[i] == -1) {   out.println("NO");   return;  }  }  was = new boolean[n];  for (int i = 0; i < n; i++) {  if (!was[i] && pa[i] == -1) {   dfs(i, false);  } else if (!was[i] && pb[i] == -1) {   dfs(i, true);  }  }  for (int i = 0; i < n; i++) {  if (!was[i]) {   dfs(i, true);  }  }  out.println("YES");  for (int i = 0; i < n; i++) {  out.print(which[i] + " ");  } } }
6	public class Round8_C {    int n ; int[] X, Y ;  public Round8_C() {  info_in() ;  process() ; }  void info_in() {  Scanner input = new Scanner(System.in) ;  int dx = input.nextInt() ;  int dy = input.nextInt() ;   n = input.nextInt() ;  X = new int[n] ;  Y = new int[n] ;   for( int i=0;i<n;i++) {  X[i] = input.nextInt() - dx ;  Y[i] = input.nextInt() - dy ;  } }  int[] d ; int[] trace ;  public static int distance( int x1, int y1, int x2, int y2 ) {  return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ; }  void process() {  int gh = 1<<n ;  d = new int[gh] ;  trace = new int[gh] ;   d[0] = 0 ;  for( int i=1;i<gh;i++) {  d[i] = Integer.MAX_VALUE ;  for( int j=0;j<n;j++)   if ( (i & (1<<j)) > 0 ) {   int val = d[i^(1<<j)] + ( distance( X[j], Y[j], 0, 0 ) << 1 ) ;   if ( val < d[i] ) {    d[i] = val ;    trace[i] = j+1 ;   }      int state = i ^ (1<<j) ;   for( int p=j+1;p<n;p++)    if ( (i & (1<<p)) > 0) {    val = d[state^(1<<p)] + distance( X[j], Y[j], 0, 0 ) + distance( X[j], Y[j], X[p], Y[p] ) + distance( X[p], Y[p], 0, 0 ) ;    if ( val < d[i] ) {     d[i] = val ;     trace[i] = (j+1) * 100 + (p+1) ;     }    }   break ;   }  }   System.out.println( d[gh-1] ) ;  gh-- ;  while ( gh > 0 ) {  int v1 = trace[gh] / 100 - 1 ;  int v2 = trace[gh] % 100 - 1 ;  System.out.print(0 + " ") ;  if ( v1 != -1 ) {   System.out.print((v1+1) + " " ) ;   gh -= 1 << v1 ;  }  System.out.print( (v2+1) + " " ) ;  gh -= 1 << v2 ;  }  System.out.println(0) ; }  public static void main(String[] args) {   new Round8_C() ; } }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastInputReader in = new FastInputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  int n, a, b;  Map<Integer, Integer> position;  int[] p;  int[] group;  public void solve(int testNumber, FastInputReader in, PrintWriter out) {   n = in.nextInt();   a = in.nextInt();   b = in.nextInt();   position = new TreeMap<Integer, Integer>();   p = new int[n];   group = new int[n];   for (int i = 0; i < n; i++) {    p[i] = in.nextInt();    group[i] = -1;    position.put(p[i], i);   }   for (int i = 0; i < n; i++) {    if (getMate(i) != -1)     continue;    out.println("NO");    return;   }   for (int i = 0; i < n; i++) {    boolean aMate = position.containsKey(a - p[i]);    boolean bMate = position.containsKey(b - p[i]);    if (aMate && bMate)     continue;    if (group[i] != -1)     continue;    if (!solve(i)) {     out.println("NO");     return;    }   }   for (int i = 0; i < n; i++) {    if (group[i] != -1)     continue;    if (!solve(i)) {     out.println("NO");     return;    }   }   out.println("YES");   for (int i = 0; i < n; i++) {    out.print(group[i]);    out.print(" ");   }   out.println();  }  private boolean solve(int index) {   int mate = getMate(index);   if (mate == -1)    return false;   assign(index, mate);   if (getMate(index) != -1)    return solve(getMate(index));   else    return getMate(mate) == -1 || solve(getMate(mate));  }  private void assign(int index, int mate) {   int sum = p[index] + p[mate];   if (sum == a) {    group[index] = group[mate] = 0;    return;   }   if (sum == b) {    group[index] = group[mate] = 1;    return;   }   throw new RuntimeException("Wrong assignment :(");  }  private int getMate(int index) {   int[] possibleMates = new int[] {a - p[index], b - p[index]};   for (int mate: possibleMates) {    if (position.containsKey(mate)) {     int mateIndex = position.get(mate);     if (group[mateIndex] == -1)      return mateIndex;    }   }   return -1;  } } class FastInputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public FastInputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream), 32768);   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  } }
6	public class C {  static int[] dp;  static int[] f;  static void solve(){   dp = new int[1<<n];   f = new int[1<<n];   Arrays.fill(dp, 1<<29);   dp[0] = 0;   for(int i=0;i<(1<<n);i++){    for(int j=0;j<n;j++){     int ni = i | (1<<j);     if( i != ni ){      int v = d[j]*2 + dp[i];      if(v < dp[ni]){       dp[ni] = v;       f[ni] = i;      }      for(int k=j+1;k<n;k++){       int nni = ni | (1<<k);       if( ni != nni){        int vv = d[j] + t[j][k] + d[k] + dp[i];        if(vv < dp[nni]){         dp[nni] = vv;         f[nni] = i;        }       }      }      break;     }    }   }   out.println(dp[dp.length-1]);    int idx = dp.length - 1;   out.print("0 ");   while(idx != 0){    int road = idx ^ f[idx];    for(int i=0;i<n;i++) if( ((road>>i) & 1) == 1) out.print((i+1)+" ");    idx = f[idx];    out.print("0 ");   }   out.println();  }  static int[] d;  static int[][] t;  static int n;  public static void main(String[] args) {   Scanner sc = new Scanner(in);   int x = sc.nextInt();   int y = sc.nextInt();   n = sc.nextInt();   int[] dx = new int[n];   int[] dy = new int[n];   for(int i=0;i<n;i++){    dx[i] = sc.nextInt();    dy[i] = sc.nextInt();   }   d = new int[n];   for(int i=0;i<n;i++){    d[i] = (x-dx[i])*(x-dx[i]) + (y-dy[i])*(y-dy[i]);   }   t = new int[n][n];   for(int i=0;i<n;i++){    for(int j=0;j<n;j++){     t[i][j] = (dx[i]-dx[j])*(dx[i]-dx[j]) + (dy[i]-dy[j])*(dy[i]-dy[j]);    }   }    solve();  } }
1	public class C138B {  private static StringTokenizer st;   public static void nextLine(BufferedReader br) throws IOException  {   st = new StringTokenizer(br.readLine());  }   public static int nextInt()  {   return Integer.parseInt(st.nextToken());  }   public static String next()  {   return st.nextToken();  }   public static long nextLong()  {   return Long.parseLong(st.nextToken());  }   public static void main(String[] args) throws IOException  {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   nextLine(br);   int n = nextInt();   int k = nextInt();   int[] a = new int[n];   nextLine(br);   for (int i = 0; i < n; i++) a[i] = nextInt();     int bp = 0, fp = 0, count = 0;   boolean good = false;   int[] mark = new int[100001];   for (fp = 0; fp < n; fp++)   {    if (mark[a[fp]] == 0)    {     count++;    }    mark[a[fp]]++;    if (count == k)    {     good = true;     break;    }   }   if (!good)   {    System.out.println("-1 -1");    return;   }   for (bp = 0; bp < fp; bp++)   {    if (mark[a[bp]] > 1)    {     mark[a[bp]]--;    }    else break;   }   System.out.println((bp+1) + " " + (fp+1));  }  }
1	public class primes { public static void main(String [] args){ ArrayList<Integer> numb=new ArrayList<Integer>(); Scanner br1 = new Scanner(System.in); int n=br1.nextInt(); int steps=br1.nextInt(); if(n>=3)numb.add(3); for(int j=4;j<=n;j++){ if(chekprime(j)==0){ numb.add(j); } } int counter =0; for(int give=0;give<numb.size();give++) {if("YES".equals(sumup(numb, 2, numb.get(give)))){ counter++;  }  }  if(counter>=steps)System.out.println("YES"); else System.out.println("NO");  } public static String sumup(ArrayList<Integer> list,int number,int NUM){ String ret="NO";  ArrayList<Integer> result=new ArrayList<Integer>(); ArrayList<Integer>[] arList=new ArrayList[number]; for(int i=0;i<number;i++){ arList[i]=new ArrayList<Integer>(); arList[i]=(ArrayList<Integer>)list.clone(); for(int k=0;k<i;k++){ arList[i].add(0,arList[i].remove(arList[i].size()-1)); } }   int [] temp=new int[list.size()];  for(int z=0;z<list.size();z++){  for(int count=0;count<number;count++){   temp[z]+=arList[count].get(z);  } result.add(temp[z]); } if(result.contains(NUM-1)) {  ret="YES"; } return ret; }  public static int chekprime(int n){ int flag=0; for(int i=2;i<=Math.sqrt(n)+1;i++) { if(n%i==0){ flag=1; break; } }  return flag; } }
5	public class Start {  final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  void init() throws FileNotFoundException {   if (ONLINE_JUDGE) {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   } else {    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  public static void main(String[] args) {   new Start().run();    }  public static void mergeSort(int[] a) {   mergeSort(a, 0, a.length - 1);  }  private static void mergeSort(int[] a, int levtIndex, int rightIndex) {   final int MAGIC_VALUE = 50;   if (levtIndex < rightIndex) {    if (rightIndex - levtIndex <= MAGIC_VALUE) {     insertionSort(a, levtIndex, rightIndex);    } else {     int middleIndex = (levtIndex + rightIndex) / 2;     mergeSort(a, levtIndex, middleIndex);     mergeSort(a, middleIndex + 1, rightIndex);     merge(a, levtIndex, middleIndex, rightIndex);    }   }  }  private static void merge(int[] a, int levtIndex, int middleIndex,    int rightIndex) {   int length1 = middleIndex - levtIndex + 1;   int length2 = rightIndex - middleIndex;   int[] levtArray = new int[length1];   int[] rightArray = new int[length2];   System.arraycopy(a, levtIndex, levtArray, 0, length1);   System.arraycopy(a, middleIndex + 1, rightArray, 0, length2);   for (int k = levtIndex, i = 0, j = 0; k <= rightIndex; k++) {    if (i == length1) {     a[k] = rightArray[j++];    } else if (j == length2) {     a[k] = levtArray[i++];    } else {     a[k] = levtArray[i] <= rightArray[j] ? levtArray[i++]       : rightArray[j++];    }   }  }  private static void insertionSort(int[] a, int levtIndex, int rightIndex) {   for (int i = levtIndex + 1; i <= rightIndex; i++) {    int current = a[i];    int j = i - 1;    while (j >= levtIndex && a[j] > current) {     a[j + 1] = a[j];     j--;    }    a[j + 1] = current;   }  }  public void run() {   try {    long t1 = System.currentTimeMillis();    init();    solve();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time = " + (t2 - t1));   } catch (Exception e) {    e.printStackTrace(System.err);    System.exit(-1);   }  }  class LOL implements Comparable<LOL> {   int x;   int y;   int num;   public LOL(int x, int y,int num) {    this.x = x;    this.y = y;    this.num = num;   }   @Override   public int compareTo(LOL o) {    return x - o.x;          }  }      public void solve() throws IOException {    int n = readInt();   int m = readInt();   int k = readInt();     int [] a = new int [n];   for (int i = 0; i < n; i++){    a[i] = readInt();   }   mergeSort(a);     if (k>=m){    out.print(0);    return;   }     int ans = 0;   k--;   for (int i = n-1; i >=0; i--){    ans += a[i];    if (ans + k >= m){     out.print(n-i);     return;    }    else {     k--;    }   }   out.print(-1);       }    }
1	public class Main { static HashMap<Integer,Integer> hm; static int[] array; static boolean marked[]; static int a , b ;  static int[] ans ;   public static void main( String args[]) {  Scanner sc = new Scanner(System.in);  int n ;    n = sc.nextInt();  a = sc.nextInt();  b = sc.nextInt();   hm = new HashMap<Integer,Integer>();  array = new int[n];  marked = new boolean[n];   for( int i = 0 ; i < n ; ++i )  {  array[i] = sc.nextInt();  hm.put( array[i] , i );  }   if( a == b)  {  boolean flag = true ;  for( int i = 0 ; i < n ; ++i )   if( !hm.containsKey( a - array[i]))   flag = false;     if( !flag)   System.out.println( "NO");  else  {   System.out.println("YES");   for( int i = 0 ; i < n ; ++i)   System.out.print("0 ");  }  }   else  {    ans = new int[n];    for( int i = 0 ; i < n ; ++i )  if( marked[i] ) continue;     else   {   if( hm.containsKey(a - array[i]) && !hm.containsKey(b - array[i]))   {   propagateA(i);   }     else if( !hm.containsKey(a - array[i]) && hm.containsKey(b - array[i]))   {      propagateB(i);   }     else if(!hm.containsKey(a - array[i]) && !hm.containsKey(b - array[i]))   {   System.out.println("NO");   System.exit(0);   }  }        for( int i = 0 ; i < n ; ++i )   if( marked[i] ) continue;      else   {    start(i);   }    System.out.println("YES");  for( int i = 0 ; i < n; ++i)   System.out.print(ans[i] + " ");  System.exit(0);  }       }  static void propagateA(int index) {   int i = index;   while( !marked[i])  {       if( hm.containsKey( a - array[i]) && !marked[ hm.get( a - array[i])])   {    marked[i] = true ;    ans [i] = 0 ;           i = hm.get( a - array[i]);    marked[i] = true ;    ans [i] = 0 ;           if( hm.containsKey( b - array[i]) && !marked[ hm.get( b - array[i])])    {    i = hm.get( b - array[i]);    }    }      else   {    System.out.println("NO");    System.exit(0);   }    }   }  static void propagateB(int index) {   int i = index;   while( !marked[i])  {       if( hm.containsKey( b - array[i]) && !marked[ hm.get( b - array[i])])   {    marked[i] = true ;    ans [i] = 1 ;             i = hm.get( b - array[i]);    marked[i] = true ;    ans [i] = 1 ;           if( hm.containsKey( a - array[i]) && !marked[ hm.get( a - array[i])])    {    i = hm.get( a - array[i]);    }    }      else   {    System.out.println("NO");    System.exit(0);   }    }   }  static void start(int index) {    int i = index ;    while( !marked[i] )  {    if(!marked[ hm.get( a - array[i])])  {   marked[i] = true ;   ans [i] = 0 ;           i = hm.get( a - array[i]);   marked[i] = true ;   ans [i] = 0 ;        i = hm.get( b - array[i]);     }      } }  }
1	public class C_138B { private static BufferedReader in; private static StringTokenizer st; private static PrintWriter out;   static String nextToken() throws IOException {  while (!st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  static int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(nextToken()); } public static void main(String[] args) throws NumberFormatException, IOException {  in = new BufferedReader(new InputStreamReader(System.in));  st = new StringTokenizer("");  out = new PrintWriter(new OutputStreamWriter(System.out));  int n = nextInt();  int k = nextInt();  int [] a = new int [n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  Set<Integer> set = new HashSet<Integer>();  for (int i = 0; i < a.length; i++) {  set.add(a[i]);  if(set.size()==k){   Set<Integer> set2 = new HashSet<Integer>();   for (int j = i; j >= 0; j--) {   set2.add(a[j]);   if(set2.size()==k){    out.print((j+1)+" "+(i+1));    out.close();    return;   }   }  }  }  out.print("-1 -1");   out.close(); } }
3	public class p4 {    static int N, M, K;  static String s;  static StringTokenizer st;  static int[] d;  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));      int N = Integer.parseInt(br.readLine());   int[] d = new int[N];   st = new StringTokenizer(br.readLine());   for (int i = 0; i < N; i++) {    d[i] = Integer.parseInt(st.nextToken());   }   boolean cur = ((inv(d)) % 2) == 1;     int Q = Integer.parseInt(br.readLine());   for (int i = 0; i < Q; i++) {    st = new StringTokenizer(br.readLine());    int a = Integer.parseInt(st.nextToken());    int b = Integer.parseInt(st.nextToken());    int dif = b - a + 1;    if (dif / 2 % 2 == 1) {     cur = !cur;    }    System.out.println((cur) ? "odd" : "even");   }         }  static class BIT {   int[] tree;   int N;   public BIT(int N) {    this.N = N;    tree = new int[N + 1];   }   public BIT(int N, int[] d) {    this.N = N;    tree = new int[N + 1];    for (int i = 1; i < d.length; i++) {     update(i, d[i]);    }   }   public int query(int K) {    int sum = 0;    for (int i = K; i > 0; i -= (i & -i)) {     sum += tree[i];    }    return sum;   }   public void update(int K, int val) {    for (int i = K; i <= N; i += (i & -i)) {     tree[i] += val;    }   }  }  public static int[] toRel(int[] d) {   pair[] p = new pair[d.length];   for (int i = 0; i < d.length; i++) {    p[i] = new pair(d[i], i + 1);   }   Arrays.sort(p);   int[] fin = new int[d.length];   for (int i = 0; i < d.length; i++) {    fin[i] = p[i].b;   }   return fin;  }  public static int inv(int[] d) {   int ans = 0;   int N = d.length;   int[] x = toRel(d);   BIT b = new BIT(N + 1);   for (int i = N - 1; i >= 0; i--) {    ans += b.query(x[i]);    b.update(x[i], 1);   }   return ans;  } } class pair implements Comparable<pair> {  int a, b;  public pair(int _a, int _b) {   this.a = _a;   this.b = _b;  }  @Override  public int compareTo(pair t) {   return (a == t.a) ? b - t.b : a - t.a;  } }
0	public class Rules {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   double a = in.nextInt();   double v = in.nextInt();   double l = in.nextInt();   double d = in.nextInt();   double w = in.nextInt();   if (v <= w) {    double t = v / a;    if (0.5 * t * t * a > l) {     t = Math.sqrt(2 * l / a);    } else {     t += (l - 0.5 * t * t * a) / v;    }    System.out.printf("%.5f", t);   } else {    double total = 0.0;    double t = v / a;    double t2 = (v - w) / a;    double tempt = Math.sqrt(2.0 * d / a);    if (tempt * a <= w) {     total += tempt;     w = tempt*a;    } else if (0.5 * t * t * a +v*t2 - 0.5 * t2 * t2 * a > d) {     double as = 2.0*a;     double bs = 4.0*w;     double cs = ((w * w) / (a) - 2.0 * d );     double delta = bs * bs - 4.0 * as * cs;     double root = (-bs + Math.sqrt(delta)) / (2.0 * as);     if (root < 0.0) {      root = (-bs - Math.sqrt(delta)) / (2.0 * as);     }     total += (2.0 * root + w / a);    } else {     total += t + t2;     double smd = (d - 0.5 * t * t * a - v*t2 + 0.5 * t2 * t2 * a) / v;     total += smd;    }    double t3 = (v - w) / a;    if (w * t3 + 0.5 * t3 * t3 * a > l - d) {     double as = 0.5 * a;     double bs = w;     double cs = d - l;     double delta = bs * bs - 4.0 * as * cs;     double root = (-bs + Math.sqrt(delta)) / (2.0 * as);     if (root < 0.0) {      root = (-bs - Math.sqrt(delta)) / (2.0 * as);     }     total += root;    } else {     total += t3;     double t4 = (l - (w * t3 + 0.5 * t3 * t3 * a) - d) / v;     total += t4;    }    System.out.printf("%.5f", total);   }  } }
1	public class CF224B {   public static void main(String[] args) throws Exception {   new CF224B().solve();  }  private void solve() throws Exception {   Scanner sc = new Scanner(System.in);   int n = sc.nextInt();   int k = sc.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = sc.nextInt();   }   final int MAX_A = 100000;   int[] freq = new int[MAX_A+1];   int numDistinct = 0;   int r = -1;   for (int i = 0; i < n; i++) {    int t = a[i];    freq[t]++;    if (freq[t] == 1) {     numDistinct++;    }    if (numDistinct == k) {     r = i;     break;    }   }   if (r == -1) {    System.out.println("-1 -1");    return;   }   int l;   for (l = 0; l < r; l++) {    int t = a[l];    freq[t]--;    if (freq[t] == 0) {     break;    }   }   System.out.println((l+1) + " " + (r+1));  } }
6	public class Main {  private static int[] x = new int[26], y = new int[26], dp = new int[1<<24], pre = new int[1<<24];  private static int dis(int i, int j) {   return (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);  }  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   int x0 = in.nextInt(), y0 = in.nextInt(), n = in.nextInt();   for (int i = 0; i < n; i++) {    x[i] = in.nextInt();    y[i] = in.nextInt();   }   x[n] = x0;   y[n] = y0;   int[][] gra = new int[26][26];   for (int i = 0; i < n + 1; i++) {    for (int j = i+1; j < n+1; j++) {     gra[i][j] = gra[j][i] = dis(i,j);    }   }   Arrays.fill(dp, -1);   dp[0] = 0;   for (int i = 0; i < 1 << n; i++) {    if (dp[i] != -1) {     for (int j = 0; j < n; j++) {      if (((1<<j)&i) == 0) {       int t = i | (1<<j), tmp = dp[i] + 2*gra[j][n];       if (dp[t] == -1 || dp[t] > tmp) {        dp[t] = tmp;        pre[t] = i;       }       for (int k = 0; k < n; k++) {        if ((t&(1<<k)) == 0) {         int t2 = t | (1<<k), tmp2 = dp[i] + gra[n][j] + gra[j][k] + gra[k][n];         if (dp[t2] == -1 || dp[t2] > tmp2) {          dp[t2] = tmp2;          pre[t2] = i;         }        }       }       break;      }     }    }   }   int end = (1<<n)-1, cnt = 0;   int[] ans = new int[60];   System.out.println(dp[end]);   while (end != 0) {    int pr = pre[end];    int tem = pr^end;    int a = 0, b = 0;    for (int i = 0; i < n; i++) {     if (((1<<i)&tem)!=0) {      b=a;      a=i+1;     }    }    ans[cnt++] = 0;    ans[cnt++] = a;    if (b>0) {     ans[cnt++] = b;    }    end = pr;   }   ans[cnt++] = 0;   for (int i = cnt-1; i >= 0; i--) {    System.out.print(ans[i] + " ");   }   System.out.print("\n");  } }
3	public class D911{  void solve() {  int n = ni();  int[] a = ia(n);  int Q = ni();  String[] ans = {"even", "odd"};  int cur = merge(a, 0, n - 1) % 2;  while(Q-->0)  {  int l = ni(), r = ni();  cur ^= (r - l + 1) / 2 % 2;  out.println(ans[cur]);  }   }  int merge(int[] a, int l, int r) {  if(l >= r)  return 0;  int mid = l + r >> 1;  int v1 = merge(a, l, mid);  int v2 = merge(a, mid + 1, r);   int[] rep = new int[r-l+1];  int ptr0 = 0, ptr1 = l, ptr2 = mid + 1;   long len = mid-l+1;  int ret = 0;  while(ptr1<=mid && ptr2<=r)  {  if(a[ptr1] <= a[ptr2])  {   len--;   rep[ptr0++] = a[ptr1++];  }  else  {   ret += len;   rep[ptr0++] = a[ptr2++];   }  }   while(ptr1 <= mid)  rep[ptr0++] = a[ptr1++];  while(ptr2 <= r)  rep[ptr0++] = a[ptr2++];   for(int i=0;i<ptr0;i++)  a[l+i] = rep[i];   return v1 + v2 + ret; }  public static void main(String[] args){new D911().run();}  private byte[] bufferArray = new byte[1024]; private int bufLength = 0; private int bufCurrent = 0; InputStream inputStream; PrintWriter out;  public void run() {  inputStream = System.in;  out = new PrintWriter(System.out);  solve();  out.flush(); }  int nextByte() {  if(bufLength == -1)  throw new InputMismatchException();  if(bufCurrent >= bufLength)  {  bufCurrent = 0;  try  {bufLength = inputStream.read(bufferArray);}  catch(IOException e)  { throw new InputMismatchException();}  if(bufLength <= 0)   return -1;  }  return bufferArray[bufCurrent++]; }  boolean isSpaceChar(int x) {return (x < 33 || x > 126);}  boolean isDigit(int x) {return (x >= '0' && x <= '9');}  int nextNonSpace() {  int x;  while((x=nextByte()) != -1 && isSpaceChar(x));  return x; }  int ni() {  long ans = nl();  if (ans >= Integer.MIN_VALUE && ans <= Integer.MAX_VALUE)  return (int)ans;  throw new InputMismatchException(); }  long nl() {  long ans = 0;  boolean neg = false;  int x = nextNonSpace();  if(x == '-')  {  neg = true;  x = nextByte();  }  while(!isSpaceChar(x))  {  if(isDigit(x))  {   ans = ans * 10 + x -'0';   x = nextByte();  }  else   throw new InputMismatchException();  }  return neg ? -ans : ans; }  String ns() {  StringBuilder sb = new StringBuilder();  int x = nextNonSpace();  while(!isSpaceChar(x))  {  sb.append((char)x);  x = nextByte();  }  return sb.toString(); }  char nc() { return (char)nextNonSpace();}  double nd() { return (double)Double.parseDouble(ns()); }  char[] ca() { return ns().toCharArray();}  char[][] ca(int n) {  char[][] ans = new char[n][];  for(int i=0;i<n;i++)  ans[i] = ca();  return ans; }  int[] ia(int n) {  int[] ans = new int[n];  for(int i=0;i<n;i++)  ans[i] = ni();  return ans; }  void db(Object... o) {System.out.println(Arrays.deepToString(o));}  }
1	public class B {   public static void main(String[] args) throws Exception {  BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));   String[] parts = bf.readLine().trim().split("[ ]+");  int N = Integer.parseInt(parts[0]);  int K = Integer.parseInt(parts[1]);   int[] nums = new int[N];  int idx = 0;   String line = bf.readLine();  for(int i = 0; i < line.length(); i++) {  char c = line.charAt(i);  if(c == ' ') idx++;  else {   int d = c - '0';   nums[idx] = 10 * nums[idx] + d;  }  }   int from = -1, to = -1;  HashMap<Integer, Integer> count = new HashMap<Integer, Integer>();  for(int i = 0; i < N; i++) {  Integer q = count.get(nums[i]);    if(q == null) count.put(nums[i], 1);  else count.put(nums[i], q + 1);    if(count.size() == K) {   to = i;   break;  }  }   if(count.size() < K) {  System.out.println("-1 -1");  return;  }   for(from = 0; from <= to; from++) {  Integer q = count.get(nums[from]);    if(q == 1) count.remove(nums[from]);  else count.put(nums[from], q - 1);    if(count.size() < K) break;  }   System.out.println((from + 1) + " " + (to + 1));  } }
0	public class A {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  long l = s.nextLong();  long r = s.nextLong();  s.close();   if (r-l<2 || (r-l==2 && l%2==1)) {  System.out.print("-1");  return;  }   long beg = l%2==0 ? l : l+1;  if (beg+2>r) System.out.print("-1");  else System.out.print(beg+" "+(beg+1)+" "+(beg+2)); } }
0	public class A { FastScanner in; PrintWriter out;  public void run() {  try {  in = new FastScanner(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  out.close();  } catch (IOException e) {  e.printStackTrace();  } }  public void solve() throws IOException {  long l = new Long(in.next());  long r = new Long(in.next());  if (r - l < 2 || (r - l == 2 && l % 2 != 0)) {  out.println("-1");  } else {  if (l % 2 != 0) {   l++;  }  out.println(l);  out.println(l+1);  out.println(l+2);  } }  class FastScanner {  BufferedReader br;  StringTokenizer st;  FastScanner(InputStreamReader in) {  br = new BufferedReader(in);  }  String nextLine() {  String str = null;  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }   return str;  }  String next() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  } }  public static void main(String[] arg) {  A o = new A();  o.run(); } }
0	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, InputReader in, PrintWriter out) {   long l = in.nextLong();   long r = in.nextLong();   int max = (int) (r - l);   if (max >= 2) {    if ((l & 1) == 0) {     out.println(l + " " + (l + 1) + " " + (l + 2));     return;    } else {     if (max >= 3) {      out.println((l + 1) + " " + (l + 2) + " " + (l + 3));      return;     }    }   }   out.println(-1);  } } class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream), 32768);   tokenizer = null;   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   }   return tokenizer.nextToken();  }  public long nextLong() {   return Long.parseLong(next());  } }
1	public class Array224B { public static void main(String[] args) throws IOException {  BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken());  int[] array = new int[n];  int[] visited = new int[100002];  st = new StringTokenizer(f.readLine());  for(int i=0;i<n;i++){  array[i] = Integer.parseInt(st.nextToken());  }  int count = 0;  int begin = array[0];  while(count<n && array[count] == begin){  count++;  }  count--;  int kcount = 1;  visited[array[count]]++;  int bindex = count;  boolean good=true;  count++;  while(kcount<k){  if(count==n){   System.out.println("-1 -1");   good=false;   break;  }  if(visited[array[count]]==0){   kcount++;  }  visited[array[count]]++;  count++;  }  if(good&&k!=1){  for(int i=bindex;i<count;i++){  if(visited[array[i]]==1){   break;  }  bindex++;  visited[array[i]]--;  }  for(int i=count-1;i>bindex;i--){  if(visited[array[i]]==1){   break;  }  count--;  visited[array[i]]--;  }  }  if(k==1){  System.out.println("1 1");  }  else if(good){  System.out.println(bindex+1+" "+count);  } } }
6	public class BetaRound8_C implements Runnable {  BufferedReader in;  PrintWriter out;  StringTokenizer tok;  @Override  public void run() {   try {    long startTime = System.currentTimeMillis();    if (System.getProperty("ONLINE_JUDGE") != null) {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     in = new BufferedReader(new FileReader("input.txt"));     out = new PrintWriter("output.txt");    }    tok = new StringTokenizer("");    Locale.setDefault(Locale.US);    solve();    in.close();    out.close();    long endTime = System.currentTimeMillis();    long totalMemory = Runtime.getRuntime().totalMemory();    long freeMemory = Runtime.getRuntime().freeMemory();    System.err.println("Time = " + (endTime - startTime) + " ms");    System.err.println("Memory = " + ((totalMemory - freeMemory) / 1024) + " KB");   } catch (Throwable e) {    e.printStackTrace(System.err);    System.exit(-1);   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  void debug(Object... o) {   System.err.println(Arrays.deepToString(o));  }  public static void main(String[] args) {   new Thread(null, new BetaRound8_C(), "", 256 * 1024 * 1024).start();  }    final int INF = 1000 * 1000 * 1000;  int x0, y0;  int n;  int[] x, y;  int t(int i, int j) {   int dx = x[i] - x[j];   int dy = y[i] - y[j];   return dx * dx + dy * dy;  }  int t0(int i) {   int dx = x[i] - x0;   int dy = y[i] - y0;   return dx * dx + dy * dy;  }  int[] dp;  int[] p;  void solve() throws IOException {   x0 = readInt();   y0 = readInt();   n = readInt();   x = new int[n];   y = new int[n];   for (int i = 0; i < n; i++) {    x[i] = readInt();    y[i] = readInt();   }   dp = new int[1 << n];   p = new int[1 << n];   Arrays.fill(dp, INF);   dp[(1 << n) - 1] = 0;   get(0);   out.println(dp[0]);   printPath();  }  int get(int mask) {   if (dp[mask] != INF) {    return dp[mask];   }   int res = INF;   for (int i = 0; i < n; i++) {    if (((1 << i) & mask) == 0) {     int test = get(mask ^ (1 << i)) + 2 * t0(i);     if (res > test) {      res = test;      p[mask] = mask ^ (1 << i);     }     for (int j = i + 1; j < n; j++) {      if (((1 << j) & mask) == 0) {       test = get(mask ^ (1 << i) ^ (1 << j)) + t0(i)         + t(i, j) + t0(j);       if (res > test) {        res = test;        p[mask] = mask ^ (1 << i) ^ (1 << j);       }      }     }     break;    }   }   return dp[mask] = res;  }  void printPath() {   ArrayList<Integer> ans = new ArrayList<Integer>();   ans.add(0);   int mask = 0;   while (mask != (1 << n) - 1) {    for (int i = 0; i < n; i++) {     if (((mask ^ p[mask]) & (1 << i)) != 0) {      ans.add(i + 1);     }    }    mask = p[mask];    ans.add(0);   }   for (int x : ans) {    out.print(x + " ");   }  } }
5	public class TaskA {   public static void main(String[] args) {  Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  new TaskA().solve(in, out);  in.close();  out.close(); }  private void solve(Scanner in, PrintWriter out) {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int answer = 0;  int counter = k;  int[] a = new int[n];  for (int i = 0; i < n; ++i)  a[i] = in.nextInt();  Arrays.sort(a);  int[] b = Arrays.copyOf(a, a.length);  for (int i = 0; i < n; ++i)   a[i] = b[n - i - 1];  for (int i = 0; i < n; ++i) {  if (counter < m) {   counter += a[i] - 1;   ++answer;  } else   break;  }  if (counter < m)  out.println("-1");  else  out.println(answer); } }
4	public class C {   static public void main(String... args) throws Exception {    Foster sc = new Foster();   PrintWriter p = new PrintWriter(out);   int t = sc.nextInt();   while(t--!=0){    int n = sc.nextInt();    int a[] = sc.intArray(n);    ArrayList<ArrayList<Integer>> arr = new ArrayList<>();    for(int i = 0; i < n; i++){     ArrayList<Integer> temp = new ArrayList<>();     if(i-1 < 0){      temp.add(1);     }     else{      ArrayList<Integer> inner = arr.get(i-1);      int last = inner.get(inner.size()-1);      ArrayDeque<Integer> q = new ArrayDeque<>();      for(int j : inner){       q.addLast(j);      }           if(last+1 == a[i]){       q.pollLast();       q.addLast(a[i]);      }           else if(a[i]==1){       q.addLast(a[i]);      }           else{       while(!q.isEmpty() && a[i]-q.peekLast() != 1){        q.pollLast();       }       if(q.isEmpty()) q.addLast(a[i]);       else{        q.pollLast();        q.addLast(a[i]);       }      }           while(!q.isEmpty()){       temp.add(q.pollFirst());      }     }     arr.add(temp);    }        for(int i = 0; i < arr.size(); i++){     p.print(arr.get(i).get(0));     for(int j = 1; j < arr.get(i).size(); j++){      p.print("." + arr.get(i).get(j));     }     p.println();    }   }   p.close();  }   static long[] sort(long a[]){   ArrayList<Long> arr = new ArrayList<>();   for(long i : a){    arr.add(i);   }   Collections.sort(arr);   for(int i = 0; i < arr.size(); i++){    a[i] = arr.get(i);   }   return a;  }  static int[] sort(int a[]){   ArrayList<Integer> arr = new ArrayList<>();   for(int i : a){    arr.add(i);   }   Collections.sort(arr);     for(int i = 0; i < arr.size(); i++){    a[i] = arr.get(i);   }   return a;  }       static class Foster {   BufferedReader br = new BufferedReader(new InputStreamReader(in));   StringTokenizer st = new StringTokenizer("");   String next() {    while (!st.hasMoreTokens())     try {      st = new StringTokenizer(br.readLine());     }     catch (IOException e) {      e.printStackTrace();     }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   int[] intArray(int n) {         int arr[] = new int[n];    for(int i = 0; i < n; i++) {     arr[i] = nextInt();    }    return arr;   }   long[] longArray(int n) {        long arr[] = new long[n];    for(int i = 0; i < n; i++) {     arr[i] = nextLong();    }    return arr;   }   int[] getBits(int n) {         int a[] = new int[31];    for(int i = 0; i < 31; i++) {     if(((1<<i) & n) != 0)      a[i] = 1;    }    return a;   }   static long pow(long... a) {    long mod = Long.MAX_VALUE;    if(a.length == 3) mod = a[2];    long res = 1;    while(a[1] > 0) {     if((a[1] & 1) == 1)      res = (res * a[0]) % mod;     a[1] /= 2;     a[0] = (a[0] * a[0]) % mod;    }    return res;   }  } }
5	public class A { BufferedReader br; StringTokenizer st; PrintWriter out;  void solve() throws IOException {  int n = nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++) {  a[i] = nextInt();  }  int[] b = a.clone();  Arrays.sort(b);  int k = 0;  for (int i = 0; i < n; i++) {  if (a[i] != b[i]) {   k++;  }  }  if (k <= 2) {  out.println("YES");  } else {  out.println("NO");  } }  void run() {  try {       br = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   solve();   out.close();  } catch (IOException e) {  e.printStackTrace();  } }  public static void main(String[] args) {  new A().run(); }  public String nextToken() throws IOException {  while ((st == null) || (!st.hasMoreTokens()))  st = new StringTokenizer(br.readLine());  return st.nextToken(); }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); } }
2	public class CF817C { static long count(long x) {  return x < 10 ? x : count(x / 10) + x % 10; } static boolean check(long x, long s) {  return x - count(x) >= s; } public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  long n = Long.parseLong(st.nextToken());  long s = Long.parseLong(st.nextToken());  int d = 9 * 18;  long cnt;  if (n >= s + d) {  cnt = n - s - d;  for (long x = s; x <= s + d; x++)   if (check(x, s))   cnt++;  } else {  cnt = 0;  for (long x = s; x <= n; x++)   if (check(x, s))   cnt++;  }  System.out.println(cnt); } }
4	public class Main {  static FastReader in;  static PrintWriter out;  static Random rand = new Random();  static final int oo = (int) 1e9 + 10;  static final long OO = (long) 1e18 + 10;  static final int MOD = (int) 1e9 + 7;   static void solve() {   int n = in.nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = in.nextInt();   }   Stack<Integer> st = new Stack<>();   for (int i = 0; i < n; i++) {    if (a[i] != 1) {     while (!st.empty() && st.peek() + 1 != a[i])      st.pop();     st.pop();    }    st.push(a[i]);    for (int j = 0; j < st.size(); j++) {     out.print(st.get(j));     if (j < st.size() - 1)      out.print('.');    }    out.println();   }  }  public static void main(String[] args) {   in = new FastReader();   out = new PrintWriter(System.out);   int t = 1;   t = in.nextInt();   while (t-- > 0) {    solve();   }   out.flush();   out.close();  }  static class FastReader {   BufferedReader br;   StringTokenizer st;   FastReader() {    this(System.in);   }   FastReader(String file) throws FileNotFoundException {    this(new FileInputStream(file));   }   FastReader(InputStream is) {    br = new BufferedReader(new InputStreamReader(is));   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String next() {    while (st == null || !st.hasMoreTokens()) {     st = new StringTokenizer(nextLine());    }    return st.nextToken();   }   String nextLine() {    String line;    try {     line = br.readLine();    } catch (IOException e) {     throw new RuntimeException(e);    }    return line;   }  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt(), k = in.nextInt();   int[] a = IOUtils.readIntArray(in, n);   Set<Integer> cnt = new HashSet<Integer>();   int i = 0;   while (i < n && cnt.size() < k) {    cnt.add(a[i]);    if (cnt.size() < k)     ++i;   }   if (cnt.size() < k)    out.print("-1 -1");   else {    int r = i;    cnt = new HashSet<Integer>();    while (i >= 0 && cnt.size() < k) {     cnt.add(a[i]);     if (cnt.size() < k) --i;    }    out.print(i + 1, r + 1);   }  } } class InputReader {  BufferedReader br;  StringTokenizer st;  public InputReader(File f) {   try {    br = new BufferedReader(new FileReader(f));   } catch (FileNotFoundException e) {    e.printStackTrace();   }  }  public InputReader(InputStream f) {   br = new BufferedReader(new InputStreamReader(f));  }  public String next() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (IOException e) {     e.printStackTrace();    }   }   return st.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object... objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.print(objects[i]);   }  }  public void close() {   writer.close();  } } class IOUtils {  public static int[] readIntArray(InputReader in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.nextInt();   return array;  }  }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastInput in = new FastInput(inputStream);   FastOutput out = new FastOutput(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, FastInput in, FastOutput out) {    long n = in.nextLong();    long s = in.nextLong();    long cnt = 0;    long res = 0;    for (long i = s; i <= Math.min(s + 200, n); i++) {     long d = i;     int sum = 0;     while (d > 0) {      long l = d % 10;      sum += l;      d /= 10;     }     if ((i - sum) >= s) {      cnt++;     }    }    long tmp = n - Math.min(n, s + 200);    if (tmp < 0) tmp = 0;    cnt += tmp;    out.println(cnt);    }  }  static class FastInput {   private InputStream stream;   private byte[] buf = new byte[1024];   private int curChar;   private int numChars;   private FastInput.SpaceCharFilter filter;   public FastInput(InputStream stream) {    this.stream = stream;   }   public int read() {    if (numChars == -1) {     throw new InputMismatchException();    }    if (curChar >= numChars) {     curChar = 0;     try {      numChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public long nextLong() {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    int sgn = 1;    if (c == '-') {     sgn = -1;     c = read();    }    long res = 0;    do {     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return res * sgn;   }   public boolean isSpaceChar(int c) {    if (filter != null) {     return filter.isSpaceChar(c);    }    return isWhitespace(c);   }   public static boolean isWhitespace(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }   public interface SpaceCharFilter {    public boolean isSpaceChar(int ch);   }  }  static class FastOutput {   private final PrintWriter writer;   public FastOutput(OutputStream outputStream) {    writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));   }   public FastOutput(Writer writer) {    this.writer = new PrintWriter(writer);   }   public void close() {    writer.close();   }   public void println(long i) {    writer.println(i);   }  } }
1	public class Problem17A implements Runnable {  void solve() throws NumberFormatException, IOException {          int n = nextInt();   int k = nextInt();   ArrayList<Integer> primes = new ArrayList<Integer>(n + 1);   boolean[] simplePrime = new boolean[n + 1];   Arrays.fill(simplePrime, 0, simplePrime.length, true);   simplePrime[0] = simplePrime[1] = false;     for (int i = 2; i <= n; i++) {    if (simplePrime[i]) {     for (int j = i + i; j <= n; j += i) {      simplePrime[j] = false;     }         primes.add(i);    }   }        int actualK = 0;   for (int i = 1; i < primes.size(); i++) {    int val = primes.get(i - 1) + primes.get(i) + 1;    if (val <= n) {     if (simplePrime[val]) {           actualK++;     }    } else {     break;    }   }     System.out.println((k <= actualK ? "YES" : "NO"));  }    StringTokenizer st;  BufferedReader in;  PrintWriter out;   public static void main(String[] args) {   new Problem17A().run();  }  public void run() {   try {    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);    solve();   } catch (Exception e) {    e.printStackTrace();   } finally {    out.flush();    out.close();   }  }  String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextToken());  } }
1	public class Solution implements Runnable {  public static void main(String[] args) {  (new Thread(new Solution())).start(); }  BufferedReader in; PrintWriter out; StringTokenizer st;  String nextToken() throws IOException {  while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine());  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  void solve() throws Exception {  boolean[] r = new boolean[1010];  Arrays.fill(r, true);  r[0] = r[1] = false;  for (int i = 2; i < 1010; i++) {  if (r[i]) {   for (int j = i + i; j < 1010; j += i) {   r[j] = false;   }  }  }  int[] pr = new int[1010];  int l = 0;  for (int i = 2; i < 1010; i++) if (r[i]) pr[l++] = i;  int n = nextInt();  int k = nextInt();  int ans = 0;  int j = 0;  for (int i = 2; i <= n; i++) {  if (r[i]) {  for (; j < l - 1; j++) {   if (i == pr[j] + pr[j + 1] + 1) {   ans++;   break;   }   if (i < pr[j] + pr[j + 1] + 1) break;  }  }  }  if (ans >= k) out.println("YES"); else out.println("NO"); }  public void run() {  try {  Locale.setDefault(Locale.US);  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  } catch (Exception e) {  e.printStackTrace();  }  out.flush(); } }
2	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   Scanner in = new Scanner(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskC solver = new TaskC();   solver.solve(1, in, out);   out.close();  }  static class TaskC {   public void solve(int testNumber, Scanner in, PrintWriter out) {    long n = in.nextLong();    long s = in.nextLong();    long ans = 0;    long i = 0;    for (i = s; i <= n; i++) {     long t = i - sum(i);     if (t >= s) {      if (i % 10 == 9) {       break;      }      ans++;     }    }    if (n >= s) {     out.println(ans - i + n + 1);    } else {     out.println(0);    }   }   static long sum(long a) {    long sum = 0;    while (a != 0) {     sum += (a % 10);     a /= 10;    }    return sum;   }  } }
0	public class A {  public static void main(String[] args) {   InputScanner scanner = new InputScanner();   try {    long l = scanner.nextLong();    long r = scanner.nextLong();    if ((r - l) < 2) {     System.out.println("-1");     return;    }    if (l % 2 == 0) {     long a = l;     long b = l + 1;     long c = l + 2;     System.out.println(a + " " + b + " " + c);    } else if (r%2==0){     long a = r;     long b = r-1;     long c = r-2;     System.out.println(c + " " + b + " " + a);    } else {     l++;     if ((r - l) < 2) {      System.out.println("-1");      return;     }     long a = l;     long b = l + 1;     long c = l + 2;     System.out.println(a + " " + b + " " + c);    }   } catch (IOException e) {   }   }  static class InputScanner {   BufferedReader br;   StringTokenizer st;   public InputScanner() {    br = new BufferedReader(new InputStreamReader(System.in));   }   public String next() throws IOException {    if (st == null || !st.hasMoreTokens()) {     String line = br.readLine();     st = new StringTokenizer(line);    }    return st.nextToken();   }   public int nextInt() throws IOException {    String next = next();    next.length();    return Integer.parseInt(next);   }   public long nextLong() throws IOException {    String next = next();    next.length();    return Long.parseLong(next);   }  } }
6	public class Order implements Runnable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); private int xs, ys, n; private int[] x, y;  public static void main(String[] args) {  new Thread(new Order()).start(); }  private void read() {  xs = in.nextInt();  ys = in.nextInt();  n = in.nextInt();  x = new int[n];  y = new int[n];  for (int i = 0; i < n; i++) {  x[i] = in.nextInt();  y[i] = in.nextInt();  } }  private void solve() {  int[] res = new int[1 << n];  int[] last = new int[1 << n];  Arrays.fill(res, Integer.MAX_VALUE);  int[] ds = new int[n];  for (int i = 0; i < n; i++) {  ds[i] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys);  }  int[][] d = new int[n][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++)   d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);  }  res[0] = 0;  for (int i = 1; i < (1 << n); i++) {  for (int j = 0; j < n; j++) {   if (((i >> j) & 1) != 0) {   if (res[i - (1 << j)] + 2 * ds[j] < res[i]) {    res[i] = res[i - (1 << j)] + 2 * ds[j];    last[i] = i - (1 << j);   }   for (int k = j + 1; k < n; k++) {    if (((i >> k) & 1) != 0) {    if (res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k] < res[i]) {     res[i] = res[i - (1 << j) - (1 << k)] + ds[j] + ds[k] + d[j][k];     last[i] = i - (1 << j) - (1 << k);    }    }   }   break;   }  }  }  int cur = (1 << n) - 1;  out.println(res[cur]);  while (cur != 0) {  out.print("0 ");  int dif = cur - last[cur];  for (int i = 0; i < n && dif != 0; i++) {   if (((dif >> i) & 1) != 0) {   out.print((i + 1) + " ");   dif -= (1 << i);   }  }  cur = last[cur];  }  out.println("0"); }  private void write() { }  public void run() {  read();  solve();  write();  out.close(); } }
5	public class CF220A {  public static void main(String[] args) throws Exception {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(in.readLine());   StringTokenizer st = new StringTokenizer(in.readLine());   int[] A = new int[n];   Integer[] B = new Integer[n];   for(int i=0; i<n; i++) {    A[i] = Integer.parseInt(st.nextToken());    B[i] = A[i];   }   Collections.sort(Arrays.asList(B));   int cnt = 0;   for(int i=0; i<n; i++)    if(A[i] != B[i])     cnt++;   System.out.println(cnt <= 2 ? "YES" : "NO");  } }
3	public class Main {   public static void main(String[] args) throws IOException {   Reader.init(System.in);   int n = Reader.nextInt();   int[] arr = new int[n];   int initial = 0;   for (int i = 0; i < n; i++) arr[i] = Reader.nextInt();   for (int i = 0; i < arr.length; i++) {    for (int j = i + 1; j < arr.length; j++) if (arr[i] > arr[j]) initial++;   }   int m = Reader.nextInt();   boolean parity = initial % 2 == 0;   for (int i = 0; i < m; i++) {    int l = Reader.nextInt();    int r = Reader.nextInt();    int elems = r - l + 1;    boolean change = (elems/2) % 2 == 0;    parity = parity == change;    System.out.println(parity ? "even": "odd");   }  } }  class Reader{  private static BufferedReader reader;  private static StringTokenizer tokenizer;  static void init(InputStream inputStream){   reader = new BufferedReader(new InputStreamReader(inputStream));   tokenizer = new StringTokenizer("");  }  static String next() throws IOException {   String read;   while (!tokenizer.hasMoreTokens()){    read = reader.readLine();    if (read == null || read.equals(""))     return "-1";    tokenizer = new StringTokenizer(read);   }   return tokenizer.nextToken();  }  static int nextInt() throws IOException{   return Integer.parseInt(next());  }       }
6	public class Main {  BufferedReader in = null;  PrintWriter out = null;  int dist(int x1, int y1, int x2, int y2) {   int dx = Math.abs(x1 - x2);   int dy = Math.abs(y1 - y2);   return dx * dx + dy * dy;  }  boolean testBit(int use, int p) {   return ((use >> p) & 1) == 1;  }  int rec(int use, int a[][], int dp[], int next[]) {   if (dp[use] != -1) {    return dp[use];   }   if (use == 0) {    return dp[use] = 0;   }   int n = a.length;   int ix = -1;     for (int i = 0; i < n; ++i) {    if (testBit(use, i)) {     if (ix == -1) {      ix = i;      break;     }         }   }   int r = rec(use ^ (1 << ix), a, dp, next) + a[ix][ix];   next[use] = use ^ (1 << ix);      for (int i = ix + 1; i < n; ++i) {    if (!testBit(use, i)) {     continue;    }    int t = rec(use ^ (1 << ix) ^ (1 << i), a, dp, next);    t += a[ix][i];    if (t < r) {     r = t;     next[use] = use ^ (1 << ix) ^ (1 << i);    }   }   return dp[use] = r;  }  void print(int use1, int use2, int n) {   for (int i = 0; i < n; ++i) {    if (testBit(use1, i) ^ testBit(use2, i)) {     int x = i + 1;     out.print(x + " ");    }   }  }  void solve() throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);     StringTokenizer st;   st = new StringTokenizer(in.readLine());   int sx = Integer.valueOf(st.nextToken());   int sy = Integer.valueOf(st.nextToken());   st = new StringTokenizer(in.readLine());   int n = Integer.valueOf(st.nextToken());   int x[] = new int[n];   int y[] = new int[n];   for (int i = 0; i < n; ++i) {    st = new StringTokenizer(in.readLine());    x[i] = Integer.valueOf(st.nextToken());    y[i] = Integer.valueOf(st.nextToken());   }   int a[][] = new int[n][n];   for (int i = 0; i < n; ++i) {    for (int j = 0; j < n; ++j) {     a[i][j] = dist(x[i], y[i], sx, sy) + dist(x[j], y[j], sx, sy) + dist(x[i], y[i], x[j], y[j]);    }   }   int dp[] = new int[1 << n];   Arrays.fill(dp, -1);   int next[] = new int[1 << n];   int ans = rec((1 << n) - 1, a, dp, next);   out.println(ans);   int use = (1 << n) - 1;   while (true) {    int nuse = next[use];    out.print("0 ");    print(use, nuse, n);    if (nuse == 0) break;    use = nuse;   }   out.println("0");     in.close();   out.close();  }   public static void main(String[] args) throws IOException {   new Main().solve();  } }
1	public class B {   public static void main(String[] args) throws IOException {  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken());  st = new StringTokenizer(br.readLine());  int[] a = new int[n];  for(int i = 0 ; i <n;i++)  a[i] = Integer.parseInt(st.nextToken());   int l = 0, r = 0;  int[] t = new int[100001];  int kk = 0;  int min = 1 << 25 , ll =-1 , rr = -1;  while(r < n)  {  int x = a[r++];  t[x]++;  if(t[x] == 1)   kk++;  while(r < n && kk < k)  {   x = a[r++];   t[x]++;   if(t[x] == 1)   kk++;  }  while(kk == k && l < r)  {   x = a[l];   if(t[x] == 1)   break;   t[x]--;   l++;  }  if(kk == k)  {   int m = r-l+1;   if(m < min)   {   ll = l+1;   rr = r;   min = m;   }  }  }  System.out.println(ll +" "+rr); } }
0	public class Main {  public static void main(String args[]) throws IOException {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String x[]=br.readLine().split(" ");  long l=Long.parseLong(x[0]);  long r=Long.parseLong(x[1]);  if(l%2!=0)  {  l++;  }  if(l+2>r)  {  System.out.println("-1");  }  else  {  System.out.println(l+" "+(l+1)+" "+(l+2));  } } }
2	public class CodeforcesC {  public static void main(String[] args) {  Scanner ob = new Scanner(System.in);  long n = ob.nextLong();  long s = ob.nextLong();  long l = 1;  long r = n;  while(l<=r){  long mid = (l + r)/2;  if(reallybignumber(mid,s)){   r = mid-1;  }else{   l = mid +1;  }  }   System.out.println(n-l+1);  }  private static boolean reallybignumber(long n,long s) {  long m = n;  long sum=0;  int d=1;  while(m>0){  long rem = m % 10;  sum = rem * d + sum;  m = m / 10;  }  if(n-sum >= s) return true;  else return false; } }
1	public class Main {       static final double eps = 1e-8;       public static void main(String[] args) throws IOException {     try {            int n = nextInt();       int k = nextInt();       int[] a = new int[n];       int[] d = new int[n];       int[] dr = new int[n];       boolean used[] = new boolean[100001];       a[0] = nextInt();       used[ a[0] ] = true;       d[0] = 1;       for(int i = 1; i < n; i++)       {        a[i] = nextInt();        if(!used[ a[i] ])        {         used[ a[i] ] = true;         d[i] = d[i - 1] + 1;        }        else        {         d[i] = d[i - 1];        }       }       Arrays.fill(used, false);              int r = Arrays.binarySearch(d, k);             if(r < 0)       {        pw.println("-1 -1");        return;       }         while( r > 0 && d[r] == d[r - 1] )        r--;             used[ a[r] ] = true;       dr[r] = 1;       for(int i = r - 1; i >= 0; i--)       {        if(!used[ a[i] ])        {         used[ a[i] ] = true;         dr[i] = dr[i + 1] + 1;        }        else        {         dr[i] = dr[i + 1];        }       }                      int l = 0;         while(l < n - 1 && dr[l] == dr[l + 1] && r - l >= k)        l++;                    pw.println(l + 1 + " " + (r + 1));     }     finally {      pw.close();     }    }         static Scanner sc = new Scanner(System.in);    static PrintWriter pw = new PrintWriter(System.out);    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));    static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));    static StringTokenizer st ;    static int nextInt() throws IOException {     in.nextToken();     return (int) in.nval;    }    static long nextLong() throws IOException {     in.nextToken();     return (long) in.nval;    }    static double nextDouble() throws IOException {     in.nextToken();     return in.nval;    }    static String next() throws IOException {     in.nextToken();     return in.sval;    }    static void outArray(int[] O) {     for(int i = 0; i < O.length - 1; i++)      pw.print(O[i] + " ");     pw.println(O[O.length - 1]);    }   }
2	public class ReallyBigNumbers { public static void main(String[] args) {  @SuppressWarnings("resource")  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();  long bigNums = 0;  long inARow = 0;  for (long i = s; i <= n; i++) {  if (inARow == 9) {   bigNums += (n - i+1);   break;  } else {   if (i >= s + digitSum(i)) {   bigNums++;   inARow++;   } else {   inARow = 0;   }  }  }  System.out.println(bigNums); }  public static long digitSum(long a) {  long sum = a % 10;  if (9 < a) {  a /= 10;  sum += digitSum(a);  }  return sum; } }
6	public class Main implements Runnable {      private int n;  private int nn;  private int[][] D;  private int[] dp;  private int[] prev;  private void solve() throws Throwable {   int xs = nextInt(), ys = nextInt();   n = nextInt();   int[][] pts = new int[n][2];   for (int i = 0; i < n; i++) {    pts[i][0] = nextInt();    pts[i][1] = nextInt();   }   D = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) {      D[i][i] = 2 * (sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys));     } else {      D[i][j] = sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys)        + sqr(pts[i][0] - pts[j][0])        + sqr(pts[i][1] - pts[j][1]) + sqr(pts[j][0] - xs)        + sqr(pts[j][1] - ys);     }    }   }   nn = 1 << n;   dp = new int[nn];   prev = new int[nn];   Arrays.fill(dp, -1);   Arrays.fill(prev, -1);   dp[0] = 0;   Dp(nn - 1);   pw.println(dp[nn - 1]);   pw.print(0);   for (int p = nn - 1; p != -1 && prev[p] != -1; p = prev[p]) {    int vv = p ^ prev[p];    for (int j = 0; j < n; j++) {     int jj = 1 << j;     if ((vv & jj) == 0) continue;     pw.print(' ');     pw.print(j + 1);    }    pw.print(" 0");   }   pw.println();  }  private int Dp(int i) {   if (dp[i] != -1) return dp[i];   int ans = 107374182, p = -1;   int j1 = 1, pos1 = 0;   for (; pos1 < n && j1 < nn; j1 *= 2, pos1++) {    if ((i & j1) == 0) continue;    int a = D[pos1][pos1] + Dp(i ^ j1);    if (a < ans) {     ans = a;     p = i ^ j1;    }    int j2 = j1 * 2, pos2 = pos1 + 1;    for (; pos2 < n && j2 < nn; j2 *= 2, pos2++) {     if ((i & j2) == 0) continue;     a = D[pos1][pos2] + Dp(i ^ (j1 | j2));     if (a < ans) {      ans = a;      p = i ^ (j1 | j2);     }    }    break;   }     dp[i] = ans;   prev[i] = p;   return ans;  }  private int sqr(int i) {   return i * i;  }      PrintWriter pw;  BufferedReader in;  StringTokenizer st;  void initStreams() throws FileNotFoundException {     in = new BufferedReader(new InputStreamReader(System.in));   pw = new PrintWriter(System.out);  }  String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextString());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  }  static Throwable sError;  public static void main(String[] args) throws Throwable {    new Main().run();   if (sError instanceof OutOfMemoryError) {    throw sError;   }   }  public void run() {   try {    initStreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  } }
6	public class C { public static void main(String[] args) {  new C().run(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  boolean eof;  String buf;  public FastScanner(String fileName) throws FileNotFoundException {  br = new BufferedReader(new FileReader(fileName));  nextToken();  }  public FastScanner(InputStream stream) {  br = new BufferedReader(new InputStreamReader(stream));  nextToken();  }  String nextToken() {  while (st == null || !st.hasMoreTokens()) {   try {   st = new StringTokenizer(br.readLine());   } catch (Exception e) {   eof = true;   break;   }  }  String ret = buf;  buf = eof ? "-1" : st.nextToken();  return ret;  }  int nextInt() {  return Integer.parseInt(nextToken());  }  long nextLong() {  return Long.parseLong(nextToken());  }  double nextDouble() {  return Double.parseDouble(nextToken());  }  void close() {  try {   br.close();  } catch (Exception e) {   }  }  boolean isEOF() {  return eof;  } }  FastScanner sc; PrintWriter out;  public void run() {  Locale.setDefault(Locale.US);  try {  sc = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  sc.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  System.exit(1);  } }  long nextLong() {  return sc.nextLong(); }  double nextDouble() {  return sc.nextDouble(); }  int nextInt() {  return sc.nextInt(); }  String nextToken() {  return sc.nextToken(); }  static class Point {  int x, y;  public Point(int x, int y) {  super();  this.x = x;  this.y = y;  }  int dist(Point p) {  return (x - p.x) * (x - p.x) + (y - p.y) * (y - p.y);  } }  void solve() {  Point p0 = new Point(nextInt(), nextInt());  int n = nextInt();  Point[] p = new Point[n];  for (int i = 0; i < n; i++) {  p[i] = new Point(nextInt(), nextInt());  }  int[][] d = new int[n][n];  for (int i = 0; i < n; i++) {  for (int j = 0; j < n; j++) {   d[i][j] = p[i].dist(p[j]);  }  }  int[] d0 = new int[n];  for (int i = 0; i < n; i++) {  d0[i] = p0.dist(p[i]);  }  int[] dp = new int[1 << n];  Arrays.fill(dp, 1 << 30);  dp[0] = 0;  int[] from = new int[1 << n];  for (int i = 0; i + 1 < 1 << n; i++) {  int j = Integer.numberOfTrailingZeros(Integer.lowestOneBit(~i));  int cnt = dp[i] + 2 * d0[j];  if (dp[i ^ (1 << j)] > cnt) {   dp[i ^ (1 << j)] = cnt;   from[i ^ (1 << j)] = i;  }  for (int k = j + 1; k < n; k++) {   if (((i >> k) & 1) == 0) {   cnt = dp[i] + d0[j] + d0[k] + d[j][k];   if (dp[i ^ (1 << j) ^ (1 << k)] > cnt) {    dp[i ^ (1 << j) ^ (1 << k)] = cnt;    from[i ^ (1 << j) ^ (1 << k)] = i;   }   }  }  }  ArrayList<Integer> ans = new ArrayList<Integer>();  ans.add(0);  int mask = (1 << n) - 1;  while (mask > 0) {  int xor = mask ^ from[mask];  while (xor > 0) {   ans.add(Integer    .numberOfTrailingZeros(Integer.lowestOneBit(xor)) + 1);   xor = xor & (xor - 1);  }  ans.add(0);  mask = from[mask];  }  out.println(dp[(1 << n) - 1]);  for (int i : ans) {  out.print(i + " ");  } } }
3	public class A{ InputStream is; PrintWriter out; String INPUT = "";  public void solve(){  int n=ni();  int ans=0;  int[] arr=na(n);  for(int i=0;i<n;i++){  for(int j=i+1; j<n; j++){   if(arr[i] > arr[j]){   ans^=1;   }  }  }  int m=ni();  while(m-->0){  int a=ni(), b=ni();  int diff=Math.abs(a-b)+1;  ans = ans ^ ((((diff-1)*diff)/2)%2);  out.println(ans==0 ? "even" : "odd");  } }  void print(int n, long[][] memo){  for(int i=0;i<n;i++){  for(int j=0;j<n;j++){   out.print(memo[i][j]+" ");  }  out.println();  } }  void run(){  is = new DataInputStream(System.in);  out = new PrintWriter(System.out);  int t=1;while(t-->0)solve();  out.flush(); } public static void main(String[] args)throws Exception{new A().run();}  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0; private int readByte(){  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; } private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; } private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); } private String ns(){  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); } private char[] ns(int n){  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); } private char[][] nm(int n, int m){  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; } private int[] na(int n){  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; } private int ni(){  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } private long nl(){  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } } static int i(long x){return (int)Math.round(x);} static class Pair implements Comparable<Pair>{  long fs,sc;  Pair(long a,long b){  fs=a;sc=b;  }  public int compareTo(Pair p){  if(this.fs>p.fs)return 1;  else if(this.fs<p.fs)return -1;  else{   return i(this.sc-p.sc);  }    }  public String toString(){  return "("+fs+","+sc+")";  }  }  }
3	public class Main {  public static void main(String[] args) {   Scanner scanner = new Scanner(System.in);   int n = scanner.nextInt();   int[] arr = new int[n];   int chet = 0;   for (int i = 0; i < n; i++) {    arr[i]=scanner.nextInt();    for (int j = 0; j < i; j++) {     if (arr[j]>arr[i]) chet^=1;    }   }   n = scanner.nextInt();   for (int i = 0; i < n; i++) {    int l = scanner.nextInt();    int r = scanner.nextInt();    if ((((r-l+1)/2)&1)!=0){     chet^=1;    }    if (chet==1){     System.out.println("odd");    }else{     System.out.println("even");    }   }  }  }
0	public final class b1 {  public static void main(String[] args) {  Scanner datain = new Scanner(System.in);  long l=datain.nextLong();  long r=datain.nextLong();  if(r-l<2){System.out.print(-1);}else{  if(((r-l)==2)&&(l%2==1)){System.out.print(-1);}else{   if((l%2)==0){System.out.print(""+l+" "+(l+1)+" "+(l+2));}else{   System.out.print(""+(l+1)+" "+(l+2)+" "+(l+3));   }  }  } } }
5	public class A {  void run() throws IOException {   int n = ni();   int m = ni();   int k = ni();   int[] a = new int[n];   for (int i = 0; i < n; i++)    a[i] = ni() - 1;   Arrays.sort(a);   int ans = 0;   if (m > k) {    m -= k - 1;    for (int i = n - 1; i >= 0; i--) {     ans++;     m -= a[i];       if (m < 2)      break;    }    if (m > 1)     ans = -1;   }   pw.print(ans);  }  String next() throws IOException {   while (st == null || !st.hasMoreTokens())    st = new StringTokenizer(br.readLine());   return st.nextToken();  }  int ni() throws IOException {   return Integer.parseInt(next());  }  String nl() throws IOException {   return br.readLine();  }  PrintWriter pw;  BufferedReader br;  StringTokenizer st;  public static void main(String[] args) throws IOException {   long timeout = System.currentTimeMillis();   boolean CF = System.getProperty("ONLINE_JUDGE") != null;   PrintWriter _pw = new PrintWriter(System.out);   BufferedReader _br = new BufferedReader(CF ? new InputStreamReader(System.in) : new FileReader(new File("in.txt")));   new A(_br, _pw).run();   if (!CF) {    _pw.println();    _pw.println(System.currentTimeMillis() - timeout);   }   _br.close();   _pw.close();  }  public A(BufferedReader _br, PrintWriter _pw) {   br = _br;   pw = _pw;  } }
0	public class K603 {  public static void main(String[] args) {   Scanner sc=new Scanner(System.in);     long a=sc.nextLong();   long b=sc.nextLong();     if(b-a<2){    System.out.println(-1);   }else if(b-a==2 && a%2==1){    System.out.println(-1);   }else if(b-a==2 && a%2==0){    System.out.println(a+" "+(a+1)+" "+(a+2));   }else{    if(a%2==0){     System.out.println(a+" "+(a+1)+" "+(a+2));    }else{     System.out.println((a+1)+" "+(a+2)+" "+(a+3));    }   }  } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   final int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   final int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   final int[] best = new int[1 << n];   final int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    int bestC = best[set ^ (1 << i)] + single[i];    int prevC = 1 << i;    int nextSet = set ^ (1 << i);    int unoI = 1 << i;    int msc = set >> (i + 1);    for (int j = i + 1, unoJ = 1 << (i + 1); msc != 0 && j < n; ++j, unoJ <<= 1, msc >>= 1)     if ((msc & 1) != 0) {      int cur = best[nextSet ^ unoJ] + pair[i][j];      if (cur < bestC) {       bestC = cur;       prevC = unoI | unoJ;      }     }    best[set] = bestC;    prev[set] = prevC;   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
1	public class A {  static StreamTokenizer in =  new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  static int nextInt() throws IOException{  in.nextToken();  return (int)in.nval; }  static PrintWriter out = new PrintWriter(System.out);  static boolean prime(int n){  int j = 2;  while (j*j <= n)  if (n%j == 0) return false;  else j++;   return true; }  public static void main(String[] args) throws IOException{  int n = nextInt(),  k = nextInt(),  a[] = new int[n];  int s = 0;  for (int i=2; i<=n; i++)  if (prime(i))   a[s++] = i;   int m = 0;  for (int i=2; i<s; i++)  for (int j=i-1; j>0; j--)   if (a[i] == a[j]+a[j-1]+1){   m++;   break;   }   if (m >= k) out.println("YES");  else out.println("NO");  out.flush(); } }
0	public class Main {  public static class pair implements Comparable<pair> {  int a;  int b;  public pair(int pa, int pb)  {  a = pa; b= pb;  }  @Override  public int compareTo(pair o) {  if(this.a < o.a)   return -1;  if(this.a > o.a)   return 1;  return Integer.compare(o.b, this.b);  } }       public static void main (String[] args) throws Exception {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] spl = in.readLine().split(" ");  long l = Long.parseLong(spl[0]);  long r = Long.parseLong(spl[1]);  if(l+2 <= r && l%2==0)  {  System.out.println(l+" "+(l+1)+" "+(l+2));  }  else if(l+3<=r && (l+1)%2==0)  {  System.out.println((l+1)+" "+(l+2)+" "+(l+3));  }  else System.out.println(-1); } }
4	public class C { private static PrintWriter out = new PrintWriter(System.out);  public static void solve() {  In in = new In();  int tests = in.ni();  while (tests-- > 0) {  int n = in.ni();  int[] a = in.nia(n);  Stack<Integer> st = new Stack<>();  StringBuilder sb = new StringBuilder();  for (int num : a) {   if (st.isEmpty()) {   st.push(num);   sb.append(num);   } else {      if (num == st.peek() + 1) {    st.pop();    st.push(num);    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {    sb.deleteCharAt(sb.length() - 1);    }    sb.append(num);   }       else if (num == 1) {    st.push(num);    sb.append(".");    sb.append(num);   }       else {       while (!st.isEmpty() && st.peek() + 1 != num) {    st.pop();    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {     sb.deleteCharAt(sb.length() - 1);    }    if (sb.length() > 0)     sb.deleteCharAt(sb.length() - 1);    }        if (!st.isEmpty() && st.peek() + 1 == num) {    st.pop();    st.add(num);    while (sb.length() > 0 && sb.charAt(sb.length() - 1) != '.') {     sb.deleteCharAt(sb.length() - 1);    }    sb.append(num);    }   }   }   out.println(sb);  }  } }  public static void main(String[] args) throws IOException {   solve();     out.flush(); }  @SuppressWarnings("unused") private static class In {  final private static int BUFFER_SIZE = 1024;  private byte[] buf;  private InputStream is;  private int buflen;  private int bufptr;  public In() {  is = System.in;  buf = new byte[BUFFER_SIZE];  buflen = bufptr = 0;  }  public In(String input) {  is = new ByteArrayInputStream(input.getBytes());  buf = new byte[BUFFER_SIZE];  buflen = bufptr = 0;  }  public int readByte() {  if (bufptr >= buflen) {   try {   buflen = is.read(buf);   } catch (IOException ioe) {   throw new InputMismatchException();   }   bufptr = 0;  }  if (buflen <= 0)   return -1;  return buf[bufptr++];  }  public boolean isSpaceChar(int c) {  return !(c >= 33 && c <= 126);  }  public int skip() {  int b;  while ((b = readByte()) != -1 && isSpaceChar(b))   ;  return b;  }    public char nc() {  return (char) skip();  }    public double nd() {  return Double.parseDouble(ns());  }    public String ns() {  final StringBuilder sb = new StringBuilder();  int b = skip();  while (!isSpaceChar(b)) {   sb.appendCodePoint(b);   b = readByte();  }  return sb.toString();  }    public int ni() {  boolean minus = false;  int num = 0;  int b;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }  while (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   b = readByte();  }  return minus ? -num : num;  }    public long nl() {  boolean minus = false;  long num = 0;  int b;  while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))   ;  if (b == '-') {   minus = true;   b = readByte();  }  while (b >= '0' && b <= '9') {   num = num * 10 + (b - '0');   b = readByte();  }  return minus ? -num : num;  }    public int[] nia(int n) {  final int[] arr = new int[n];  for (int i = 0; i < n; i++)   arr[i] = ni();  return arr;  }    public long[] nla(int n) {  final long[] arr = new long[n];  for (int i = 0; i < n; i++)   arr[i] = nl();  return arr;  }    public String[] nsa(int n) {  final String[] arr = new String[n];  for (int i = 0; i < n; i++)   arr[i] = ns();  return arr;  }    public char[] nca(int n) {  final char[] arr = new char[n];  for (int i = 0; i < n; i++)   arr[i] = nc();  return arr;  }    public double[] nda(int n) {  final double[] arr = new double[n];  for (int i = 0; i < n; i++)   arr[i] = nc();  return arr;  }    public int[][] nim(int n, int m) {  final int[][] arr = new int[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = ni();  return arr;  }    public long[][] nlm(int n, int m) {  final long[][] arr = new long[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nl();  return arr;  }    public String[][] nsm(int n, int m) {  final String[][] arr = new String[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = ns();  return arr;  }    public char[][] ncm(int n, int m) {  final char[][] arr = new char[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nc();  return arr;  }    public double[][] ndm(int n, int m) {  final double[][] arr = new double[n][m];  for (int i = 0; i < n; i++)   for (int j = 0; j < m; j++)   arr[i][j] = nd();  return arr;  }  public static void log(Object... o) {  System.out.println(Arrays.deepToString(o));  } } }
1	public class Answer17A{  public static void main(String[] args){ try{  BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));  String[] tmp=reader.readLine().split(" ");  int n=Integer.parseInt(tmp[0]);  int k=Integer.parseInt(tmp[1]);  boolean[] m=getPrime(n);  ArrayList<Integer> prime=new ArrayList<Integer>();  for(int i=0;i<m.length;i++){  if(m[i])prime.add(i);  }  int sum=0;  for(int i=2;i<=n;i++){  if(m[i]){   for(int j=0;j<prime.size()-1;j++){  if(i==prime.get(j)+prime.get(j+1)+1){   sum++;   break;  }   }  }  }  if(sum>=k){  System.out.println("YES");  }else{  System.out.println("NO");  } }catch(IOException e){  e.printStackTrace(); }  }  public static boolean[] getPrime(int N){ boolean[] memo=new boolean[N+1]; Arrays.fill(memo,true); memo[0]=false; memo[1]=false; for(int i=2;i*i<=N;i++){  if(memo[i]){  for(int j=i*i;j<=N;j+=i){   memo[j]=false;  }  } } return memo;  } }
6	public class CF8C { static int n; static int[] mem; static HashMap<Integer, String> map; static int INF = (int) 1e9; static StringBuilder sb;  public static void main(String[] args) throws IOException {  MyScanner sc = new MyScanner(System.in);  String s = sc.nextLine();  n = sc.nextInt();  mem = new int[1 << n];  Arrays.fill(mem, -1);  map = new HashMap<>();  map.put(0, s);  for (int i = 1; i <= n; i++) {  map.put(i, sc.nextLine());  }  int val = dp(0);  PrintWriter pw = new PrintWriter(System.out);  pw.println(val);  sb = new StringBuilder();  sb.append("0 ");  build(0);  pw.println(sb);  pw.flush(); }   private static int dp(int msk) {  if (msk == (1 << n) - 1)  return 0;  if(mem[msk] != -1)  return mem[msk];  boolean foundFirst = false;  int val = (int)1e9;  int mark = -1;  for (int i = 1; i <= n; i++) {  if ((msk & 1 << (i - 1)) == 0){   if(!foundFirst){   foundFirst = true;   mark = i;   val = dist(0, mark)*2 + dp(msk | 1 << (mark - 1));   }else{   val = Math.min(val, dist(0, mark) + dist(mark, i) + dist(i, 0) + dp((msk|1 << (mark - 1))|1 << (i - 1)));   }  }  }  return mem[msk] = val; }  private static int dist(int node, int i) {  String from = map.get(i);  String to = map.get(node);  String[] fromco = from.split(" ");  String[] toco = to.split(" ");  int xs = Integer.parseInt(fromco[0]);  int ys = Integer.parseInt(fromco[1]);  int xf = Integer.parseInt(toco[0]);  int yf = Integer.parseInt(toco[1]);  return (xs - xf) * (xs - xf) + (ys - yf) * (ys - yf); }  private static void build(int msk) {  if (msk == (1 << n) - 1)   return;  boolean foundFirst = false;  int ans = dp(msk);  int mark = -1;  int val = (int)1e9;  for (int i = 1; i <= n; i++) {  if ((msk & 1 << (i - 1)) == 0){   if(!foundFirst){   foundFirst = true;   mark = i;   val = dist(0, mark)*2 + dp(msk | 1 << (mark - 1));   if(val == ans){    sb.append(mark + " 0 ");    build(msk | 1 << (mark - 1));    return;   }   }else{   val = dist(0, mark) + dist(mark, i) + dist(i, 0) + dp(msk|1 << (mark - 1)|1 << (i - 1));   if(val == ans){    sb.append(mark + " " + i + " 0 ");    build(msk|1 << (mark - 1)|1 << (i - 1));    return;   }   }  }  } }  static class MyScanner {  StringTokenizer st;  BufferedReader br;  public MyScanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public MyScanner(String s) throws FileNotFoundException {  br = new BufferedReader(new FileReader(new File(s)));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public boolean ready() throws IOException {  return br.ready();  }  } }
2	public class C { public static void main(String[] args) {  Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  long s = scan.nextLong();  long low = 0;  long high = n + 1;  while (high-low>1) {  long sum = 0;  long mid = (high + low) / 2;  long value = findSum(mid, sum);  if (mid - value >= s)   high = mid;  else   low = mid;  }   System.out.println(n - high + 1);  scan.close(); }  public static long findSum(long n, long sum) {  if (n == 0)  return sum;  return findSum(n / 10, sum + n % 10); } }
0	public class a {  public static class Pair implements Comparable<Pair> {   int f, s;   public Pair(int f, int s) {    this.f = f;    this.s = s;   }   @Override   public int compareTo(Pair o) {    return s - o.s;   }  };  public static void main(String[] args) throws IOException {   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   String s[] = in.readLine().split(" ");   long r = Long.parseLong(s[0]);   long l = Long.parseLong(s[1]);   if (r % 2 == 0) {    if (l - r+1 < 3) {     out.println(-1);    } else {     out.println(r + " " + (r + 1) + " " + (r + 2));    }   } else {    if (l - r+1 < 4) {     out.println(-1);    } else {     out.println((r + 1) + " " + (r + 2) + " " + (r + 3));    }   }   out.close();  } }
1	public class Main {  StreamTokenizer in;  PrintWriter out;  public static void main(String[] args) throws IOException  {   new Main().run();  }  public void run() throws IOException  {      in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  out = new PrintWriter(new OutputStreamWriter(System.out));    solve();   out.flush();    }  public int nextInt() throws IOException  {   in.nextToken();   return (int) in.nval;  }  boolean pr(int i)  {  if(i<4) return true;  for(int j=2;j<Math.sqrt(i)+1;j++)   if(i%j==0)   return false;  return true;  }  public void solve() throws IOException  {  int n=nextInt(),k=nextInt();  int prost[]=new int[1000];  boolean now[]=new boolean[10000];  int a=0;  for(int i=2;i!=1000;i++)   if(pr(i))   prost[a++]=i;  for(int i=0;i!=a-1;i++)  {   if(pr(prost[i]+prost[i+1]+1))   now[prost[i]+prost[i+1]+1]=true;  }  int answ=0;  for(int i=0;i!=n+1;i++)   if(now[i])   answ++;  if(answ>=k)   out.print("YES");  else   out.print("NO");  } }
2	public class C {  public static void main(String[] args) {  new C(); }  C() {   Scanner in = new Scanner(System.in);   long n = in.nextLong(), s = in.nextLong();  long lo = 1, hi = 1000000000000000000L;   while(lo<hi){      long mid = (lo+hi)/2;  if(reallyBig(mid,s))   hi = mid;  else   lo = mid+1;  }     if(!reallyBig(lo,s))  System.out.println(0);  else  System.out.println(Math.max(n-lo+1,0));      in.close();  }  boolean reallyBig(long n, long s){  int sum = 0;  long temp = n;  while(temp>0){  sum += temp%10;  temp/=10;  }  return n-sum>=s; }  }
0	public class BB { public static void main(String[] args) { Scanner sc=new Scanner(System.in); long a=sc.nextLong(); long b=sc.nextLong();  if(b-a>(long)2){  if(a%(long)2==0){  System.out.print(a+" "+(a+1)+" "+(a+2));  return;  }else{  System.out.print(a+1+" "+(a+2)+" "+(a+3));  return;  }   }else{  if(b-a<=(long)1){  System.out.println(-1);  return;  }  if(b-a==(long)2){  if(a%(long)2==0){   System.out.print(a+" "+(a+1)+" "+(a+2));   return;  }else{   System.out.print(-1);   return;  }     } } } }
1	public class Main {  public static void main(String[] args) {   Scanner in = new Scanner(new BufferedInputStream(System.in));   PrintWriter out = new PrintWriter(new BufferedWriter(     new OutputStreamWriter(System.out)));   while (in.hasNext()) {    int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), c = 0;    int[] p = new int[n];    TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();    for (int i = 0; i < n; i++) {     p[i] = in.nextInt();     map.put(p[i], i);    }       if (a > b) {     int t = b;     b = a;     a = t;     c = 1;    }    boolean ok = true;    int[] cls = new int[n];    while (ok && map.size() > 0) {     Entry<Integer, Integer> last = map.lastEntry();     int v = last.getKey();     int idx = last.getValue();     if (map.containsKey(a - v)) {      cls[idx] = 0;      cls[map.get(a - v)] = 0;      map.remove(v);      map.remove(a -v);     } else if (map.containsKey(b - v)) {      cls[idx] = 1;      cls[map.get(b - v)] = 1;      map.remove(v);      map.remove(b -v);     } else      ok = false;    }    if (!ok)     System.out.println("NO");    else {     System.out.println("YES");     for (int j = 0; j < cls.length; j++) {      if (j != 0)       System.out.print(" ");      System.out.print(c ^ cls[j]);     }     System.out.println();    }    out.flush();   }   in.close();  } }
3	public class CF911D {  public static void main(String[] args){  Scanner sc = new Scanner(System.in);    int n = sc.nextInt();  int[] array = new int[n];  for(int i = 0; i < n; i++){   array[i] = sc.nextInt();  }  int count = 0;  for(int i = 0; i < array.length; i++){   for(int j = i+1; j < array.length; j++){    if(array[i] > array[j]){     count++;    }   }  }  count%=2;  int q = sc.nextInt();  for(int i = 0; i < q; i++){   int l = sc.nextInt();   int r = sc.nextInt();   int sz = r - l + 1;   count += (sz*(sz-1))/2;   count %= 2;   if(count == 1)    System.out.println("odd");   else    System.out.println("even");  }  } }
0	public class Solution {  private BufferedReader in; private PrintWriter out; private StringTokenizer st;  void solve() throws IOException {  double a = nextDouble();  double v = nextDouble();  double l = nextDouble();  double d = nextDouble();  double w = nextDouble();  if (w > v) {  w = v;  }  double ans1 = 0.;  double v1;  {  double l_ = 0., r_ = 1e+9;  for (int it = 0; it < 100; ++it) {   double mid = (l_ + r_) / 2.;   double V = a * mid;   double t1 = (V + w) / 2. / a;   double t2 = mid - t1;   t1 = Math.min(t1, v / a);   t2 = Math.min(t2, (v - w) / a);   if (V < w) {   t1 = mid;   t2 = 0.;   }   double dist = t1 * t1 * a / 2. + t2 * (w + t2 * a / 2.) + v * (mid - t1 - t2);   if (dist < d) {   l_ = mid;   } else {   r_ = mid;   }  }  ans1 = (l_ + r_) / 2.;  v1 = Math.min(ans1 * a, w);  }  double ans2 = 0.;  {  double tSp = (v - v1) / a;  double l_ = 0., r_ = 1e+9;  for (int it = 0; it < 100; ++it) {   double mid = (l_ + r_) / 2.;   double dist = Math.min(tSp, mid) * (v1 + Math.min(tSp, mid) * a / 2.);   dist += (mid - Math.min(tSp, mid)) * v;   if (dist < l - d) {   l_ = mid;   } else {   r_ = mid;   }  }  ans2 = (l_ + r_) / 2.;  }  out.println(ans1 + ans2); }  Solution() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   eat("");   solve();   in.close();  out.close(); }  private void eat(String str) {  st = new StringTokenizer(str); }  String next() throws IOException {  while (!st.hasMoreTokens()) {  String line = in.readLine();  if (line == null) {   return null;  }  eat(line);  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(next()); }  long nextLong() throws IOException {  return Long.parseLong(next()); }  double nextDouble() throws IOException {  return Double.parseDouble(next()); }  public static void main(String[] args) throws IOException {  new Solution(); } }
4	public class tank {  static final FastScanner fs = new FastScanner();  static PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) {   int t = fs.nextInt();   while(t-->0) {    run_case();   }   out.close();  }  static void run_case() {   int n = fs.nextInt(), prevLen = 1, one = 1;   int[] arr = fs.readArray(n);   int[] len = new int[1001];   StringBuilder[] prev = new StringBuilder[1001];   len[1] = 1;   out.println(1);   for (int i = 0; i < 1001; i++) {    prev[i] = new StringBuilder();   }   prev[1].append("1");   for (int i = 1; i < n; i++) {    if(arr[i] == 1) {     prev[prevLen + 1] = new StringBuilder(prev[prevLen]);     prev[prevLen + 1].append(".1");     out.println(prev[prevLen + 1]);     prevLen++;     len[prevLen] = 1;    }else {     for (int j = 1000; j > 0; j--) {      if(len[j] == arr[i] - 1 && j <= prevLen) {       char[] tmp = prev[j].toString().toCharArray();       if(fn(tmp)) {        prev[j] = new StringBuilder("" + (len[j] + 1));       }else {        prev[j] = new StringBuilder();        int ub = fn2(tmp);        for (int k = 0; k <= ub; k++) {         prev[j].append(tmp[k]);        }        prev[j].append(len[j] + 1);       }       out.println(prev[j]);       len[j] = len[j] + 1;       prevLen = j;       break;      }      if(j == 1) {       prev[j] = new StringBuilder("" + (one + 1));       out.println(prev[j]);       len[j] = one + 1;       prevLen = j;       one++;      }     }    }   }  }  static boolean fn(char[] arr) {   for(char c: arr) {    if(c == '.') return false;   }   return true;  }  static int fn2(char[] arr) {   int ret = 0;   for (int i = 0; i < arr.length; i++) {    if(arr[i] == '.') ret = i;   }   return ret;  }  static class FastScanner {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st=new StringTokenizer("");   String next() {    while (!st.hasMoreTokens())     try {      st=new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    return st.nextToken();   }   String nextLine(){    try {     return br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return "";   }   int nextInt() {    return Integer.parseInt(next());   }   int[] readArray(int n) {    int[] a=new int[n];    for (int i=0; i<n; i++) a[i]=nextInt();    return a;   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }  } }
5	public class Solution{   void solve()throws Exception  {   int n=nextInt();   int[]a=new int[n];   for(int i=0;i<n;i++)    a[i]=nextInt();   int[]b=a.clone();   mySort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt<=2)    System.out.println("YES");   else    System.out.println("NO");  }  private void mySort(int[] a) {   if(a.length<=1)    return;   int n=a.length;   int[]left=new int[n/2];   int[]right=new int[n-n/2];   for(int i=0;i<n;i++)    if(i<left.length)     left[i]=a[i];    else     right[i-left.length]=a[i];   mySort(left);   mySort(right);   int i=0;   int j=0;   while (i<left.length || j<right.length)   {    if(i==left.length)     a[i+j]=right[j++];    else if(j==right.length)     a[i+j]=left[i++];    else if(left[i]<right[j])     a[i+j]=left[i++];    else     a[i+j]=right[j++];   }  }    BufferedReader reader;  PrintWriter writer;  StringTokenizer stk;  void run()throws Exception  {   reader=new BufferedReader(new InputStreamReader(System.in));     stk=null;        solve();   reader.close();    }  int nextInt()throws Exception  {   return Integer.parseInt(nextToken());  }  long nextLong()throws Exception  {   return Long.parseLong(nextToken());  }  double nextDouble()throws Exception  {   return Double.parseDouble(nextToken());   }  String nextString()throws Exception  {   return nextToken();  }  String nextLine()throws Exception  {   return reader.readLine();  }  String nextToken()throws Exception  {   if(stk==null || !stk.hasMoreTokens())   {    stk=new StringTokenizer(nextLine());    return nextToken();   }   return stk.nextToken();  }  public static void main(String[]args) throws Exception  {   new Solution().run();  }     }
0	public class Ideone {  public static void main (String[] args) throws java.lang.Exception  {   Scanner sc = new Scanner(System.in);   long l= sc.nextLong();   long r = sc.nextLong();   if(l%2==0){    if(r>=l+2){     System.out.println(l + " " + (l+1) + " " + (l+2));    }    else{     System.out.println(-1);    }   }   else{    if(r>=l+3){     System.out.println((l+1) + " " + (l+2) + " " + (l+3));    }    else{     System.out.println(-1);    }   }  } }
2	public class Main {  public static void main(String[] args)  {   setup();   xuly();  }  private static long dp[][] = new long[20][170];  private static void setup() {   dp[0][0] = 1;   for (int i = 1; i < 20; i ++)    for (int j = 0; j < 170; j ++)     for (int k = Math.max(j - 9, 0); k <= j; k ++)      dp[i][j] += dp[i - 1][k];  }  private static int sumD(long x) {   int ret = 0;   while(x > 0) {    ret += x % 10;    x /= 10;   }   return ret;  }  private static long numSatisfy(long limit, int sumDigit) {   long ret = 0;   int curSum = sumD(limit);   if (curSum == sumDigit)    ret ++;   for (int i = 0; i < 20; i ++) {    int bound = (int) (limit % 10);    curSum -= bound;    for (int d = 0; d < bound && curSum + d <= sumDigit; d ++)     ret += dp[i][sumDigit - curSum - d];    limit /= 10;   }   return ret;  }  private static void xuly() {   Scanner scanner = new Scanner(System.in);   long n = scanner.nextLong();   long s = scanner.nextLong();   long ans = 0;   for (int sum = 1; sum < 170; sum ++)    if (n >= s + sum)     ans += numSatisfy(n, sum) - numSatisfy(s + sum - 1, sum);   System.out.print(ans);  } }
0	public class D5 { public static void main(String[] args) {  Scanner input = new Scanner(System.in);  int a = input.nextInt(), v = input.nextInt();  int l = input.nextInt(), d = input.nextInt(), w = input.nextInt();  double lo = 0, hi = v;  for(int iter = 0; iter < 1000; iter++)  {   double mid = (lo+hi)/2;   if(can(mid, a, d, w)) lo = mid;   else hi = mid;  }   double t1 = lo / a;  double gone = .5 * t1 * t1 * a;  if(lo > w)  {   gone += -a * .5 * (lo - w) / a * (lo - w) / a + lo * (lo - w) / a;   t1 += (lo - w) / a;  }  t1 += (d - gone) / lo;   double v0 = Math.min(lo, w);  double togo = l - d;  double toAdd = (-v0 + Math.sqrt(v0 * v0 + 4 * togo * .5 * a)) / a;  if(toAdd * a + v0 > v)  {   double tt = (v - v0) / a;   t1 += tt;   togo -= .5 * a * tt * tt + v0 * tt;   t1 += togo / v;  }  else t1 += toAdd;  System.out.println(t1); } static boolean can(double v, double a, double d, double max) {  double t1 = v / a;  double distGone = .5 * a * t1 * t1;  if(v > max)  {   t1 = (v - max) / a;   distGone += -.5 * a * t1 * t1 + v * t1;  }  return distGone <= d; } }
1	public class a {  boolean[] isp; ArrayList<Integer> primes;  private void solve() throws Exception {  int n = nextInt();  int k = nextInt();  int cnt = 0;  primes = new ArrayList<Integer>();  isp = new boolean[n + 1];  Arrays.fill(isp, true);  for (int i = 2; i <= n; ++i) {  for (int j = 2; j * j <= i; ++j)   if (i % j == 0)   isp[i] = false;  if (isp[i])   primes.add(i);  }  for (int i = 2; i <= n; ++i)  if (isp[i]) {   boolean can = false;   for (int j = 0; j < primes.size() - 1; ++j) {   int sum = primes.get(j) + primes.get(j + 1) + 1;   if (i == sum)    can = true;   }   if (can)   ++cnt;  }  if (cnt >= k)  out.print("YES");  else  out.print("NO"); }  public void run() {  try {  solve();  } catch (Exception e) {  NOO(e);  } finally {  out.close();  } }  PrintWriter out; BufferedReader in; StringTokenizer St;  void NOO(Exception e) {  e.printStackTrace();  System.exit(1); }  int nextInt() {  return Integer.parseInt(nextToken()); }  long nextLong() {  return Long.parseLong(nextToken()); }  double nextDouble() {  return Double.parseDouble(nextToken()); }  String nextToken() {  while (!St.hasMoreTokens()) {  try {   String line = in.readLine();   St = new StringTokenizer(line);  } catch (Exception e) {   NOO(e);  }  }  return St.nextToken(); }  private a(String name) {  try {  in = new BufferedReader(new FileReader(name + ".in"));  St = new StringTokenizer("");  out = new PrintWriter(new FileWriter(name + ".out"));  } catch (Exception e) {  NOO(e);  } }  private a() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  St = new StringTokenizer("");  out = new PrintWriter(System.out);  } catch (Exception e) {  NOO(e);  } }  public static void main(String[] args) {  Locale.setDefault(Locale.US);  new a().run(); } }
2	public class A {  static int[] UPPER = new int[64], LOWER = new int[64]; static long[][][] memo;  static long dp(int bit, int lims, int digs) {  if(bit == -1)  return digs == 0 ? 1 : 0;  if(memo[lims][bit][digs] != -1)  return memo[lims][bit][digs];  long ret = 0;  for(int d = 0, end = digs < 10 ? digs + 1 : 10; d < end; ++d)  if(((lims & 1) == 1 || d >= LOWER[bit]) && ((lims & 2) == 2 || d <= UPPER[bit]))   ret += dp(bit - 1, lims | (d > LOWER[bit] ? 1 : 0) | (d < UPPER[bit] ? 2 : 0), digs - d);  return memo[lims][bit][digs] = ret; }  static void create(int[] x, long n) {  for(int i = 0; i < 64; ++i)  {  x[i] = (int) (n % 10);  n /= 10;  } }  static void prepMemo(int sod) {  memo = new long[4][64][sod + 1];  for(long[][] x: memo)  for(long[] y: x)   Arrays.fill(y, -1); }  public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  long n = sc.nextLong(), s = sc.nextLong();  create(UPPER, n);  long ans = 0;  for(int sod = 1; sod <= 162; ++sod)  {  create(LOWER, s + sod);  prepMemo(sod);  ans += dp(63, 0, sod);  }     out.println(ans);  out.close(); }  static class Scanner  {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s){ br = new BufferedReader(new InputStreamReader(s));}  public Scanner(String s) throws FileNotFoundException{ br = new BufferedReader(new FileReader(s));}  public String next() throws IOException  {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {return Integer.parseInt(next());}  public long nextLong() throws IOException {return Long.parseLong(next());}  public String nextLine() throws IOException {return br.readLine();}  public double nextDouble() throws IOException { return Double.parseDouble(next()); }  public boolean ready() throws IOException {return br.ready();}  } }
0	public class Main {  public static void main(String args[]) throws IOException  {   new Main().run();  }  StreamTokenizer in;  PrintWriter out;  public void run() throws IOException  {   in =new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));   out = new PrintWriter(new OutputStreamWriter(System.out));      solve();   out.flush();  }  public double nextInt() throws IOException  {   in.nextToken();   return in.nval;  }  public void solve() throws IOException  {   double a=nextInt(),v=nextInt(),l=nextInt(),d=nextInt(),w=nextInt();   double s=w*w/(2*a);   if(s>d || w>v)   {   double t=v*v/(2*a);   if(t>l)   {    double f=2*l/a;    out.print(String.format("%.10f",Math.sqrt(f)));    return;   }   double f=v/a;   double k=(l-t)/v;   out.print(String.format("%.10f",f+k));   return;   }   double t;   if((2*v*v-w*w)/(2*a)<d)   t=v/a+(v-w)/a+(d-(2*v*v-w*w)/(2*a))/v;   else   {   double v1=Math.sqrt((2*a*d+w*w)/2);   t=v1/a+(v1-w)/a;   }   double r=l-d;   double tr=(v*v-w*w)/(2*a);   if(tr>r)   {   double t1=(-w+Math.sqrt(w*w+2*a*r))/a;   out.print(String.format("%.10f",t+t1));   return;   }   r-=(v*v-w*w)/(2*a);   t+=(v-w)/a;   out.print(String.format("%.10f",t+r/v));  } }
5	public class A {   static StringTokenizer st;  static BufferedReader in;  public static void main(String[] args) throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int n = nextInt();   int m = nextInt();   int k = nextInt();   int[]a = new int[n+1];   for (int i = 1; i <= n; i++) {    a[i] = nextInt();   }   if (k >= m) {    System.out.println(0);    return;   }   Arrays.sort(a, 1, n+1);   int ans = 0;   for (int i = n; i >= 1; i--) {    ans++;    k--;    k += a[i];    if (k >= m) {     System.out.println(ans);     return;    }   }   System.out.println(-1);   pw.close();  }  private static int nextInt() throws IOException{   return Integer.parseInt(next());  }   private static long nextLong() throws IOException{   return Long.parseLong(next());  }   private static double nextDouble() throws IOException{   return Double.parseDouble(next());  }   private static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  } }
4	public class _1523_C {  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   int t = Integer.parseInt(in.readLine());   while(t-- > 0) {    int n = Integer.parseInt(in.readLine());    int[] a = new int[n];    for(int i = 0; i < n; i++) {     a[i] = Integer.parseInt(in.readLine());    }    boolean[][] used = new boolean[n][n + 1];    boolean[] used2 = new boolean[n];    String[][] res = new String[n][2];    res[0][0] = "1";    res[0][1] = "";    for(int i = 1; i < n; i++) {     if(a[i] == 1) {      for(int j = i - 1; j >= 0; j--) {       if(!used[j][a[i]] && !used2[j]) {        res[i][0] = res[j][0] + ".1";        res[i][1] = res[j][0];        used[j][a[i]] = true;        break;       }      }     }else {      for(int j = i - 1; j >= 0; j--) {       if(!used[j][a[i]] && !used2[j] && a[j] == a[i] - 1) {        if(res[j][1].equals("")) {         res[i][0] = "" + a[i];        }else {         res[i][0] = res[j][1] + "." + a[i];        }        res[i][1] = res[j][1];        used[j][a[i]] = true;        break;       }       used2[j] = true;      }     }    }    for(int i = 0; i < n; i++) {     out.println(res[i][0]);    }   }   in.close();   out.close();  } }
0	public class origami { public static void main(String args[]){  Scanner input = new Scanner(System.in);  double n = input.nextInt();  double k = input.nextInt();  double red = 0;  double green = 0;  double blue = 0;  double ans = 0;  red = (2 * n) / k;  green = (5 * n) / k;  blue = (8 * n) / k;  double red1 = Math.ceil(red) ;  double green1 = Math.ceil(green);  double blue1 = Math.ceil(blue);  ans+=red1;  ans+=green1;  ans+=blue1;  Double answer = new Double(ans);  int finished = answer.intValue();  System.out.println(finished); } }
3	public class CODEFORCES { @SuppressWarnings("rawtypes") static InputReader in; static PrintWriter out;  static void solve() {  int n = in.ni();  int arr[] = new int[n];  for (int i = 0; i < n; i++)  arr[i] = in.ni();  int cnt = 0;  for (int i = 0; i < n; i++)  {  for (int j = 0; j < i; j++)   if (arr[j] > arr[i])   cnt++;  }  cnt %= 2;  int m = in.ni();  while (m-- > 0)  {  int l = in.ni(), r = in.ni();  int fin = r - l + 1;  fin *= (fin - 1);  fin >>= 1;  if ((fin & 1) == 1)   cnt++;  cnt %= 2;  if ((cnt & 1) == 1)   out.println("odd");  else   out.println("even");  } }  @SuppressWarnings("rawtypes") static void soln() {  in = new InputReader(System.in);  out = new PrintWriter(System.out);  solve();  out.flush(); }  static void debug(Object... o) {  System.out.println(Arrays.deepToString(o)); }  public static void main(String[] args) {  new Thread(null, new Runnable()  {  public void run()  {   try   {   soln();   } catch (Exception e)   {   e.printStackTrace();   }  }  }, "1", 1 << 26).start(); }    static class InputReader<SpaceCharFilter> {  private final InputStream stream;  private final byte[] buf = new byte[8192];  private int curChar, snumChars;  private SpaceCharFilter filter;  public InputReader(InputStream stream)  {  this.stream = stream;  }  public int snext()  {  if (snumChars == -1)   throw new InputMismatchException();  if (curChar >= snumChars)  {   curChar = 0;   try   {   snumChars = stream.read(buf);   } catch (IOException e)   {   throw new InputMismatchException();   }   if (snumChars <= 0)   return -1;  }  return buf[curChar++];  }  public int ni()  {  int c = snext();  while (isSpaceChar(c))  {   c = snext();  }  int sgn = 1;  if (c == '-')  {   sgn = -1;   c = snext();  }  int res = 0;  do  {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }  public long nl()  {  int c = snext();  while (isSpaceChar(c))  {   c = snext();  }  int sgn = 1;  if (c == '-')  {   sgn = -1;   c = snext();  }  long res = 0;  do  {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = snext();  } while (!isSpaceChar(c));  return res * sgn;  }  public int[] nextIntArray(int n)  {  int a[] = new int[n];  for (int i = 0; i < n; i++)  {   a[i] = ni();  }  return a;  }  public long[] nextLongArray(int n)  {  long a[] = new long[n];  for (int i = 0; i < n; i++)  {   a[i] = nl();  }  return a;  }  public String readString()  {  int c = snext();  while (isSpaceChar(c))  {   c = snext();  }  StringBuilder res = new StringBuilder();  do  {   res.appendCodePoint(c);   c = snext();  } while (!isSpaceChar(c));  return res.toString();  }  public String nextLine()  {  int c = snext();  while (isSpaceChar(c))   c = snext();  StringBuilder res = new StringBuilder();  do  {   res.appendCodePoint(c);   c = snext();  } while (!isEndOfLine(c));  return res.toString();  }  public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private boolean isEndOfLine(int c)  {  return c == '\n' || c == '\r' || c == -1;  }  public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  }  } }
0	public class A {  public static void main(String[]args) {   Scanner in = new Scanner(System.in);   long l = in.nextLong();   long r = in.nextLong();   if(r - l < 2) System.out.println(-1);   else {    if(l % 2 == 0)     System.out.println(l + " " + (l+1) + " " + (l+2));    else {     if(r - l < 3) System.out.println(-1);     else      System.out.println((l+1) + " " + (l+2) + " " + (l+3));    }   }  } }
4	public class q3 {  public static void main(String[] args) throws Exception {          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   int tests = Integer.parseInt(br.readLine());   for (int test = 1;test <= tests;test++) {    String[] parts = br.readLine().split(" ");    int n = Integer.parseInt(parts[0]);       StringBuilder temp = new StringBuilder();    int curr = Integer.parseInt(br.readLine());    temp.append("1");    System.out.println(1);    for(int i = 0;i < n - 1;i++){     curr = Integer.parseInt(br.readLine());     if(curr == 1){      temp.append('.').append('1');      System.out.println(temp);     }else{      while(temp.length() > 0){       int idx = temp.length() - 1;       while(idx >= 0 && temp.charAt(idx) != '.') idx--;       idx++;       int val = Integer.parseInt(temp.substring(idx));       temp.delete(idx,temp.length());       if(curr == val + 1){        temp.append(String.valueOf(curr));        break;       }       temp.deleteCharAt(temp.length() - 1);      }      System.out.println(temp);     }    }   }  } }
4	public class Main {  static void debug(Object... args) {   System.out.println(Arrays.deepToString(args));  }  public static void main(String[] args) throws Exception {   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));   PrintWriter pw = new PrintWriter(System.out);   int T = Integer.parseInt(br.readLine());   while (T-- > 0) {    int N = Integer.parseInt(br.readLine());    Stack<LN> nodes = new Stack<>();    int a0 = Integer.parseInt(br.readLine());    LN root = new LN(1, 0, "");    nodes.add(root);    pw.println(root);    for (int i = 0; i < N - 1; i++) {     int ai = Integer.parseInt(br.readLine());     while (!nodes.isEmpty()) {      LN nn = nodes.pop();      if (ai == 1) {       LN e = new LN(1, nn.depth + 1, nn.toString());       nodes.add(nn);       nodes.add(e);       pw.println(e);       break;      } else if (nn.lv == ai - 1) {       LN e = new LN(ai, nn.depth, nn.base);       nodes.add(e);       pw.println(e);       break;      }     }    }   }   pw.flush();  }  static class LN {   int lv;   int depth;   String base;   public LN(int lv, int depth, String prev) {    this.lv = lv;    this.depth = depth;    base = prev;   }   @Override   public String toString() {    StringBuilder bob = new StringBuilder(base);    if (depth > 0) {     bob.append(".");    }    bob.append(lv);    return bob.toString();   }  } }
6	public class C {  public static void main(String[] args)  {   new C();  }   final int oo = (int)1e9;   int Hx,Hy;   int N;  int[][] P;   int[] memo;  int[][] soln;   int[] dist1;  int[][] dist2;   C()  {   Scanner in = new Scanner(System.in);   Hx=in.nextInt();   Hy=in.nextInt();     N=in.nextInt();   P=new int[N][2];   for (int i=0; i<N; ++i)   {    P[i][0]=in.nextInt();    P[i][1]=in.nextInt();   }     memo=new int[1<<N];   Arrays.fill(memo, -1);   soln=new int[2][1<<N];     dist1=new int[N];   Arrays.fill(dist1, -1);   dist2=new int[N][N];   for (int[] d : dist2) Arrays.fill(d, -1);     int res=go((1<<N)-1);   System.out.println(res);     int set=(1<<N)-1;   while (set>0)   {    System.out.print("0 ");    System.out.print((soln[0][set]+1)+" ");    if (soln[1][set]>-1) System.out.print((soln[1][set]+1)+" ");       if (soln[1][set]>-1)    {     set-=((1<<soln[0][set])+(1<<soln[1][set]));    }    else    {     set-=(1<<soln[0][set]);    }   }   System.out.println("0");  }   int go(int set)  {   if (set==0)    return 0;   if (memo[set]>-1)    return memo[set];       int res=oo;   int i=0;   while (!on(set,i)) ++i;   res=dist(i)+go(set-(1<<i));   soln[0][set]=i;   soln[1][set]=-1;     for (int j=i+1; j<N; ++j)   {    if (on(set,j))    {     int tmp=dist(i,j)+go(set-(1<<i)-(1<<j));     if (tmp<res)     {      res=tmp;      soln[0][set]=i;      soln[1][set]=j;     }    }   }     return memo[set]=res;  }     int dist(int i)  {   if (dist1[i]>-1) return dist1[i];     int dx=P[i][0]-Hx;   int dy=P[i][1]-Hy;   return dist1[i]=2*(dx*dx+dy*dy);  }     int dist(int i, int j)  {   if (dist2[i][j]>-1) return dist2[i][j];     int res=0,dx,dy;     dx=P[i][0]-Hx;   dy=P[i][1]-Hy;   res+=dx*dx+dy*dy;     dx=P[i][0]-P[j][0];   dy=P[i][1]-P[j][1];   res+=dx*dx+dy*dy;     dx=P[j][0]-Hx;   dy=P[j][1]-Hy;   res+=dx*dx+dy*dy;     return dist2[i][j]=res;  }   boolean on(int set, int loc)  {   return (set&(1<<loc))>0;  } }
6	public class Main implements Runnable {      private int n;  private int nn;  private int[][] D;  private int[] dp;  private int[] prev;  private void solve() throws Throwable {   int xs = nextInt(), ys = nextInt();   n = nextInt();   int[][] pts = new int[n][2];   for (int i = 0; i < n; i++) {    pts[i][0] = nextInt();    pts[i][1] = nextInt();   }   D = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = 0; j < n; j++) {     if (i == j) {      D[i][i] = 2 * (sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys));     } else {      D[i][j] = sqr(pts[i][0] - xs) + sqr(pts[i][1] - ys)        + sqr(pts[i][0] - pts[j][0])        + sqr(pts[i][1] - pts[j][1]) + sqr(pts[j][0] - xs)        + sqr(pts[j][1] - ys);     }    }   }   nn = 1 << n;   dp = new int[nn];   prev = new int[nn];   Arrays.fill(dp, -1);   Arrays.fill(prev, -1);   dp[0] = 0;   Dp(nn - 1);   pw.println(dp[nn - 1]);   pw.print(0);   for (int p = nn - 1; p != -1 && prev[p] != -1; p = prev[p]) {    int vv = p ^ prev[p];    for (int j = 0; j < n; j++) {     int jj = 1 << j;     if ((vv & jj) == 0)      continue;     pw.print(' ');     pw.print(j + 1);    }    pw.print(" 0");   }   pw.println();  }  private int Dp(int i) {   if (dp[i] != -1)    return dp[i];   int ans = 107374182, p = -1;   int j1 = 1, pos1 = 0;   for (; pos1 < n && j1 < nn; j1 *= 2, pos1++) {    if ((i & j1) == 0)     continue;    int a = D[pos1][pos1] + Dp(i ^ j1);    if (a < ans) {     ans = a;     p = i ^ j1;    }    int j2 = j1 * 2, pos2 = pos1 + 1;    for (; pos2 < n && j2 < nn; j2 *= 2, pos2++) {     if ((i & j2) == 0)      continue;     a = D[pos1][pos2] + Dp(i ^ (j1 | j2));     if (a < ans) {      ans = a;      p = i ^ (j1 | j2);     }    }    break;   }   dp[i] = ans;   prev[i] = p;   return ans;  }  private int sqr(int i) {   return i * i;  }      private void initstreams() throws Throwable {     in = new BufferedReader(new InputStreamReader(System.in, "ISO-8859-1"));   pw = new PrintWriter(System.out);  }  BufferedReader in;  PrintWriter pw;  StringTokenizer st;  String nextString() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  int nextInt() throws NumberFormatException, IOException {   return Integer.parseInt(nextString());  }  long nextLong() throws NumberFormatException, IOException {   return Long.parseLong(nextString());  }  double nextDouble() throws NumberFormatException, IOException {   return Double.parseDouble(nextString());  }  @Override  public void run() {   try {    initstreams();    solve();   } catch (Throwable e) {    sError = e;   } finally {    if (pw != null)     pw.close();   }  }  private static Throwable sError;  public static void main(String[] args) throws Throwable {   Thread t = new Thread(new Main());   t.start();   t.join();   if (sError != null)    throw sError;  } }
5	public class Main implements Runnable {  void randomShuffle(int[] arr) {  Random rnd = new Random();  for (int i = arr.length - 1; i >= 0; i--) {  int pos = rnd.nextInt(i + 1);  int temp = arr[pos];  arr[pos] = arr[i];  arr[i] = temp;  } }  void solve() throws Exception {  int n = sc.nextInt();  int[] a = new int[n];  int[] ac = new int[n];  for (int i = 0; i < n; i++) {  a[i] = ac[i] = sc.nextInt();  }  randomShuffle(ac);  Arrays.sort(ac);  int diff = 0;  for (int i = 0; i < n; i++) {  if (a[i] != ac[i]) {   diff++;  }  }  if (diff <= 2) {  out.println("YES");  } else {  out.println("NO");  } }  BufferedReader in; PrintWriter out; FastScanner sc;  static Throwable uncaught;  @Override public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  sc = new FastScanner(in);  solve();  } catch (Throwable t) {  Main.uncaught = t;  } finally {  out.close();  } }  public static void main(String[] args) throws Throwable {  Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);  t.start();  t.join();  if (uncaught != null) {  throw uncaught;  } } } class FastScanner {  BufferedReader reader; StringTokenizer strTok;  public FastScanner(BufferedReader reader) {  this.reader = reader; }  public String nextToken() throws IOException {  while (strTok == null || !strTok.hasMoreTokens()) {  strTok = new StringTokenizer(reader.readLine());  }  return strTok.nextToken(); }  public int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  public long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  public double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  }
3	public class Main {  public static void main(String[] args) {  Scanner in=new Scanner(System.in);   int n=in.nextInt();  int a[]=new int[n];  for(int i=0; i<n; i++)   a[i]=in.nextInt();  long no=0;  for(int i=0; i<n-1; i++)  {   for(int j=i+1; j<n; j++)   {   if(a[i]>a[j])    no++;   }  }    no%=2;  int m=in.nextInt();  int te;  String te2="odd",te1="even";  for(int i=0; i<m; i++)  {   te=in.nextInt()-in.nextInt();   te=-te+1;    if((te*(te-1)/2)%2==0)   {     if(no==0)    System.out.println("even");   else    System.out.println("odd");   }   else   {   no=(no+1)%2;   if(no==0)    System.out.println("even");   else    System.out.println("odd");   }  }    } }
2	public class CFEdu23C { static long sum(long n) {  long ans=0;  while(n>0)  {  ans+=(n%10);  n/=10;  }  return ans; } static long BS(long l,long h,long s) {  if(l<=h)  {  long m=(l+h)/2l;  if(m-sum(m)>=s && (m==1 || (m-1)-sum(m-1)<s))   return m;  else if(m-sum(m)>=s)   return BS(l, m-1, s);  else   return BS(m+1, h, s);  }  return (h+1); } public static void main(String args[]) {  InputReader in = new InputReader(System.in);  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);   long n=in.nextLong(),s=in.nextLong();  long x=BS(0,n,s);  out.print(n-x+1);  out.close();   }  public static final long l = (int) (1e9 + 7);  private static int[] nextIntArray(InputReader in, int n) {  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.nextInt();  return a; }  private static long[] nextLongArray(InputReader in, int n) {  long[] a = new long[n];  for (int i = 0; i < n; i++)  a[i] = in.nextLong();  return a; }  private static int[][] nextIntMatrix(InputReader in, int n, int m) {  int[][] a = new int[n][m];  for (int i = 0; i < n; i++) {  for (int j = 0; j < m; j++)   a[i][j] = in.nextInt();  }  return a; }  private static void show(int[] a) {  for (int i = 0; i < a.length; i++)  System.out.print(a[i] + " ");  System.out.println(); }  private static void show2DArray(char[][] a) {  for (int i = 0; i < a.length; i++) {  for (int j = 0; j < a[0].length; j++)   System.out.print(a[i][j]);  System.out.println();  } }  static class Pair {  private int first;  private int second;  public Pair(int i, int j) {  this.first = i;  this.second = j;  }  public int getFirst() {  return first;  }  public int getSecond() {  return second;  }  public void setFirst(int k) {  this.first = k;  }  public void setSecond(int k) {  this.second = k;  } }  static int modPow(int a, int b, int p) {  int result = 1;  a %= p;  while (b > 0) {  if ((b & 1) != 0)   result = (result * a) % p;  b = b >> 1;  a = (a * a) % p;  }  return result; }  public static void SieveOfEratosthenes(int n) {  boolean[] prime = new boolean[n + 1];  Arrays.fill(prime, true);  prime[1] = false;  int i, j;  for (i = 2; i * i <= n; i++) {  if (prime[i]) {   for (j = i; j <= n; j += i) {   if (j != i)    prime[j] = false;   }  }  } }  static class InputReader {  public BufferedReader reader;  public StringTokenizer tokenizer;  public InputReader(InputStream inputstream) {  reader = new BufferedReader(new InputStreamReader(inputstream));  tokenizer = null;  }  public String nextLine() {  String fullLine = null;  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   fullLine = reader.readLine();   } catch (IOException e) {   throw new RuntimeException(e);   }   return fullLine;  }  return fullLine;  }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {   try {   tokenizer = new StringTokenizer(reader.readLine());   } catch (IOException e) {   throw new RuntimeException(e);   }  }  return tokenizer.nextToken();  }  public long nextLong() {  return Long.parseLong(next());  }  public int nextInt() {  return Integer.parseInt(next());  } } }
6	public class Bag implements Runnable {  private void solve() throws IOException {   int xs = nextInt();   int ys = nextInt();   int n = nextInt();   int[] x = new int[n];   int[] y = new int[n];   for (int i = 0; i < n; ++i) {    x[i] = nextInt();    y[i] = nextInt();   }   final int[][] pair = new int[n][n];   for (int i = 0; i < n; ++i)    for (int j = i + 1; j < n; ++j)     pair[i][j] = (x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys) + (x[j] - xs) * (x[j] - xs) + (y[j] - ys) * (y[j] - ys) + (x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]);   final int[] single = new int[n];   for (int i = 0; i < n; ++i) {    single[i] = 2 * ((x[i] - xs) * (x[i] - xs) + (y[i] - ys) * (y[i] - ys));   }   final int[] best = new int[1 << n];   final int[] prev = new int[1 << n];   for (int set = 1; set < (1 << n); ++set) {    int i;    for (i = 0; i < n; ++i)     if ((set & (1 << i)) != 0)      break;    best[set] = best[set ^ (1 << i)] + single[i];    prev[set] = 1 << i;    int nextSet = set ^ (1 << i);    int unoI = 1 << i;    for (int j = i + 1, unoJ = 1 << (i + 1); j < n; ++j, unoJ <<= 1)     if ((set & unoJ) != 0) {      int cur = best[nextSet ^ unoJ] + pair[i][j];      if (cur < best[set]) {       best[set] = cur;       prev[set] = unoI | unoJ;      }     }   }   writer.println(best[(1 << n) - 1]);   int now = (1 << n) - 1;   writer.print("0");   while (now > 0) {   int differents = prev[now];   for(int i = 0; i < n; i++)   if((differents & (1 << i)) != 0)   {    writer.print(" ");     writer.print(i + 1);     now ^= 1 << i;   }    writer.print(" ");    writer.print("0");   }   writer.println();  }   public static void main(String[] args) {   new Bag().run();  }  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter writer;  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    writer = new PrintWriter(System.out);    solve();    reader.close();    writer.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
1	public class Main {  public static void main(String[] args) {  Scanner in = new Scanner(new BufferedInputStream(System.in));  PrintWriter out = new PrintWriter(new BufferedWriter(   new OutputStreamWriter(System.out)));  while (in.hasNext()) {  int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(), c = 0;  int[] p = new int[n];   TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();  for (int i = 0; i < n; i++) {   p[i] = in.nextInt();   map.put(p[i], i);  }    if (a > b) {   int t = b;   b = a;   a = t;   c = 1;  }   boolean ok = true;  int[] cls = new int[n];  while (ok && map.size() > 0) {   Entry<Integer, Integer> last = map.lastEntry();   int v = last.getKey();   int idx = last.getValue();   if (map.containsKey(a - v)) {   cls[idx] = 0;   cls[map.get(a - v)] = 0;   map.remove(v);   map.remove(a -v);   } else if (map.containsKey(b - v)) {   cls[idx] = 1;   cls[map.get(b - v)] = 1;   map.remove(v);   map.remove(b -v);   } else    ok = false;  }   if (!ok)   System.out.println("NO");  else {   System.out.println("YES");   for (int j = 0; j < cls.length; j++) {   if (j != 0)    System.out.print(" ");   System.out.print(c ^ cls[j]);   }   System.out.println();  }  out.flush();  }  in.close(); } }
5	public class test1 {  public static void main(String[] args)  {   Scanner in = new Scanner(System.in);   int n = in.nextInt();   int a[]=new int[n];   int b[]=new int[n];   for(int i=0;i<n;i++)   {    a[i]=in.nextInt();    b[i]=a[i];   }   Arrays.sort(b);   int count=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     count++;   if(count<=2)    System.out.println("YES");   else    System.out.println("NO");  }   }
3	public class Main {  public static void main(String[] args) {  Scanner s = new Scanner(System.in);  int n = s.nextInt();  int[] arr = new int[n];  for(int i = 0; i < n; i++) {  arr[i] = s.nextInt();  }  int parity = 0;  for(int i = 0; i < n; i++) {  int count = 0;  for(int j = i + 1; j < n; j++) {   if(arr[j] < arr[i]) {   parity ^= 1;   }    }  }  int m = s.nextInt();  for(int i = 0; i < m; i++) {  int l = s.nextInt(), r = s.nextInt();  if(((r - l + 1) / 2) % 2 == 1) {   parity ^= 1;  }  System.out.println(parity == 1 ? "odd" : "even");  } } }
1	public class Main {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);   int a[] = new int[100004];   int b[] = new int[100004];   int n, m, ans = 0, dau, cuoi=-1;   n = sc.nextInt();   m = sc.nextInt();   for(int i=0;i<100004;i++) a[i] = 0;   for(int i=0;i<n;i++){    b[i] = sc.nextInt();    if(a[b[i]]==0){     a[b[i]] = 1;     ans++;     if(ans==m){      cuoi = i+1;      break;     }    }   }   for(int i=cuoi-1;i>=00;i--){    if(a[b[i]]==1){     a[b[i]] = 0;     ans--;     if(ans==0){      System.out.println((i+1)+" "+cuoi);      System.exit(0);     }    }   }   System.out.println("-1 -1");  } }
0	public class A {  public static void main(String[] args) {     Scanner in = new Scanner(System.in);     long l = in.nextLong();   long r = in.nextLong();     if(r-l < 2 ){    System.out.println("-1");   }     else if(r-l == 2 && l %2 ==1){    System.out.println("-1");   }   else{           if(l%2 == 0){     System.out.println(l+ " "+(l+1)+" "+(l+2));        }    else{     System.out.println((l+1)+ " "+(l+2)+" "+(l+3));    }   }      }  }
3	public class d {  public static void main(String[] args) {  Scanner in = new Scanner(System.in);   int size = in.nextInt();   int[] vals = new int[size];  long[] cum = new long[size];  for(int i=0; i<size; i++){  vals[i] = in.nextInt();    int c = 0;  for(int j=0; j<i; j++)   if(vals[j] > vals[i]) c++;    if(i != 0) cum[i] = cum[i-1]+c;  else cum[i] = c;  }   long tot = cum[size-1];  int q = in.nextInt();  int[] nv = new int[size];  for(int i=0; i<q; i++)  {  int l = in.nextInt()-1;  int r = in.nextInt()-1;  int n = (r-l);    long add = (n*(n+1))/2 - (cum[r] - cum[l]);  tot = tot - (cum[r] - cum[l]) + add;    if(tot%2 == 0)   System.out.println("even");  else   System.out.println("odd");        } } }
3	public class D_Edu_Round_35 {  public static long MOD = 1000000007;  public static void main(String[] args) throws FileNotFoundException {        PrintWriter out = new PrintWriter(System.out);   Scanner in = new Scanner();   int n = in.nextInt();   int[] data = new int[n];   for (int i = 0; i < n; i++) {    data[i] = in.nextInt();   }   FT tree = new FT(n + 1);   int result = 0;   for (int i = n - 1; i >= 0; i--) {    tree.update(data[i], 1);    result += tree.get(data[i] - 1);    result %= 2;   }   int q = in.nextInt();   int[] tmp = new int[n];   for (int i = 0; i < q; i++) {    int l = in.nextInt() - 1;    int r = in.nextInt() - 1;    int total = r - l + 1;    total = total * (total - 1) / 2;    total %= 2;    result += total;    result %= 2;    if (result % 2 == 0) {     out.println("even");    } else {     out.println("odd");    }   }   out.close();  }  public static int[] KMP(String val) {   int i = 0;   int j = -1;   int[] result = new int[val.length() + 1];   result[0] = -1;   while (i < val.length()) {    while (j >= 0 && val.charAt(j) != val.charAt(i)) {     j = result[j];    }    j++;    i++;    result[i] = j;   }   return result;  }  public static boolean nextPer(int[] data) {   int i = data.length - 1;   while (i > 0 && data[i] < data[i - 1]) {    i--;   }   if (i == 0) {    return false;   }   int j = data.length - 1;   while (data[j] < data[i - 1]) {    j--;   }   int temp = data[i - 1];   data[i - 1] = data[j];   data[j] = temp;   Arrays.sort(data, i, data.length);   return true;  }  public static int digit(long n) {   int result = 0;   while (n > 0) {    n /= 10;    result++;   }   return result;  }  public static double dist(long a, long b, long x, long y) {   double val = (b - a) * (b - a) + (x - y) * (x - y);   val = Math.sqrt(val);   double other = x * x + a * a;   other = Math.sqrt(other);   return val + other;  }  public static class Point implements Comparable<Point> {   int x, y;   public Point(int start, int end) {    this.x = start;    this.y = end;   }   @Override   public int hashCode() {    int hash = 5;    hash = 47 * hash + this.x;    hash = 47 * hash + this.y;    return hash;   }   @Override   public boolean equals(Object obj) {    if (obj == null) {     return false;    }    if (getClass() != obj.getClass()) {     return false;    }    final Point other = (Point) obj;    if (this.x != other.x) {     return false;    }    if (this.y != other.y) {     return false;    }    return true;   }   @Override   public int compareTo(Point o) {    return Integer.compare(x, o.x);   }  }  public static class FT {   int[] data;   FT(int n) {    data = new int[n];   }   public void update(int index, int value) {    while (index < data.length) {     data[index] += value;     data[index] %= 2;     index += (index & (-index));    }   }   public int get(int index) {    int result = 0;    while (index > 0) {     result += data[index];     result %= 2;     index -= (index & (-index));    }    return result;   }  }  public static long gcd(long a, long b) {   if (b == 0) {    return a;   }   return gcd(b, a % b);  }  public static long pow(long a, long b, long MOD) {   if (b == 0) {    return 1;   }   if (b == 1) {    return a;   }   long val = pow(a, b / 2, MOD);   if (b % 2 == 0) {    return val * val % MOD;   } else {    return val * (val * a % MOD) % MOD;   }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() throws FileNotFoundException {       br = new BufferedReader(new InputStreamReader(System.in));      }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
6	public class _8C {  static int[] x = new int[30], y = new int[30]; static int[][] dist = new int[30][30]; static int n; static final int M = 1000; static int[] bitPos = new int[M]; static {  Arrays.fill(bitPos, -1);  for (int i=0; i<24; i++)  bitPos[(1 << i) % M] = i; }  static int sqr(int i) {  return i * i; }  public static void main(String[] args) throws Exception {  Reader.init(System.in);  BufferedWriter cout = new BufferedWriter(new OutputStreamWriter(System.out));  x[0] = Reader.nextInt();  y[0] = Reader.nextInt();  n = Reader.nextInt();  for (int i=1; i<=n; i++) {  x[i] = Reader.nextInt();  y[i] = Reader.nextInt();  }  for (int i=0; i<=n; i++)  for (int j=0; j<=n; j++)   dist[i][j] = sqr(x[i] - x[j]) + sqr(y[i] - y[j]);   int[] f = new int[1 << n];  int[] r = new int[1 << n];  for (int mask=1; mask<(1 << n); mask++) {  int lowbit = mask & -mask;  int lowbitPos = bitPos[lowbit % M];  f[mask] = dist[lowbitPos + 1][0] * 2 + f[mask ^ lowbit];  r[mask] = lowbit;   for (int i=mask^(lowbit); i>0; i=i^(i & -i)) {   int otherBit = i & -i;   int otherBitPos = bitPos[otherBit % M];   int tmp = dist[0][lowbitPos + 1] + dist[lowbitPos + 1][otherBitPos + 1] + dist[otherBitPos + 1][0] + f[mask ^ otherBit ^ lowbit];   if (tmp < f[mask]) {    f[mask] = tmp;    r[mask] = lowbit | otherBit;   }  }  }   System.out.println(f[(1 << n) - 1]);  int mask = (1 << n) - 1;  while(mask > 0) {  if ((r[mask] ^ (r[mask] & -r[mask])) == 0) {   System.out.print("0 " + (bitPos[r[mask] % M] + 1) + " ");  }  else {   int bit1 = r[mask] & -r[mask];   int bit2 = r[mask] ^ bit1;   System.out.print("0 " + (bitPos[bit1 % M] + 1) + " " + (bitPos[bit2 % M] + 1) + " ");  }  mask ^= r[mask];  }  System.out.println("0");    cout.close(); }  static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {  final U _1;  final V _2;  private Pair(U key, V val) {  this._1 = key;  this._2 = val;  }  public static <U extends Comparable<U>, V extends Comparable<V>> Pair<U, V> instanceOf(U _1, V _2) {  return new Pair<U, V>(_1, _2);  }  @Override  public String toString() {  return _1 + " " + _2;  }  @Override  public int hashCode() {  int res = 17;  res = res * 31 + _1.hashCode();  res = res * 31 + _2.hashCode();  return res;  }  @Override  public int compareTo(Pair<U, V> that) {  int res = this._1.compareTo(that._1);  if (res < 0 || res > 0)   return res;  else   return this._2.compareTo(that._2);  }  @Override  public boolean equals(Object obj) {  if (this == obj)   return true;  if (!(obj instanceof Pair))   return false;  Pair<?, ?> that = (Pair<?, ?>) obj;  return _1.equals(that._1) && _2.equals(that._2);  } }   static class Reader {  static BufferedReader reader;  static StringTokenizer tokenizer;    static void init(InputStream input) {  reader = new BufferedReader(new InputStreamReader(input));  tokenizer = new StringTokenizer("");  }    static String next() throws IOException {  while (!tokenizer.hasMoreTokens()) {     tokenizer = new StringTokenizer(reader.readLine());  }  return tokenizer.nextToken();  }  static int nextInt() throws IOException {  return Integer.parseInt(next());  }  static double nextDouble() throws IOException {  return Double.parseDouble(next());  } }  static class ArrayUtil {  static void swap(int[] a, int i, int j) {  int tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(long[] a, int i, int j) {  long tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(double[] a, int i, int j) {  double tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(char[] a, int i, int j) {  char tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void swap(boolean[] a, int i, int j) {  boolean tmp = a[i];  a[i] = a[j];  a[j] = tmp;  }  static void reverse(int[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(long[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(double[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(char[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static void reverse(boolean[] a, int i, int j) {  for (; i < j; i++, j--)   swap(a, i, j);  }  static long sum(int[] a) {  int sum = 0;  for (int i : a)   sum += i;  return sum;  }  static long sum(long[] a) {  long sum = 0;  for (long i : a)   sum += i;  return sum;  }  static double sum(double[] a) {  double sum = 0;  for (double i : a)   sum += i;  return sum;  }  static int max(int[] a) {  int max = Integer.MIN_VALUE;  for (int i : a)   if (i > max)   max = i;  return max;  }  static int min(int[] a) {  int min = Integer.MAX_VALUE;  for (int i : a)   if (i < min)   min = i;  return min;  }  static long max(long[] a) {  long max = Long.MIN_VALUE;  for (long i : a)   if (i > max)   max = i;  return max;  }  static long min(long[] a) {  long min = Long.MAX_VALUE;  for (long i : a)   if (i < min)   min = i;  return min;  } } }
5	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   OutputWriter out = new OutputWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  } } class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int count = in.readInt();   int[] array = IOUtils.readIntArray(in, count);   int[] sorted = array.clone();   ArrayUtils.sort(sorted, IntComparator.DEFAULT);   int differs = 0;   for (int i = 0; i < count; i++) {    if (array[i] != sorted[i])     differs++;   }   if (differs <= 2)    out.printLine("YES");   else    out.printLine("NO");  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int readInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c - '0';    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public boolean isSpaceChar(int c) {   if (filter != null)    return filter.isSpaceChar(c);   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public interface SpaceCharFilter {   public boolean isSpaceChar(int ch);  } } class OutputWriter {  private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void print(Object...objects) {   for (int i = 0; i < objects.length; i++) {    if (i != 0)     writer.print(' ');    writer.print(objects[i]);   }  }  public void printLine(Object...objects) {   print(objects);   writer.println();  }  public void close() {   writer.close();  }  } class IOUtils {  public static int[] readIntArray(InputReader in, int size) {   int[] array = new int[size];   for (int i = 0; i < size; i++)    array[i] = in.readInt();   return array;  }  } class ArrayUtils {  private static int[] tempInt = new int[0];  public static int[] sort(int[] array, IntComparator comparator) {   return sort(array, 0, array.length, comparator);  }  public static int[] sort(int[] array, int from, int to, IntComparator comparator) {   ensureCapacityInt(to - from);   System.arraycopy(array, from, tempInt, 0, to - from);   sortImpl(array, from, to, tempInt, 0, to - from, comparator);   return array;  }  private static void ensureCapacityInt(int size) {   if (tempInt.length >= size)    return;   size = Math.max(size, tempInt.length << 1);   tempInt = new int[size];  }  private static void sortImpl(int[] array, int from, int to, int[] temp, int fromTemp, int toTemp, IntComparator comparator) {   if (to - from <= 1)    return;   int middle = (to - from) >> 1;   int tempMiddle = fromTemp + middle;   sortImpl(temp, fromTemp, tempMiddle, array, from, from + middle, comparator);   sortImpl(temp, tempMiddle, toTemp, array, from + middle, to, comparator);   int index = from;   int index1 = fromTemp;   int index2 = tempMiddle;   while (index1 < tempMiddle && index2 < toTemp) {    if (comparator.compare(temp[index1], temp[index2]) <= 0)     array[index++] = temp[index1++];    else     array[index++] = temp[index2++];   }   if (index1 != tempMiddle)    System.arraycopy(temp, index1, array, index, tempMiddle - index1);   if (index2 != toTemp)    System.arraycopy(temp, index2, array, index, toTemp - index2);  }  } interface IntComparator {  public static final IntComparator DEFAULT = new IntComparator() {   public int compare(int first, int second) {    if (first < second)     return -1;    if (first > second)     return 1;    return 0;   }  };  public int compare(int first, int second); }
1	public class A{  void exe(){   LinkedList<Integer> list=new LinkedList<Integer>();   for(int i=2;i<=1000;i++)    if(isPrime(i))     list.add(i);   Object[] primes=list.toArray();     Scanner sc=new Scanner(System.in);   int n=sc.nextInt();   int k=sc.nextInt();   int cnt=0;   for(int c=2;c<=n;c++){    if(!isPrime(c))     continue;    for(int i=0;i<primes.length-1;i++){     int p1=(Integer)primes[i];     int p2=(Integer)primes[i+1];     if(c==1+p1+p2){      cnt++;     }    }   }   if(cnt>=k){    System.out.println("YES");   }else{    System.out.println("NO");   }  }  boolean isPrime(int n){   if(n<=1)return false;   if(n==2)return true;   if(n%2==0)return false;   int m=(int)Math.sqrt(n)+1;   for(int i=3;i<=m;i+=2)    if(n%i==0)     return false;   return true;  }   public static void main(String[] args){   Locale.setDefault(Locale.US);   new A().exe();  } }
0	public class Task275A {  public static Scanner in = new Scanner(System.in);  public static PrintStream out = System.out;  public static void main(String[] args) {   long l = in.nextLong();   long r = in.nextLong();   if (l % 2 == 1) {    l++;   }   if (r - l < 2) {    out.print(-1);   }   else {    out.print(l + " " + (l + 1) + " " + (l + 2));   }  } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastReader in = new FastReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskD solver = new TaskD();   solver.solve(1, in, out);   out.close();  }  static class TaskD {   public void solve(int testNumber, FastReader in, PrintWriter out) {    int n = in.nextInt();    int[] a = in.nextIntArray(n);    int ct = 0;    for (int i = 0; i < n; ++i) {     for (int j = i + 1; j < n; ++j) {      if (a[i] > a[j]) ++ct;     }    }    ct &= 1;    int Q = in.nextInt();    for (int q = 0; q < Q; ++q) {     int l = in.nextInt();     int r = in.nextInt();     int size = (r - l + 1) * (r - l) >> 1;     ct ^= size & 1;     out.println(ct % 2 == 0 ? "even" : "odd");    }   }  }  static class FastReader {   private InputStream stream;   private byte[] buf = new byte[8192];   private int curChar;   private int pnumChars;   public FastReader(InputStream stream) {    this.stream = stream;   }   private int pread() {    if (pnumChars == -1) {     throw new InputMismatchException();    }    if (curChar >= pnumChars) {     curChar = 0;     try {      pnumChars = stream.read(buf);     } catch (IOException e) {      throw new InputMismatchException();     }     if (pnumChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public int nextInt() {    int c = pread();    while (isSpaceChar(c))     c = pread();    int sgn = 1;    if (c == '-') {     sgn = -1;     c = pread();    }    int res = 0;    do {     if (c == ',') {      c = pread();     }     if (c < '0' || c > '9') {      throw new InputMismatchException();     }     res *= 10;     res += c - '0';     c = pread();    } while (!isSpaceChar(c));    return res * sgn;   }   public int[] nextIntArray(int n) {    int[] array = new int[n];    for (int i = 0; i < n; i++) {     array[i] = nextInt();    }    return array;   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  } }
4	public class Main {  private static HashMap<String, Integer> nodes;  private static void dfs(String cur, PrintWriter out) {   if(cur.length() > 0) {    out.println(cur.substring(1));   }   int children = nodes.get(cur);   for(int i = 1; i <= children; i++) {    dfs(cur+"."+i, out);   }  }  public static void main(String[] args) throws IOException {          BufferedReader f = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));   int t = Integer.parseInt(f.readLine());   while(t-- > 0) {    int n = Integer.parseInt(f.readLine());    nodes = new HashMap<>();    nodes.put("", 0);    String cur = "";    for(int i = 0; i < n; i++) {     int a = Integer.parseInt(f.readLine());     while(nodes.get(cur) != a-1) {      cur = cur.substring(0, cur.lastIndexOf("."));     }     nodes.put(cur, a);     cur = cur+"."+a;     nodes.put(cur, 0);    }    dfs("", out);   }   f.close();   out.close();  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  ArrayList<Integer>[] G;  int[] st, dr;  boolean[] v;  public void solve(int testNumber, InputReader in, PrintWriter out) {   int N = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] A = new int[N];   TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();   for (int i = 0; i < N; i++) {    A[i] = in.nextInt();    map.put(A[i], i);   }   G = new ArrayList[N];   for (int i = 0; i < N; i++) {    G[i] = new ArrayList<Integer>();   }   for (int i = 0; i < N; i++) {    int val = a - A[i];    if (map.containsKey(val)) {     int p = map.get(val);      G[i].add(p);      G[p].add(i);    }    val = b - A[i];    if (map.containsKey(val)) {     int p = map.get(val);      G[i].add(p);      G[p].add(i);    }   }   st = new int[N];   dr = new int[N];   Arrays.fill(st, -1);   Arrays.fill(dr, -1);   v = new boolean[N];   boolean ok = true;   int match = 0;   while (ok) {    ok = false;    Arrays.fill(v, false);    for (int i = 0; i < N; i++) {     if (dr[i] == -1) {      if (pairup(i)) {       ok = true;       match++;      }     }    }   }   if (match == N) {    out.println("YES");    for (int i = 0; i < N; i++) {     if (i > 0) {      out.print(" ");     }     int other = dr[i];     if (A[i] == b - A[other]) {      out.print(1);     }     else {      out.print(0);     }    }   }   else {    out.println("NO");   }  }  private boolean pairup(int node) {   if (v[node]) {    return false;   }   v[node] = true;   for (int x : G[node]) {    if (st[x] == -1) {     st[x] = node;     dr[node] = x;     return true;    }   }   for (int x : G[node]) {    if (pairup(st[x])) {     st[x] = node;     dr[node] = x;     return true;    }   }   return false;  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int nextInt() {   return Integer.parseInt(nextString());  }  public String nextString() {   int c = read();   while (isSpaceChar(c))    c = read();   StringBuffer res = new StringBuffer();   do {    res.appendCodePoint(c);    c = read();   } while (!isSpaceChar(c));   return res.toString();  }  private boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputUtil in = new InputUtil(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  HashMap<Integer, Integer> left = new HashMap<Integer, Integer>();  public void solve(int testNumber, InputUtil in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] res = new int[n];   int[] arr = in.nextIntArray(n);   IntDeque[] adj = IntDeque.IntDeques(n);   boolean[] self = new boolean[n];   boolean[] assigned = new boolean[n];   for (int i = 0; i < n; i++) {    left.put(arr[i], i);   }   for (int i = 0; i < n; i++) {    int x = arr[i];    boolean canA = left.containsKey(a - x);    boolean canB = left.containsKey(b - x);    if (!canA && !canB) {     out.println("NO");     return;    }    if (left.containsKey(a - x)) {     self[i] |= x == a - x;     if (x != a - x) {      adj[i].add(left.get(a - x));     }    }    if (left.containsKey(b - x)) {     self[i] |= x == b - x;     if (x != b - x) {      adj[i].add(left.get(b - x));     }    }   }   if (a == b) {    out.println("YES");    out.println(IntArrayUtil.toString(res));    return;   }   for (int iter = 0; iter < 2; iter++) {    for (int i = 0; i < n; i++) {     if (!self[i] && !assigned[i] && (iter == 1 || adj[i].size() == 1)) {      int u = i;      DFS:      while (true) {       assigned[u] = true;       if (self[u] && arr[u] == b - arr[u]) {        res[u] = 1;        break;       }       for (int v : adj[u]) {        if (!assigned[v]) {         assigned[v] = true;         if (arr[u] == b - arr[v]) {          res[u] = res[v] = 1;         }         for (int newU : adj[v]) {          if (!assigned[newU]) {           u = newU;           continue DFS;          }         }         break DFS;        }       }       out.println("NO");       return;      }     }     else if (iter == 1 && !assigned[i] && adj[i].size() == 0 && arr[i] == b - arr[i]) {      res[i] = 1;     }    }   }   out.println("YES");   out.println(IntArrayUtil.toString(res));  }  } class InputUtil {  JoltyScanner in;  public InputUtil(InputStream istream) {   in = new JoltyScanner(istream);  }  public String next() {   return in.next();  }  public int nextInt() {   return Integer.parseInt(next());  }  public int[] nextIntArray (int size) {   int[] arr = new int[size];   for (int i = 0; i < size; i++) {    arr[i] = in.nextInt();   }   return arr;  } } class IntDeque implements Iterable<Integer> {  private int capacity;  private int size = 0;  private int front = 0;  private int back = 0;  private int[] deque;  public IntDeque() {   this(16);  }  public IntDeque(int capacity) {   this.capacity = capacity;   deque = new int[capacity];  }  public static IntDeque[] IntDeques(int length) {   IntDeque[] arr = new IntDeque[length];   for (int i = 0; i < length; i++) {    arr[i] = new IntDeque();   }   return arr;  }  public <T extends Iterable<Integer>>IntDeque(T intList) {   this(16);   addAll(intList);  }  public IntDeque(int[] intArr) {   this(16);   for (int i: intArr) {    addLast(i);   }  }  public void add(int x) {   addLast(x);  }  public <T extends Iterable<Integer>>void addAll(T intList) {   for (int i: intList) {    addLast(i);   }  }  public void addLast(int x) {   ensureCapacity();   size++;   deque[back++] = x;   if (back == capacity) {    back = 0;   }  }  public void ensureCapacity() {   if (size < capacity) {    return;   }   int[] newDeque = new int[capacity << 1];   for (int i = 0, j = front; i < size; i++, j++) {    if (j == capacity) {     j = 0;    }    newDeque[i] = deque[j];   }   deque = newDeque;   capacity <<= 1;   front = 0;   back = size;  }  public Iterator<Integer> iterator() {   return new Iterator<Integer>() {    int done = 0;    int curr = front;    public boolean hasNext() {     return done < size;    }    public Integer next() {     Integer res = deque[curr++];     if (curr == capacity) {      curr = 0;     }     done++;     return res;    }    public void remove() {     throw new UnsupportedOperationException();    }   };  }  public int size() {   return size;  }  public String toString() {   if (size == 0) {    return "";   }   StringBuilder res = new StringBuilder();   for (int i: this) {    res.append(i);    res.append(" ");   }   res.setLength(res.length() - 1);   return res.toString();  } } class IntArrayUtil {  public static String toString(int[] arr) {   return toString(arr, " ");  }  public static String toString(int[] arr, String delimiter) {   StringBuilder res = new StringBuilder();   for (int i: arr) {    res.append(i);    res.append(delimiter);   }   res.setLength(res.length() - delimiter.length());   return res.toString();  } } class JoltyScanner {  public static final int BUFFER_SIZE = 1 << 16; public static final char NULL_CHAR = (char) -1;  StringBuilder str = new StringBuilder(); byte[] buffer = new byte[BUFFER_SIZE]; boolean EOF_FLAG = false; int bufferIdx = 0, size = 0; char c = NULL_CHAR; BufferedInputStream in;  public JoltyScanner(InputStream in) {  this.in = new BufferedInputStream(in, BUFFER_SIZE); }  public int nextInt() {  long x = nextLong();  if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) {  throw new ArithmeticException("Scanned value overflows integer");  }  return (int) x; }  public long nextLong() {  boolean negative = false;  if (c == NULL_CHAR) {  c = nextChar();  }  for (; !EOF_FLAG && (c < '0' || c > '9'); c = nextChar()) {  if (c == '-') {   negative = true;  }    }  checkEOF();  long res = 0;  for (; c >= '0' && c <= '9'; c = nextChar()) {  res = (res << 3) + (res << 1) + c - '0';  }  return negative ? -res : res; }  public String next() {  checkEOF();  if (c == NULL_CHAR) {  c = nextChar();  }  while (Character.isWhitespace(c)) {  c = nextChar();  checkEOF();  }  str.setLength(0);  for (; !EOF_FLAG && !Character.isWhitespace(c); c = nextChar()) {  str.append(c);  }  return str.toString(); }  public char nextChar() {  if (EOF_FLAG) {  return NULL_CHAR;  }  while (bufferIdx == size) {  try {   size = in.read(buffer);   if (size == -1) {   throw new Exception();   }  } catch (Exception e) {   EOF_FLAG = true;   return NULL_CHAR;  }  if (size == -1) {   size = BUFFER_SIZE;  }  bufferIdx = 0;  }  return (char) buffer[bufferIdx++]; }  public void checkEOF() {  if (EOF_FLAG) {  throw new EndOfFileException();  } }  public class EndOfFileException extends RuntimeException { } }
0	public class Rules implements Runnable { private Scanner in = new Scanner(System.in); private PrintWriter out = new PrintWriter(System.out); private double a, v, l, d, w; private double ans;  public static void main(String[] args) {  new Thread(new Rules()).start(); }  public void run() {  read();  solve();  write();  out.close(); }  private void read() {  a = in.nextInt();  v = in.nextInt();  l = in.nextInt();  d = in.nextInt();  w = in.nextInt(); }  private double remaining(double v0, double dst) {  double t = (v - v0) / a;  double d = a * t * t / 2 + t * v0;  if (d > dst)  return (Math.sqrt(v0 * v0 + 2 * a * dst) - v0) / a;  return t + (dst - d) / v; }  private void solve() {  if (w * w >= 2 * a * d || w >= v) {  ans = remaining(0, l);  return;  }  {  double t1 = v / a;  double t2 = (v - w) / a;  double dd = a * t1 * t1 / 2 + a * t2 * t2 / 2 + w * t2;  if (dd < d) {   ans = t1 + t2 + (d - dd) / v + remaining(w, l - d);   return;  }  }  double t1 = w / a;  double rd = d - t1 * t1 * a / 2;  double t2 = (Math.sqrt(w * w + a * rd) - w) / a;  ans = t1 + 2 * t2 + remaining(w, l - d); }  private void write() {  out.printf("%.7f\n", ans); } }
0	public class Main {  public static void main(String[] args) throws IOException {  new Main().run(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {  if (new File("input.txt").exists())  in = new BufferedReader(new FileReader("input.txt"));  else  in = new BufferedReader(new InputStreamReader(System.in));  if (new File("output.txt").exists())  out = new PrintWriter("output.txt");  else  out = new PrintWriter(System.out);  solve();  in.close();  out.close(); }  void solve() throws IOException {  long l = nextLong();  long r = nextLong();  l += l % 2;  if (l + 2 > r)  out.println("-1");  else {  out.println(l + " " + (l + 1) + " " + (l + 2));  } }  String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); }  String nextToken() throws IOException {  while (!st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }  return st.nextToken(); }  int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); }  boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String str = in.readLine();  if (str == null)   return true;  st = new StringTokenizer(str);  }  return false; } }
1	public class Dialog1 {   private static int n ;   private static String s ;   private static char[] a;   public static void main(String[] args) {    Scanner input = new Scanner(System.in);    n = input.nextInt() ;    s = input.next() ;    a = s.toCharArray();    for(int i = 0 ; i < 200 ; ++i) {     int cur = i ;     boolean fl = true ;     for(int j = 0 ; j < n ; ++j) {      if(a[j] == '+')       ++cur ;      else       --cur ;      if(cur < 0)       fl = false ;     }     if(fl) {      System.out.print(cur);      return ;     }    }   }  }
1	public class ProblemB {  Map<Integer, List<int[]>> dest;  private ProblemB() throws IOException {   BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));   String h = rd.readLine();   String[] q = h.split("\\s+");   int a = Integer.parseInt(q[1]);   int b = Integer.parseInt(q[2]);   h = rd.readLine();   q = h.split(" ");   int n = q.length;   int[] p = new int[n];   for(int i=0;i<n;i++) {    p[i] = Integer.parseInt(q[i]);   }   Set<Integer> pset = new HashSet<>();   for(int x: p) {    pset.add(x);   }   if(a == b) {    boolean res = true;    for(int x: p) {     if(!pset.contains(a-x)) {      res = false;      break;     }    }    out(res?"YES":"NO");    if(res) {     StringBuilder buf = new StringBuilder();     for(int i=0;i<n;i++) {      if(i > 0) {       buf.append(' ');      }      buf.append('0');     }     out(buf);    }   } else {    dest = new HashMap<>();    boolean res = true;    for(int x: p) {     boolean aOk = pset.contains(a-x);     boolean bOk = pset.contains(b-x);     if(!aOk && !bOk) {      res = false;      break;     } else {      if(aOk) {       addEdgeAndBack(x,a-x,0);      }      if(bOk) {       addEdgeAndBack(x,b-x,1);      }     }    }    Set<Integer> aSet = new HashSet<>();    if(res) {     for(int x: p) {      List<int[]> e = getEdges(x);      if(e.size() == 1) {       int[] edge = e.get(0);       if(edge[0] == x) {        if(edge[1] == 0) {         aSet.add(x);        }       } else {        boolean odd = true;        int curA = edge[1];        int prev = x;        while(true) {         int cur = edge[0];         if(curA == 0 && odd) {          aSet.add(prev);          aSet.add(cur);         }         e = getEdges(cur);         if(e.size() == 1) {          if(!odd && e.get(0)[0] != cur) {           res = false;          }          break;         }         int other = e.get(0)[0] == prev?1:0;         edge = e.get(other);         if(edge[1] == curA) {          res = false;          break;         }         curA = 1-curA;         prev = cur;         odd = !odd;        }        if(!res) {         break;        }       }      }     }    }    out(res?"YES":"NO");    if(res) {     StringBuilder buf = new StringBuilder();     for(int i=0;i<n;i++) {      if(i>0) {       buf.append(' ');      }      buf.append(aSet.contains(p[i])?'0':'1');     }     out(buf);    }   }  }  private void addEdgeAndBack(int from, int to, int u) {   addEdge(from, to, u);   addEdge(to, from, u);  }  private void addEdge(int from, int to, int u) {   List<int[]> edges = getEdges(from);   for(int[] edge: edges) {    if(edge[0] == to) {     return;    }   }   edges.add(new int[] { to, u });  }  private List<int[]> getEdges(int from) {   List<int[]> ds = dest.get(from);   if(ds == null) {    ds = new ArrayList<>();    dest.put(from, ds);   }   return ds;  }  private static void out(Object x) {   System.out.println(x);  }  public static void main(String[] args) throws IOException {   new ProblemB();  } }
1	public class Main { static int MAX = 1000;  static BitSet P = new BitSet(MAX + 1);   public static boolean Noldbach(int n) {  n--;   int j;   for(int i=2; i<=n; i++)  {  if(!P.get(i))  {   j = i + 1;     while(P.get(j))   j++;     if(i+j == n)   {   if(!P.get(i+j+1))   {          return true;   }   }  }  }   return false; }  public static void main(String[] args) {  Scanner lee = new Scanner(System.in);   for(int i=2; i*i<=MAX; i++)  {   if(!P.get(i))   {   for(int j=i+i; j<=MAX; j+=i)    P.set(j);   }  }   int n, k, c;   n = lee.nextInt();  k = lee.nextInt();   c = 0;   for(int i=2; i<=n; i++)  {  if(Noldbach(i))   c++;    if(c == k)   break;  }   if(c == k)  System.out.println("YES");  else  System.out.println("NO"); } }
2	public class _817C {  static long sum = 0;  static long BSearch2(long st, long end, long lim) {   if (st > end) return 0;   long mid = (st + end) >> 1;   if (mid - sumDigit(mid) >= lim) {    sum = mid;    return BSearch2(st, mid - 1, lim);   }   if (mid - sumDigit(mid) < lim)    return BSearch2(mid + 1, end, lim);   return 0;  }  public static void main(String[] args) throws IOException {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   StringTokenizer st = new StringTokenizer(in.readLine());   long s = Long.parseLong(st.nextToken());   long n = Long.parseLong(st.nextToken());   BSearch2(1, s, n);   if (sum == 0) System.out.println("0");   else System.out.println(s - sum + 1);  }  static long sumDigit(long z) {   String s = "" + z;   int c = 0;   for (int i = 0; i < s.length(); i++) c += s.charAt(i);   return c - s.length() * 0x30;  } }
5	public class A { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  int n = ni();  int[] a = new int[n];  int[] b = new int[n];  for(int i = 0;i < n;i++)b[i] = a[i] = ni();   Arrays.sort(b);  int ct = 0;  for(int i = 0;i < n;i++){  if(a[i] != b[i])ct++;  }  if(ct <= 2){  out.println("YES");  }else{  out.println("NO");  } }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception {  new A().run(); }  public int ni() {  try {  int num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public long nl() {  try {  long num = 0;  boolean minus = false;  while((num = is.read()) != -1 && !((num >= '0' && num <= '9') || num == '-'));  if(num == '-'){   num = 0;   minus = true;  }else{   num -= '0';  }    while(true){   int b = is.read();   if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');   }else{   return minus ? -num : num;   }  }  } catch (IOException e) {  }  return -1; }  public String ns() {  try{  int b = 0;  StringBuilder sb = new StringBuilder();  while((b = is.read()) != -1 && (b == '\r' || b == '\n' || b == ' '));  if(b == -1)return "";  sb.append((char)b);  while(true){   b = is.read();   if(b == -1)return sb.toString();   if(b == '\r' || b == '\n' || b == ' ')return sb.toString();   sb.append((char)b);  }  } catch (IOException e) {  }  return ""; }  public char[] ns(int n) {  char[] buf = new char[n];  try{  int b = 0, p = 0;  while((b = is.read()) != -1 && (b == ' ' || b == '\r' || b == '\n'));  if(b == -1)return null;  buf[p++] = (char)b;  while(p < n){   b = is.read();   if(b == -1 || b == ' ' || b == '\r' || b == '\n')break;   buf[p++] = (char)b;  }  return Arrays.copyOf(buf, p);  } catch (IOException e) {  }  return null; }   double nd() { return Double.parseDouble(ns()); } boolean oj = System.getProperty("ONLINE_JUDGE") != null; void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
1	public class B implements Runnable {  void Solution() throws IOException {  int n = nextInt(), k = nextInt();  int[] mas = new int[n];  for (int i = 0; i < n; i++)  mas[i] = nextInt();  int l = 0, r = 0;  HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();  map.put(mas[l], 1);  int cur = 1;  while (true) {  if (cur == k) {   print(l + 1, r + 1);   return;  }  r++;  if (r >= n)   break;  int kol = map.containsKey(mas[r]) ? map.remove(mas[r]) : 0;  if (kol == 0) {   cur++;   map.put(mas[r], 1);  } else   map.put(mas[r], kol + 1);  while (true) {   kol = map.remove(mas[l]);   if (kol == 1) {   map.put(mas[l], 1);   break;   } else   map.put(mas[l++], kol - 1);  }  }  print(-1, -1); }  public static void main(String[] args) {  new B().run(); }  BufferedReader in; PrintWriter out; StringTokenizer tokenizer;  public void run() {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  Solution();  out.close();  } catch (Exception e) {  e.printStackTrace();  System.exit(0);  } }  void print(Object... obj) {  for (int i = 0; i < obj.length; i++) {  if (i != 0)   out.print(" ");  out.print(obj[i]);  } }  void println(Object... obj) {  print(obj);  out.println(); }  void halt() {  out.close();  System.exit(0); }  String nextLine() throws IOException {  return in.readLine(); }  String next() throws IOException {  while (tokenizer == null || !tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(nextLine());  return tokenizer.nextToken(); }  int nextInt() throws NumberFormatException, IOException {  return Integer.parseInt(next()); }  long nextLong() throws NumberFormatException, IOException {  return Long.parseLong(next()); }  double nextDouble() throws NumberFormatException, IOException {  return Double.parseDouble(next()); } }
1	public class Main implements Runnable { StreamTokenizer ST;  PrintWriter out;  BufferedReader br;  Scanner in; static final int inf = 1000000000;  int nextInt() throws IOException{   ST.nextToken();   return (int)ST.nval;  } long nextLong() throws IOException{   ST.nextToken();   return (long)ST.nval;  }  String next() throws IOException{   ST.nextToken();   return ST.sval;  }  double nextD() throws IOException{   ST.nextToken();   return ST.nval;  }  public static void main(String[] args) throws IOException {    new Thread(new Main()).start(); }  public void run() {   try {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));         in = new Scanner(br);   ST = new StreamTokenizer(br);    solve();    out.close();     br.close();   }    catch (IOException e) {     e.printStackTrace();   throw new IllegalStateException(e);  }  }  public void solve() throws IOException {  int n = nextInt();  int K = nextInt();  boolean[] f = new boolean[n+1];  Arrays.fill(f, true);  Vector<Integer> P = new Vector<Integer>();  for (int i=2; i<=n; i++)   if (f[i]) {    for (int j=2*i; j<=n; j+=i)     f[j] = false;    P.add(i);   }  for (int i=0; i<P.size()-1; i++) {   int x = P.elementAt(i)+P.elementAt(i+1)+1;   if (x<=n && f[x]) K--;  }  if (K<=0) out.println("YES"); else out.println("NO");    }  }
1	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   FastReader in = new FastReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskB solver = new TaskB();   solver.solve(1, in, out);   out.close();  } } class TaskB {  int val[];  int p[];  int aneigh[], bneight[], deg[];  Deque<Integer> mycycle;  boolean loops = false;  public void solve(int testNumber, FastReader in, PrintWriter out)  {   int n = in.ni ();   val = new int[n];   int a = in.ni ();   int b = in.ni ();   Map<Integer, Integer> set = new TreeMap<Integer, Integer> ();   p = in.iArr (n);   for (int i = 0; i < n; i++)   {    set.put (p[i], i);   }   aneigh = new int[n];   bneight = new int[n];   deg = new int[n];   for (int i = 0; i < n; i++)   {    aneigh[i] = val[i] = bneight[i] = -1;    deg[i] = 0;   }   Queue<Integer> queue = new ArrayDeque<Integer> ();   for (int i = 0; i < n; i++)   {    Integer x1 = set.get (a - p[i]);    Integer x2 = set.get (b - p[i]);    if (x1 != null)    {     aneigh[i] = x1;     deg[i]++;    }    if (x2 != null && a != b)    {     bneight[i] = x2;     deg[i]++;    }    if (deg[i] == 1)    {     queue.add (i);    }   }   while (!queue.isEmpty ())   {    int idx = queue.remove ();    if (deg[idx] != 1)    {     continue;    }    int aa = aneigh[idx];    int bb = bneight[idx];    if (aa != -1)    {     val[idx] = val[aa] = 0;     deg[aa]--;     deg[idx]--;     aneigh[aa] = -1;     aneigh[idx] = -1;     if (deg[aa] == 1)     {      int zz = bneight[aa];      bneight[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)      queue.add (zz);     }    }    else    {     val[idx] = val[bb] = 1;     deg[bb]--;     deg[idx]--;     bneight[idx] = bneight[bb] = -1;     if (deg[bb] == 1)     {           int zz = aneigh[bb];      aneigh[zz] = -1;      deg[zz]--;      if(deg[zz] == 1)       queue.add (zz);     }    }   }   for (int i = 0; i < n; i++)   {    if (val[i] == -1 && cantBePaired(i))    {     out.println ("NO");     return;    }   }         for (int i = 0; i < n; i++)   {    if (val[i] == -1)    {     mycycle = new ArrayDeque<Integer> ();     loops = false;     cycle (i);     if (loops || mycycle.size () % 2 == 0)     {      doEvenCycle ();      continue;     }     out.println ("NO");     return;    }   }   out.println ("YES");   for (int i = 0; i < n; i++)   {    out.print (val[i] + " ");   }   out.println ();  }  private boolean cantBePaired(int i)  {   int aa = aneigh[i];   int bb = bneight[i];   if (aa != -1 && val[aa] == -1)   {    return false;   }   if (bb != -1 && val[bb] == -1)   {    return false;   }   return true;  }   private void doEvenCycle()  {   for (int x : mycycle)   {    val[x] = 0;   }  }  private void cycle(int i)  {   boolean aa = false;   int prev = i;   mycycle.addLast (i);   System.out.println (i);   int j = aneigh[i];   while (j != i)   {    if (j == prev)    {     loops = true;     break;    }    mycycle.addLast (j);    System.out.println (j);    prev = j;    j = aa ? aneigh[j] : bneight[j];      aa = !aa;   }   if (loops)   {    j = bneight[i];    prev = i;    aa = true;    while (prev != j)    {     mycycle.addFirst (j);     prev = j;     j = aa ? aneigh[j] : bneight[j];     aa = !aa;    }   }   System.out.println ("XXX");  } } class FastReader {  public InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;  public FastReader(InputStream stream)  {   this.stream = stream;  }  public FastReader()  {  }  public int read()  {   if (numChars == -1)   {    throw new InputMismatchException ();   }   if (curChar >= numChars)   {    curChar = 0;    try    {     numChars = stream.read (buf);    } catch (IOException e)    {     throw new InputMismatchException ();    }    if (numChars <= 0)    {     return -1;    }   }   return buf[curChar++];  }  public int ni()  {   int c = read ();   while (isSpaceChar (c))    c = read ();   int sgn = 1;   if (c == '-')   {    sgn = -1;    c = read ();   }   int res = 0;   do   {    if (c < '0' || c > '9')    {     throw new InputMismatchException ();    }    res *= 10;    res += c - '0';    c = read ();   } while (!isSpaceChar (c));   return res * sgn;  }  public boolean isSpaceChar(int c)  {   if (filter != null)   {    return filter.isSpaceChar (c);   }   return isWhitespace (c);  }  public static boolean isWhitespace(int c)  {   return c==' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int[] iArr(int n)  {   int a[] = new int[n];   for (int i = 0; i < n; i++)   {    a[i] = ni ();   }   return a;  }  public interface SpaceCharFilter  {   public boolean isSpaceChar(int ch);  } }
0	public class Main {  public static void main(String[] args) {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  try {  String[] str = reader.readLine().split(" ");  BigInteger b1 = new BigInteger(str[0]);  BigInteger b2 = new BigInteger(str[1]);   if(b2.subtract(b1).compareTo(new BigInteger("1"))<1){   System.out.println(-1);   return;  }   if(b2.subtract(b1).compareTo(new BigInteger("2"))==0){   BigInteger b = b1.add(new BigInteger("1"));   BigInteger c = b1.add(new BigInteger("2"));   if(!b1.gcd(c).equals(new BigInteger("1"))){   System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());   }else{   System.out.println(-1);   }   return;  }   BigInteger b = b1.add(new BigInteger("1"));  BigInteger c = b1.add(new BigInteger("2"));  BigInteger d = b1.add(new BigInteger("3"));   if(b1.remainder(new BigInteger("2")).equals(new BigInteger("1"))){   System.out.println(b.toString()+" "+c.toString()+" "+d.toString());  }else{   System.out.println(b1.toString()+" "+b.toString()+" "+c.toString());  }  } catch (IOException e) {    e.printStackTrace();  }  } }
3	public class Main { static final int MAXN= 1005; static final long MOD =1_000_000_007; static final boolean DEBUG= false; static int n, m; static long stlr[][]= new long[MAXN][MAXN],bell[]= new long[MAXN],occ[]; static PrintStream cerr=System.err; public static void main(String[] args) {   Readin();  stlr[0][0]= bell[0] =1;  for (int i=1; i<=m; i++)  for (int j=1;j<=i;j++) {   stlr[i][j]= (stlr[i-1][j-1]+stlr[i-1][j]*(long)j)%MOD;   bell[i]= (bell[i]+stlr[i][j])%MOD;  }  if (DEBUG)  for (int i=1; i<=m; i++) cerr.println("Bell["+i+"] ="+bell[i]);  Arrays.sort(occ);  if (DEBUG) {  cerr.println("After Sorting");  for (int i=0;i<m; i++) cerr.println(occ[i]+" ");}  long ans=1;  for (int i=0,j=0; i<m; i=j) {  for (j=i+1; j<m && occ[i]==occ[j];j++);  ans= (ans*bell[j-i])%MOD;  }  System.out.println(ans); } static void Readin() {  Scanner cin;  if ( !DEBUG)cin= new Scanner(System.in);  else {  try {   cin = new Scanner(new File("input.txt"));  } catch (FileNotFoundException e) {     if ( DEBUG)cerr.println("Not Fount input.txt");   return ;  }  }  m = cin.nextInt(); n=cin.nextInt();  occ= new long[m];  for (int i=0; i<n; i++) {  String s= cin.next();  for (int j=0;j <m; j++)   occ[j]|=((long)(s.charAt(j)-'0'))<<i;  }  cin.close(); } }
0	public class ProblemD_05 {   final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;  BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");   void init() throws FileNotFoundException{   if (ONLINE_JUDGE){    in = new BufferedReader(new InputStreamReader(System.in));    out = new PrintWriter(System.out);   }else{    in = new BufferedReader(new FileReader("input.txt"));    out = new PrintWriter("output.txt");   }  }   String readString() throws IOException{   while(!tok.hasMoreTokens()){    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }   int readInt() throws IOException{   return Integer.parseInt(readString());  }   long readLong() throws IOException{   return Long.parseLong(readString());  }   double readDouble() throws IOException{   return Double.parseDouble(readString());  }   public static void main(String[] args){   new ProblemD_05().run();  }   public void run(){   try{    long t1 = System.currentTimeMillis();    init();    solve();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time = "+(t2-t1));   }catch (Exception e){    e.printStackTrace(System.err);    System.exit(-1);   }  }   void solve() throws IOException{   double a = readDouble();   double v = readDouble();   double l = readDouble();   double d = readDouble();   double w = readDouble();   double t = 0;   double td = d > v * v / (2 * a)? v / a + (d - v * v / (2 * a)) / v: sqrt(2 *d / a);   if (w >= min(a * td, v)){    t += td;    w = min(a * td, v);   }else{    double v0 = sqrt(w * w / 2 + a * d);    if (v0 * v0 <= v * v){     t += (2 * v0 - w) / a;    }else{     t += (2 * v - w) / a;     double s2 = d - (2 * v * v - w * w) / (2 * a);     t += s2 / v;    }   }   double t1 = (sqrt(w * w + 2 * a * (l - d)) - w) / a;   if (t1 > (v - w) / a) t1 = (v - w) / a;   t += t1;   double s1 = w * t1 + a * t1 * t1 / 2;   double t2 = (l - d - s1) / v;   t += t2;   out.printf(Locale.US, "%.12f", t);  }   static int[][] step8 = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}, {-1, -1}, {1, -1}, {-1, 1}, {1, 1}};   static int[][] stepKnight = {{-2, -1}, {-2, 1}, {-1, -2}, {-1, 2}, {1, -2}, {1, 2}, {2, -1}, {2, 1}};   static long gcd(long a, long b){   if (a == 0) return b;   return gcd(b % a, a);  }   static long lcm(long a, long b){   return a / gcd(a, b)*b;  }  static long[] gcdPlus(long a, long b){   long[] d = new long[3];   if (a == 0){    d[0] = b;    d[1] = 0;    d[2] = 1;   }else{    d = gcdPlus(b % a, a);    long r = d[1];    d[1] = d[2] - b/a*d[1];    d[2] = r;   }   return d;  }   static long binpow(long a, int n){   if (n == 0) return 1;   if ((n & 1) == 0){    long b = binpow(a, n/2);    return b*b;   }else return binpow(a, n - 1)*a;  }   static long binpowmod(long a, int n, long m){   if (m == 1) return 0;   if (n == 0) return 1;   if ((n & 1) == 0){    long b = binpowmod(a, n/2, m);    return (b*b) % m;   }else return binpowmod(a, n - 1, m)*a % m;  }   static long phi(long n){   int[] p = Sieve((int)ceil(sqrt(n)) + 2);   long phi = 1;   for (int i = 0; i < p.length; i++){    long x = 1;    while (n % p[i] == 0){     n /= p[i];     x *= p[i];    }    phi *= x - x/p[i];   }   if (n != 1) phi *= n - 1;   return phi;  }   static long f(long n, int x, int k){   if (n == 0) return 1;   long b = binpow(10, x - 1);   long c = n / b;   return (c < k? c: k)*binpow(k, x - 1) + (c < k? 1: 0)*f(n % b, x - 1, k);  }   static long fib(int n){   if (n == 0) return 0;   if ((n & 1) == 0){    long f1 = fib(n/2 - 1);    long f2 = fib(n/2 + 1);    return f2*f2 - f1*f1;   }else{    long f1 = fib(n/2);    long f2 = fib(n/2 + 1);    return f1*f1 + f2*f2;   }  }   static BigInteger BigFib(int n){   if (n == 0) return BigInteger.ZERO;   if ((n & 1) == 0){    BigInteger f1 = BigFib(n/2 - 1);    f1 = f1.multiply(f1);    BigInteger f2 = BigFib(n/2 + 1);    f2 = f2.multiply(f2);    return f2.subtract(f1);   }else{    BigInteger f1 = BigFib(n/2);    f1 = f1.multiply(f1);    BigInteger f2 = BigFib(n/2 + 1);    f2 = f2.multiply(f2);    return f2.add(f1);   }  }   static public class PointD{     double x, y;     public PointD(double x, double y){    this.x = x;    this.y = y;   }  }   static double d(Point p1, Point p2){   return sqrt(d2(p1, p2));  }   static public double d(PointD p1, PointD p2){   return sqrt(d2(p1, p2));  }   static double d2(Point p1, Point p2){   return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);  }   static public double d2(PointD p1, PointD p2){   return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);  }   static boolean IsProbablyPrime(long n){   if (n == 1) return false;   if ((n & 1) == 0) return false;   for (int j = 3; j < sqrt(n) + 1; j += 2){    if (n % j == 0) return false;   }   return true;  }  static int[] Sieve(int n){   boolean[] b = new boolean[n+1];   Arrays.fill(b, true);   b[0] = false;   b[1] = false;   long nLong = n;   int j=0;   for (int i = 1; i <= n; i++) {    if (b[i]){     j++;     if (((long)i)*i <= nLong) {      for (int k = i*i; k <= n; k += i) {       b[k] = false;      }     }    }   }   int[] p = new int[j];   Arrays.fill(p, 0);   j=0;   for (int i = 2; i <= n; i++) {    if (b[i]){     p[j]=i;     j++;    }   }   return p;  }   static int[][] Palindromes(String s){   char[] c = s.toCharArray();   int n = c.length;   int[][] d = new int[2][n];   int l = 0, r = -1;   for (int i = 0; i < n; i++){    int j = (i > r? 0: min(d[0][l+r-i+1], r-i+1)) + 1;    for (; i - j >= 0 && i + j - 1< n && c[i-j] == c[i+j-1]; j++);    d[0][i] = --j;    if (i + d[0][i] - 1 > r){     r = i + d[0][i] - 1;     l = i - d[0][i];    }   }   l = 0;   r = -1;   for (int i = 0; i < n; i++){    int j = (i > r? 0: min(d[1][l+r-i], r-i)) + 1;    for (; i - j >= 0 && i + j < n && c[i-j] == c[i+j]; j++);    d[1][i] = --j;    if (i + d[1][i] > r){     r = i + d[1][i];     l = i - d[1][i];    }   }   return d;  }   static public class Permutation {     int[] a;   int n;     public Permutation(int n){    this.n=n;    a=new int[n];    for (int i=0; i<n; i++){     a[i]=i;    }   }     public boolean nextPermutation(){    int i=n-1;    for (i=n-2; i>=0; i--){     if (a[i]<a[i+1]){      break;     }    }    if (i==-1){     return false;    }    int jMin=i+1;    for (int j=n-1; j>i; j--){     if (a[i]<a[j]&&a[j]<a[jMin]){      jMin=j;     }    }    swap(i, jMin);    for (int j=1; j<=(n-i)/2; j++){     swap(i+j, n-j);    }    return true;   }        public int get(int i){    return a[i];   }     void swap(int i, int j){    int r=a[i];    a[i]=a[j];    a[j]=r;   }  }   static public class Fraction implements Comparable<Fraction>, Cloneable{     public final Fraction FRACTION_ZERO = new Fraction();   public final Fraction FRACTION_ONE = new Fraction(1);   public long numerator = 0;   public long denominator = 1;     public Fraction(){    numerator = 0;    denominator = 1;   }     public Fraction(long numerator){    this.numerator = numerator;    denominator = 1;   }     public Fraction(long numerator, long denominator){    this.numerator = numerator;    this.denominator = denominator;    Cancellation();   }     public Fraction(double numerator, double denominator, int accuracy){    this.numerator = (long)(numerator*pow(10,accuracy));    this.denominator = (long)(denominator*pow(10,accuracy));    Cancellation();   }     public Fraction(String s){    if (s.charAt(0) == '-'){     denominator = -1;     s = s.substring(1);    }    if (s.indexOf("/") != -1){     denominator *= Integer.parseInt(s.substring(s.indexOf("/") + 1));    }    if (s.indexOf(" ") != -1){     numerator = Integer.parseInt(s.substring(0, s.indexOf(" "))) * abs(denominator) + Integer.parseInt(s.substring(s.indexOf(" ") + 1, s.indexOf("/")));    }else{     if (s.indexOf("/") != -1){      numerator = Integer.parseInt(s.substring(0, s.indexOf("/")));     }else{      numerator = Integer.parseInt(s)*abs(denominator);     }    }    this.Cancellation();   }     void Cancellation(){    long g = gcd(abs(numerator), abs(denominator));    numerator /= g;    denominator /= g;    if (denominator < 0){     numerator *= -1;     denominator *= -1;    }   }     public String toString(){    String s = "";    if (numerator == 0){     return "0";    }    if (numerator < 0){     s += "-";    }    if (abs(numerator) >= denominator){     s += Long.toString(abs(numerator) / denominator) + " ";    }    if (abs(numerator) % denominator != 0){     s += Long.toString(abs(numerator) % denominator);    }else{     s = s.substring(0, s.length()-1);    }    if (denominator != 1){     s += "/" + Long.toString(denominator);    }    return s;   }     public Fraction add(Fraction f){    Fraction fResult = new Fraction();    fResult.denominator = lcm(denominator, f.denominator);    fResult.numerator = numerator * fResult.denominator / denominator + f.numerator * fResult.denominator / f.denominator;    fResult.Cancellation();    return fResult;   }     public Fraction subtract(Fraction f){    Fraction fResult = new Fraction();    fResult.denominator = lcm(denominator, f.denominator);    fResult.numerator = numerator * fResult.denominator / denominator - f.numerator * fResult.denominator / f.denominator;    fResult.Cancellation();    return fResult;   }     public Fraction multiply(Fraction f){    Fraction fResult = new Fraction();    fResult.numerator = numerator * f.numerator;    fResult.denominator = denominator * f.denominator;    fResult.Cancellation();    return fResult;   }     public Fraction divide(Fraction f){    Fraction fResult = new Fraction();    fResult.numerator = numerator * f.denominator;    fResult.denominator = denominator * f.numerator;    fResult.Cancellation();    return fResult;   }     @Override   public int compareTo(Fraction f){    long g = gcd(denominator, f.denominator);    long res = numerator * (f.denominator / g) - f.numerator * (denominator / g);    if (res < 0){     return -1;    }    if (res > 0){     return 1;    }    return 0;   }     public Fraction clone(){    Fraction fResult = new Fraction(numerator, denominator);    return fResult;   }     public Fraction floor(){    Fraction fResult = this.clone();    fResult.numerator = (fResult.numerator / fResult.denominator) * fResult.denominator;    return fResult;   }     public Fraction ceil(){    Fraction fResult = this.clone();    fResult.numerator = (fResult.numerator/fResult.denominator + 1) * fResult.denominator;    return fResult;   }     public Fraction binpow(int n){    if (n==0) return FRACTION_ONE;    if ((n&1)==0){     Fraction f=this.binpow(n/2);     return f.multiply(f);    }else return binpow(n-1).multiply(this);   }  }   static public class FenwickTree_1{      int n;   long[] t;     public FenwickTree_1(int n){    this.n = n;    t = new long[n];   }     public long sum(int xl, int xr){    return sum(xr) - sum(xl);   }     public long sum(int x){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     result += t[i];    }    return result;   }     public void update(int x, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     t[i] += delta;    }   }  }   static public class FenwickTree_2{      int n, m;   long[][] t;     public FenwickTree_2(int n, int m){    this.n = n;    this.m = m;    t = new long[n][m];   }     public long sum(int xl, int yl, int xr, int yr){    return sum(xr, yr) - sum(xl - 1, yr) - sum(xr, yl - 1) + sum(xl - 1, yl - 1);   }     public long sum(int x, int y){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     for (int j = y; j >= 0; j = (j & (j + 1)) - 1){      result+=t[i][j];     }    }    return result;   }     public void update(int x, int y, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     for (int j = y; j < m; j = (j | (j + 1))){      t[i][j] += delta;     }    }   }  }   static public class FenwickTree_3{      int n, m, l;   long[][][] t;     public FenwickTree_3(int n, int m, int l){    this.n = n;    this.m = m;    this.l = l;    t = new long[n][m][l];   }     public long sum(int xl, int yl, int zl, int xr, int yr, int zr){    return sum(xr, yr, zr) - sum(xl - 1, yr, zr)    + sum(xl - 1, yr, zl - 1) - sum(xr, yr, zl - 1)    - sum(xr, yl - 1, zr) + sum(xl - 1, yl - 1, zr)    - sum(xl - 1, yl - 1, zl - 1) + sum(xr, yl - 1, zl - 1);   }     public long sum(int x, int y, int z){    long result = 0;    for (int i = x; i >= 0; i = (i & (i + 1)) - 1){     for (int j = y; j >= 0; j = (j & (j + 1)) - 1){      for (int k = z; k >= 0; k = (k & (k + 1)) - 1){       result += t[i][j][k];      }     }    }    return result;   }     public void update(int x, int y, int z, long delta){    for (int i = x; i < n; i = (i | (i + 1))){     for (int j = y; j < n; j = (j | (j + 1))){      for (int k = z; k < n; k = (k | (k + 1))){       t[i][j][k] += delta;      }     }    }   }  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  public void solve(int testNumber, InputReader in, PrintWriter out) {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] p = new int[n];   for (int i = 0; i < n; ++i)    p[i] = in.nextInt();   Map<Integer, Integer> position = new HashMap<>(n);   for (int i = 0; i < n; ++i)    position.put(p[i], i);   DisjointSet sets = new DisjointSet(n);   for (int i = 0; i < n; ++i) {    if (position.containsKey(a - p[i]))     sets.joinSet(i, position.get(a - p[i]));    if (position.containsKey(b - p[i]))     sets.joinSet(i, position.get(b - p[i]));   }   Group[] groups = new Group[n];   for (int i = 0; i < n; ++i)    if (sets.getSet(i) == i)     groups[i] = new Group();   for (int i = 0; i < n; ++i)    groups[sets.getSet(i)].value.add(p[i]);   int[] answer = new int[n];   for (Group group : groups) if (group != null) {    if (group.check(a)) {     for (int key : group.value)      answer[position.get(key)] = 0;    } else if (group.check(b)) {     for (int key : group.value)      answer[position.get(key)] = 1;    } else {     out.println("NO");     return;    }   }   out.println("YES");   for (int i = 0; i < n; ++i) {    if (i > 0) out.print(' ');    out.print(answer[i]);   }   out.println();  }  class Group {   Set<Integer> value = new HashSet<>();   boolean check(int sum) {    for (int key : value)     if (!value.contains(sum - key))      return false;    return true;   }  } } class InputReader {  private BufferedReader reader;  private StringTokenizer tokenizer;  public InputReader(InputStream stream) {   reader = new BufferedReader(new InputStreamReader(stream), 32768);   tokenizer = null;  }  public String next() {   while (tokenizer == null || !tokenizer.hasMoreTokens())    try {     tokenizer = new StringTokenizer(reader.readLine());    } catch (IOException e) {     throw new RuntimeException(e);    }   return tokenizer.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  } } class DisjointSet {  private final int[] label;  private int numSets;  private Listener listener;  public DisjointSet(int n, Listener listener) {   label = new int[n];   Arrays.fill(label, -1);   numSets = n;   this.listener = listener;  }  public DisjointSet(int n) {   this(n, null);  }  public int getSet(int at) {   if (label[at] < 0) return at;   return label[at] = getSet(label[at]);  }  public boolean sameSet(int u, int v) {   return getSet(u) == getSet(v);  }  public boolean joinSet(int u, int v) {   if (sameSet(u, v)) return false;   u = getSet(u);   v = getSet(v);   if (label[u] < label[v]) {    int tmp = u;    u = v;    v = tmp;   }   label[v] += label[u];   label[u] = v;   --numSets;   if (listener != null) listener.joined(u, v);   return true;  }  public static interface Listener {   public void joined(int joinedRoot, int root);  } }
4	public class Solution {  public static void main(String[] args)throws IOException {   FastReader in=new FastReader(System.in);   int t=in.nextInt();   StringBuilder sb=new StringBuilder();   int i,j,tc=0;   while(tc++<t) {    int n=in.nextInt();    int arr[]=new int[n];    for(i=0;i<n;i++)     arr[i]=in.nextInt();    int ans[]=new int[n+4];    ans[0]=1;    int pos=0;    sb.append("1\n");    for(i=1;i<n;i++){     if(arr[i]==arr[i-1]+1){      ans[pos]=ans[pos]+1;     }     else if(arr[i]==1){      pos++;      ans[pos]=1;     }     else{      while(ans[pos]!=arr[i]-1)       pos--;      ans[pos]=ans[pos]+1;     }     for(j=0;j<=pos;j++){      if(j<pos)       sb.append(ans[j]).append(".");      else       sb.append(ans[j]).append("\n");     }    }   }   System.out.println(sb);  } } class Node {  int setroot, dist;  public Node(int setroot, int dist){   this.setroot = setroot;   this.dist = dist;  }  @Override  public String toString() {   return String.format(setroot + ", " + dist);  } } class FastReader {  byte[] buf = new byte[2048];  int index, total;  InputStream in;  FastReader(InputStream is) {   in = is;  }  int scan() throws IOException {   if (index >= total) {    index = 0;    total = in.read(buf);    if (total <= 0) {     return -1;    }   }   return buf[index++];  }  String next() throws IOException {   int c;   for (c = scan(); c <= 32; c = scan()) ;   StringBuilder sb = new StringBuilder();   for (; c > 32; c = scan()) {    sb.append((char) c);   }   return sb.toString();  }  int nextInt() throws IOException {   int c, val = 0;   for (c = scan(); c <= 32; c = scan()) ;   boolean neg = c == '-';   if (c == '-' || c == '+') {    c = scan();   }   for (; c >= '0' && c <= '9'; c = scan()) {    val = (val << 3) + (val << 1) + (c & 15);   }   return neg ? -val : val;  }  long nextLong() throws IOException {   int c;   long val = 0;   for (c = scan(); c <= 32; c = scan()) ;   boolean neg = c == '-';   if (c == '-' || c == '+') {    c = scan();   }   for (; c >= '0' && c <= '9'; c = scan()) {    val = (val << 3) + (val << 1) + (c & 15);   }   return neg ? -val : val;  } }
1	public class test{              public static void main(String[] args) throws Exception, IOException{     Reader sc = new Reader(System.in);   int n=sc.nextInt(),m=sc.nextInt(),a[]=new int[n];  int b[]=new int[100000+1], r=n+1; for(int i=0;i<n;i++)a[i]=sc.nextInt();    int s=0,t=-1, sum=0;  int as=0,at=0; for(;;){  while(t<n-1 && sum<m){  t++;  if( b[ a[t] ]<1 ){sum++; }   b[a[t]]++; }  db(s,t,sum);  if( sum<m )break;  as=s;at=t;  r=min(r,t-s+1);  if( b[ a[s] ]==1 ){sum--; }   b[a[s]]--;  s++; }  if( n<r )System.out.println("-1 -1"); else System.out.println(as+1+" "+(at+1)); } static void db(Object... os){  System.err.println(Arrays.deepToString(os)); } }  class Reader { private BufferedReader x; private StringTokenizer st;  public Reader(InputStream in) {  x = new BufferedReader(new InputStreamReader(in));  st = null; } public String nextString() throws IOException {  while( st==null || !st.hasMoreTokens() )  st = new StringTokenizer(x.readLine());  return st.nextToken(); } public int nextInt() throws IOException {  return Integer.parseInt(nextString()); } public long nextLong() throws IOException {  return Long.parseLong(nextString()); } public double nextDouble() throws IOException {  return Double.parseDouble(nextString()); } }
1	public class stub implements Runnable {  public static void main(String[] args) {   new stub().run();  }  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer st;  public String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(br.readLine());   }   return st.nextToken();  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  private void solve() throws IOException {   int[] cnt = new int[(int) 1e6];   int n = nextInt();   int k = nextInt();   int[] a = new int[n];   for (int i = 0; i < n; i++) {    a[i] = nextInt();   }   int cur = 0;   int left = 0;   int i = left;   while (i < n && cur != k) {    if (cnt[a[i]] == 0) {     cur++;    }    cnt[a[i]]++;    i++;   }   i--;   if (cur != k) {    out.println("-1 -1");    return;   }   int right = i;   while (cnt[a[left]] > 1) {    cnt[a[left]]--;    left++;   }   out.println((left + 1) + " " + (right + 1));  }  public void run() {   try {    solve();    out.close();    br.close();   } catch (IOException e) {    e.printStackTrace();   }  } }
1	public class B {  public static void main(String[] args) throws Exception {   new B().solve();  }   void solve() throws IOException {   BufferedReader in = new BufferedReader(new     InputStreamReader(System.in));        String[] sp = in.readLine().split(" ");     int n = Integer.parseInt(sp[0]);   int k = Integer.parseInt(sp[1]);   int[] a = new int[n];   sp = in.readLine().split(" ");   for (int i = 0; i < n; i++) {    a[i] = Integer.parseInt(sp[i]);   }     HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();   int r = 0;   map.put(a[r], 1);   while (map.size() < k) {    r++;    if (r == n) {         System.out.println("-1 -1");     return;    }    if (map.containsKey(a[r])) {     map.put(a[r], map.get(a[r]) + 1);    } else {     map.put(a[r], 1);    }   }   int l = 0;   while (map.get(a[l]) > 1) {    map.put(a[l], map.get(a[l]) - 1);    l++;   }   System.out.println((l + 1) + " " + (r + 1));  } }
4	public class C {  static class IntList {  int data[] = new int[3];  int size = 0;  boolean isEmpty() {  return size == 0;  }  int size() {  return size;  }  int get(int index) {  if (index < 0 || index >= size) {   throw new IndexOutOfBoundsException();  }  return data[index];  }  void clear() {  size = 0;  }  void set(int index, int value) {  if (index < 0 || index >= size) {   throw new IndexOutOfBoundsException();  }  data[index] = value;  }  void expand() {  if (size >= data.length) {   data = copyOf(data, (data.length << 1) + 1);  }  }  void insert(int index, int value) {  if (index < 0 || index > size) {   throw new IndexOutOfBoundsException();  }  expand();  arraycopy(data, index, data, index + 1, size++ - index);  data[index] = value;  }  int delete(int index) {  if (index < 0 || index >= size) {   throw new IndexOutOfBoundsException();  }  int value = data[index];  arraycopy(data, index + 1, data, index, --size - index);  return value;  }  void push(int value) {  expand();  data[size++] = value;  }  int pop() {  if (size == 0) {   throw new NoSuchElementException();  }  return data[--size];  }  void unshift(int value) {  expand();  arraycopy(data, 0, data, 1, size++);  data[0] = value;  }  int shift() {  if (size == 0) {   throw new NoSuchElementException();  }  int value = data[0];  arraycopy(data, 1, data, 0, --size);  return value;  } }  static void solve() throws Exception {  int tests = scanInt();  IntList stack = new IntList();  for (int test = 0; test < tests; test++) {  stack.clear();  int n = scanInt();  for (int i = 0; i < n; i++) {   int v = scanInt();   if (v == 1) {   stack.push(v);   } else {   while (stack.pop() != v - 1) { }   stack.push(v);   }   for (int j = 0; j < stack.size; j++) {   if (j != 0) {    out.print('.');   }   out.print(stack.data[j]);   }   out.println();  }  } }  static int scanInt() throws IOException {  return parseInt(scanString()); }  static long scanLong() throws IOException {  return parseLong(scanString()); }  static String scanString() throws IOException {  while (tok == null || !tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  static BufferedReader in; static PrintWriter out; static StringTokenizer tok;  public static void main(String[] args) {  try {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);  solve();  in.close();  out.close();  } catch (Throwable e) {  e.printStackTrace();  exit(1);  } } }
2	public class Edu23 {  public static int sum(String s){  int tot=0;  for(int i =0; i<s.length();i++){  tot+=(s.charAt(i)-'0');  }  return tot; } public static BigInteger comb(int n, int k){  if(k==0)  return new BigInteger("1");  else  return comb(n,k-1).multiply(new BigInteger(n-k+1+"")).divide(new BigInteger(k+"")); } public static void main(String[] args) throws IOException {  Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long s = sc.nextLong();  long i;  for(i =s ; i-sum(i+"")<s;i++)  if(i%10==0)i+=9;  System.out.println(Math.max(0, n-i+1));   } static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(String f) throws FileNotFoundException {  br = new BufferedReader(new FileReader(f));  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  return Double.parseDouble(next());  }  public boolean ready() throws IOException {  return br.ready();  }  public int[] nextIntArray(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public int[] nextIntArray1(int n) throws IOException {  int[] a = new int[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextInt();  return a;  }  public int[] shuffle(int[] a, int n) {  int[] b = new int[n];  for (int i = 0; i < n; i++)   b[i] = a[i];  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   int t = b[i];   b[i] = b[j];   b[j] = t;  }  return b;  }  public int[] nextIntArraySorted(int n) throws IOException {  int[] a = nextIntArray(n);  a = shuffle(a, n);  Arrays.sort(a);  return a;  }  public long[] nextLongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArray1(int n) throws IOException {  long[] a = new long[n + 1];  for (int i = 1; i <= n; i++)   a[i] = nextLong();  return a;  }  public long[] nextLongArraySorted(int n) throws IOException {  long[] a = nextLongArray(n);  Random r = new Random();  for (int i = 0; i < n; i++) {   int j = i + r.nextInt(n - i);   long t = a[i];   a[i] = a[j];   a[j] = t;  }  Arrays.sort(a);  return a;  } } }
4	public class CF_1523_C{   void pre() throws Exception{}  void solve(int TC) throws Exception{   int N = ni();   int[] A = new int[N];   for(int i = 0; i< N; i++)A[i] = ni();    int[] stack = new int[2*N];   int sz = 0;   for(int i = 0; i< N; i++){    if(A[i] == 1)stack[sz++] = 1;    else{     while (sz > 0 && stack[sz-1]+1 != A[i])sz--;     hold(sz != 0);     stack[sz-1]++;     hold(stack[sz-1] == A[i]);    }    hold(sz != 0);    StringBuilder st = new StringBuilder();    for(int s = 0; s< sz; s++){     st.append(stack[s]);     if(s+1 < sz)st.append(".");    }    pn(st.toString());   }  }   void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}  void exit(boolean b){if(!b)System.exit(0);}  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}  final long IINF = (long)1e17;  final int INF = (int)1e9+2;  DecimalFormat df = new DecimalFormat("0.00000000000");  double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;  static boolean multipleTC = true, memory = true, fileIO = false;  FastReader in;PrintWriter out;  void run() throws Exception{   long ct = System.currentTimeMillis();   if (fileIO) {    in = new FastReader("");    out = new PrintWriter("");   } else {    in = new FastReader();    out = new PrintWriter(System.out);   }     int T = multipleTC? ni():1;   pre();   for (int t = 1; t <= T; t++) solve(t);   out.flush();   out.close();   System.err.println(System.currentTimeMillis() - ct);  }  public static void main(String[] args) throws Exception{   if(memory)new Thread(null, new Runnable() {public void run(){try{new CF_1523_C().run();}catch(Exception e){e.printStackTrace();System.exit(1);}}}, "1", 1 << 28).start();   else new CF_1523_C().run();  }  int[][] make(int n, int e, int[] from, int[] to, boolean f){   int[][] g = new int[n][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = to[i];    if(f)g[to[i]][--cnt[to[i]]] = from[i];   }   return g;  }  int[][][] makeS(int n, int e, int[] from, int[] to, boolean f){   int[][][] g = new int[n][][];int[]cnt = new int[n];   for(int i = 0; i< e; i++){    cnt[from[i]]++;    if(f)cnt[to[i]]++;   }   for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];   for(int i = 0; i< e; i++){    g[from[i]][--cnt[from[i]]] = new int[]{to[i], i, 0};    if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i, 1};   }   return g;  }  int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}  int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}  long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}  int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}  int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}  void p(Object... o){for(Object oo:o)out.print(oo+" ");}  void pn(Object... o){for(int i = 0; i< o.length; i++)out.print(o[i]+(i+1 < o.length?" ":"\n"));}  void pni(Object... o){for(Object oo:o)out.print(oo+" ");out.println();out.flush();}  String n()throws Exception{return in.next();}  String nln()throws Exception{return in.nextLine();}  int ni()throws Exception{return Integer.parseInt(in.next());}  long nl()throws Exception{return Long.parseLong(in.next());}  double nd()throws Exception{return Double.parseDouble(in.next());}  class FastReader{   BufferedReader br;   StringTokenizer st;   public FastReader(){    br = new BufferedReader(new InputStreamReader(System.in));   }   public FastReader(String s) throws Exception{    br = new BufferedReader(new FileReader(s));   }   String next() throws Exception{    while (st == null || !st.hasMoreElements()){     try{      st = new StringTokenizer(br.readLine());     }catch (IOException e){      throw new Exception(e.toString());     }    }    return st.nextToken();   }   String nextLine() throws Exception{    String str;    try{     str = br.readLine();    }catch (IOException e){     throw new Exception(e.toString());    }    return str;   }  } }
5	public class CF159DIV2 { FastScanner in; PrintWriter out;  void solve() {  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int[] a = new int[n];  for (int i = 0; i < n; i++)  a[i] = in.nextInt();  Arrays.sort(a);  for (int i = 0; i < a.length / 2; i++) {  int tmp = a[i];  a[i] = a[n - i - 1];  a[n - i - 1] = tmp;  }  int need = m;  int have = k;  int ans = 0;  int it = 0;  while (have < need) {  have += a[it++] - 1;  ans++;  if (it >= n) break;  }  if (have >= need) {  out.println(ans);  } else {  out.println(-1);  } }  void run() {  try {  in = new FastScanner(new File("object.in"));  out = new PrintWriter(new File("object.out"));   solve();   out.close();  } catch (FileNotFoundException e) {  e.printStackTrace();  } }  void runIO() {  in = new FastScanner(System.in);  out = new PrintWriter(System.out);  solve();  out.close(); }  class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(File f) {  try {   br = new BufferedReader(new FileReader(f));  } catch (FileNotFoundException e) {   e.printStackTrace();  }  }  public FastScanner(InputStream f) {  br = new BufferedReader(new InputStreamReader(f));  }  String next() {  while (st == null || !st.hasMoreTokens()) {   String s = null;   try {   s = br.readLine();   } catch (IOException e) {   e.printStackTrace();   }   if (s == null)   return null;   st = new StringTokenizer(s);  }  return st.nextToken();  }  boolean hasMoreTokens() {  while (st == null || !st.hasMoreTokens()) {   String s = null;   try {   s = br.readLine();   } catch (IOException e) {   e.printStackTrace();   }   if (s == null)   return false;   st = new StringTokenizer(s);  }  return true;  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }   double nextDouble() {  return Double.parseDouble(next());  } }  public static void main(String[] args) {  new CF159DIV2().runIO(); } }
3	public class D {  public static void solve(FastScanner fs) {  int n=fs.nextInt();  int[] a=fs.readArray(n);  boolean even=((countInversions(a)&1)==0);  int q=fs.nextInt();  for (int i=0; i<q; i++) {  int start=fs.nextInt();  int end=fs.nextInt();  int diff=end-start;  boolean evenChange=(diff+1)/2%2==0;  even^=!evenChange;  System.out.println(even?"even":"odd");  } }  private static int countInversions(int[] a) {  int c=0;  for (int i=0; i<a.length; i++) {  for (int j=i+1; j<a.length; j++)   if (a[j]<a[i])   c++;  }  return c; }      public static void main(String[] args) throws NumberFormatException, IOException {  FastScanner scanner = new FastScanner(System.in);  solve(scanner); }   private static class FastScanner {  BufferedReader br;  StringTokenizer st;  public FastScanner(InputStream in) {  br = new BufferedReader(new InputStreamReader(in));  }  String next() {  while (st == null || !st.hasMoreElements()) {   try {   st = new StringTokenizer(br.readLine());   } catch (IOException e) {   e.printStackTrace();   }  }  return st.nextToken();  }  int nextInt() {  return Integer.parseInt(next());  }  long nextLong() {  return Long.parseLong(next());  }  double nextDouble() {  return Double.parseDouble(next());  }  String nextLine() {  String str = "";  try {   str = br.readLine();  } catch (IOException e) {   e.printStackTrace();  }  return str;  }  int[] readArray(int n) {  int[] a=new int[n];  for (int i=0; i<n; i++)   a[i]=nextInt();  return a;  } } }
2	public class C3 { InputStream is; PrintWriter out; String INPUT = "";  void solve() {  long n = nl();  long S = nl();  long ret = Math.max(0, n-S+1);  for(long i = S;i <= S + 300 && i <= n;i++){  long b = i;  for(long x = i;x > 0;x /= 10){   b -= x % 10;  }  if(b < S)ret--;  }  out.println(ret); }  void run() throws Exception {  is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());  out = new PrintWriter(System.out);   long s = System.currentTimeMillis();  solve();  out.flush();  tr(System.currentTimeMillis()-s+"ms"); }  public static void main(String[] args) throws Exception { new C3().run(); }  private byte[] inbuf = new byte[1024]; public int lenbuf = 0, ptrbuf = 0;  private int readByte() {  if(lenbuf == -1)throw new InputMismatchException();  if(ptrbuf >= lenbuf){  ptrbuf = 0;  try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }  if(lenbuf <= 0)return -1;  }  return inbuf[ptrbuf++]; }  private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); } private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }  private double nd() { return Double.parseDouble(ns()); } private char nc() { return (char)skip(); }  private String ns() {  int b = skip();  StringBuilder sb = new StringBuilder();  while(!(isSpaceChar(b))){   sb.appendCodePoint(b);  b = readByte();  }  return sb.toString(); }  private char[] ns(int n) {  char[] buf = new char[n];  int b = skip(), p = 0;  while(p < n && !(isSpaceChar(b))){  buf[p++] = (char)b;  b = readByte();  }  return n == p ? buf : Arrays.copyOf(buf, p); }  private char[][] nm(int n, int m) {  char[][] map = new char[n][];  for(int i = 0;i < n;i++)map[i] = ns(m);  return map; }  private int[] na(int n) {  int[] a = new int[n];  for(int i = 0;i < n;i++)a[i] = ni();  return a; }  private int ni() {  int num = 0, b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private long nl() {  long num = 0;  int b;  boolean minus = false;  while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));  if(b == '-'){  minus = true;  b = readByte();  }   while(true){  if(b >= '0' && b <= '9'){   num = num * 10 + (b - '0');  }else{   return minus ? -num : num;  }  b = readByte();  } }  private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); } }
2	public class C { public static void main(String[] args) {  Scanner in = new Scanner(System.in);  long n = Long.parseLong(in.next());  long s = Long.parseLong(in.next());  if(!check(n, s)){  System.out.println(0);  }  else  {  long min = 1;  long max = n;  while(min != max)  {   long mid = (min + max) / 2;   if(check(mid, s))   {   max = mid;   }   else   {   min = mid + 1;   }  }    System.out.println((n - min + 1));  } } public static boolean check(long x, long s) {  if(x - sumd(x) < s)  {  return false;  }  else  {  return true;  } } public static long sumd(long x) {  long sum = 0;  while(x != 0)  {  sum += x % 10;  x /= 10;  }  return sum; } }
4	public class TestClass {  public static class FastWriter {   private static final int BUF_SIZE = 1 << 13;   private final byte[] buf = new byte[BUF_SIZE];   private final OutputStream out;   private int ptr = 0;   private FastWriter() {    out = null;   }   public FastWriter(OutputStream os) {    this.out = os;   }   public FastWriter(String path) {    try {     this.out = new FileOutputStream(path);    } catch (FileNotFoundException e) {     throw new RuntimeException("FastWriter");    }   }   public FastWriter write(byte b) {    buf[ptr++] = b;    if (ptr == BUF_SIZE) innerflush();    return this;   }   public FastWriter write(char c) {    return write((byte) c);   }   public FastWriter write(char[] s) {    for (char c : s) {     buf[ptr++] = (byte) c;     if (ptr == BUF_SIZE) innerflush();    }    return this;   }   public FastWriter write(String s) {    s.chars().forEach(c -> {     buf[ptr++] = (byte) c;     if (ptr == BUF_SIZE) innerflush();    });    return this;   }   private static int countDigits(int l) {    if (l >= 1000000000) return 10;    if (l >= 100000000) return 9;    if (l >= 10000000) return 8;    if (l >= 1000000) return 7;    if (l >= 100000) return 6;    if (l >= 10000) return 5;    if (l >= 1000) return 4;    if (l >= 100) return 3;    if (l >= 10) return 2;    return 1;   }   public FastWriter write(int x) {    if (x == Integer.MIN_VALUE) {     return write((long) x);    }    if (ptr + 12 >= BUF_SIZE) innerflush();    if (x < 0) {     write((byte) '-');     x = -x;    }    int d = countDigits(x);    for (int i = ptr + d - 1; i >= ptr; i--) {     buf[i] = (byte) ('0' + x % 10);     x /= 10;    }    ptr += d;    return this;   }   private static int countDigits(long l) {    if (l >= 1000000000000000000L) return 19;    if (l >= 100000000000000000L) return 18;    if (l >= 10000000000000000L) return 17;    if (l >= 1000000000000000L) return 16;    if (l >= 100000000000000L) return 15;    if (l >= 10000000000000L) return 14;    if (l >= 1000000000000L) return 13;    if (l >= 100000000000L) return 12;    if (l >= 10000000000L) return 11;    if (l >= 1000000000L) return 10;    if (l >= 100000000L) return 9;    if (l >= 10000000L) return 8;    if (l >= 1000000L) return 7;    if (l >= 100000L) return 6;    if (l >= 10000L) return 5;    if (l >= 1000L) return 4;    if (l >= 100L) return 3;    if (l >= 10L) return 2;    return 1;   }   public FastWriter write(long x) {    if (x == Long.MIN_VALUE) {     return write("" + x);    }    if (ptr + 21 >= BUF_SIZE) innerflush();    if (x < 0) {     write((byte) '-');     x = -x;    }    int d = countDigits(x);    for (int i = ptr + d - 1; i >= ptr; i--) {     buf[i] = (byte) ('0' + x % 10);     x /= 10;    }    ptr += d;    return this;   }   public FastWriter write(double x, int precision) {    if (x < 0) {     write('-');     x = -x;    }    x += Math.pow(10, -precision) / 2;       write((long) x).write(".");    x -= (long) x;    for (int i = 0; i < precision; i++) {     x *= 10;     write((char) ('0' + (int) x));     x -= (int) x;    }    return this;   }   public FastWriter writeln(char c) {    return write(c).writeln();   }   public FastWriter writeln(int x) {    return write(x).writeln();   }   public FastWriter writeln(long x) {    return write(x).writeln();   }   public FastWriter writeln(double x, int precision) {    return write(x, precision).writeln();   }   public FastWriter write(int... xs) {    boolean first = true;    for (int x : xs) {     if (!first) write(' ');     first = false;     write(x);    }    return this;   }   public FastWriter write(long... xs) {    boolean first = true;    for (long x : xs) {     if (!first) write(' ');     first = false;     write(x);    }    return this;   }   public FastWriter writeln() {    return write((byte) '\n');   }   public FastWriter writeln(int... xs) {    return write(xs).writeln();   }   public FastWriter writeln(long... xs) {    return write(xs).writeln();   }   public FastWriter writeln(char[] line) {    return write(line).writeln();   }   public FastWriter writeln(char[]... map) {    for (char[] line : map) write(line).writeln();    return this;   }   public FastWriter writeln(String s) {    return write(s).writeln();   }   private void innerflush() {    try {     out.write(buf, 0, ptr);     ptr = 0;    } catch (IOException e) {     throw new RuntimeException("innerflush");    }   }   public void flush() {    innerflush();    try {     out.flush();    } catch (IOException e) {     throw new RuntimeException("flush");    }   }   public FastWriter print(byte b) {    return write(b);   }   public FastWriter print(char c) {    return write(c);   }   public FastWriter print(char[] s) {    return write(s);   }   public FastWriter print(String s) {    return write(s);   }   public FastWriter print(int x) {    return write(x);   }   public FastWriter print(long x) {    return write(x);   }   public FastWriter print(double x, int precision) {    return write(x, precision);   }   public FastWriter println(char c) {    return writeln(c);   }   public FastWriter println(int x) {    return writeln(x);   }   public FastWriter println(long x) {    return writeln(x);   }   public FastWriter println(double x, int precision) {    return writeln(x, precision);   }   public FastWriter print(int... xs) {    return write(xs);   }   public FastWriter print(long... xs) {    return write(xs);   }   public FastWriter println(int... xs) {    return writeln(xs);   }   public FastWriter println(long... xs) {    return writeln(xs);   }   public FastWriter println(char[] line) {    return writeln(line);   }   public FastWriter println(char[]... map) {    return writeln(map);   }   public FastWriter println(String s) {    return writeln(s);   }   public FastWriter println() {    return writeln();   }  }   static final class InputReader {   private final InputStream stream;   private final byte[] buf = new byte[1024];   private int curChar;   private int numChars;   public InputReader(InputStream stream) {    this.stream = stream;   }   private int read() throws IOException {    if (curChar >= numChars) {     curChar = 0;     numChars = stream.read(buf);     if (numChars <= 0) {      return -1;     }    }    return buf[curChar++];   }   public final int readInt() throws IOException {    return (int) readLong();   }   public final long readLong() throws IOException {    int c = read();    while (isSpaceChar(c)) {     c = read();     if (c == -1) throw new IOException();    }    boolean negative = false;    if (c == '-') {     negative = true;     c = read();    }    long res = 0;    do {     res *= 10;     res += c - '0';     c = read();    } while (!isSpaceChar(c));    return negative ? -res : res;   }   public final int[] readIntArray(int size) throws IOException {    int[] array = new int[size];    for (int i = 0; i < size; i++) {     array[i] = readInt();    }    return array;   }   public final long[] readLongArray(int size) throws IOException {    long[] array = new long[size];    for (int i = 0; i < size; i++) {     array[i] = readLong();    }    return array;   }   public final String readString() throws IOException {    int c = read();    while (isSpaceChar(c)) {     c = read();    }    StringBuilder res = new StringBuilder();    do {     res.append((char) c);     c = read();    } while (!isSpaceChar(c));    return res.toString();   }   private boolean isSpaceChar(int c) {    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }  }  static long mulmod(long a, long b,       long mod) {   long res = 0;   a = a % mod;   while (b > 0) {       if (b % 2 == 1) {     res = (res + a) % mod;    }        a = (a * 2) % mod;        b /= 2;   }      return res % mod;  }  static long pow(long a, long b, long MOD) {   long x = 1, y = a;   while (b > 0) {    if (b % 2 == 1) {     x = (x * y);     if (x > MOD) x %= MOD;    }    y = (y * y);    if (y > MOD) y %= MOD;    b /= 2;   }   return x;  }  static long[] f = new long[200001];  static long InverseEuler(long n, long MOD) {   return pow(n, MOD - 2, MOD);  }  static long C(int n, int r, long MOD) {   return (f[n] * ((InverseEuler(f[r], MOD) * InverseEuler(f[n - r], MOD)) % MOD)) % MOD;  }   static int[] h = {0, 0, -1, 1};  static int[] v = {1, -1, 0, 0};   public static class Pair {   public int a;   public int b;   @Override   public boolean equals(Object o) {    if (this == o) return true;    if (o == null || getClass() != o.getClass()) return false;    Pair pair = (Pair) o;    return a == pair.a &&      b == pair.b;   }   @Override   public int hashCode() {    return Objects.hash(a, b);   }   public Pair(int a, int b) {    this.a = a;    this.b = b;   }  }  static class Pair2 {   public long cost;   int node;   public Pair2(long cos, int node) {    this.cost = cos;    this.node = node;   }  }  static long compute_hash(String s) {   int p = 31;   int m = 1000000007;   long hash_value = 0;   long p_pow = 1;   for (int i = 0; i < s.length(); ++i) {    char c = s.charAt(i);    hash_value = (hash_value + (c - 'a' + 1) * p_pow) % m;    p_pow = (p_pow * p) % m;   }   return hash_value;  }  public static class SegmentTree {   long[][] tree;   int n;   public SegmentTree(int[] nodes) {    tree = new long[nodes.length * 4][2];    n = nodes.length;    build(0, n - 1, 0, nodes);   }   private void build(int l, int r, int pos, int[] nodes) {    if (l == r) {     tree[pos][0] = nodes[l];     tree[pos][1] = l;     return;    }    int mid = (l + r) / 2;    build(l, mid, 2 * pos + 1, nodes);    build(mid + 1, r, 2 * pos + 2, nodes);    if (tree[2 * pos + 1][0] > tree[2 * pos + 2][0]) {     tree[pos][1] = tree[2 * pos + 1][1];    } else {     tree[pos][1] = tree[2 * pos + 2][1];    }    tree[pos][0] = Math.max(tree[2 * pos + 1][0], tree[2 * pos + 2][0]);   }           public long[] get(int l, int r) {    return getUtil(0, n - 1, 0, l, r);   }   private long[] getUtil(int l, int r, int pos, int ql, int qr) {    if (ql > r || qr < l) {     return new long[]{-1, -1};    }    if (l >= ql && r <= qr) {     return tree[pos];    }    int mid = (l + r) / 2;    long[] left = getUtil(l, mid, 2 * pos + 1, ql, qr);    long[] right = getUtil(mid + 1, r, 2 * pos + 2, ql, qr);    long choice = right[1];    if (left[0] > right[0]) choice = left[1];    return new long[]{Math.max(left[0], right[0]), choice};   }                                   }  static int counter = 0;  static int[] rIn;  static int[] rOut;  static int[] lIn;  static int[] lOut;  private static int[] flatten;  private static int[] lFlatten;  static long answer = 0;  static int VISITED = 1;  static int VISITING = 2;  static int[] DIRX = new int[]{0, 0, 1, -1};  static int[] DIRY = new int[]{1, -1, 0, 0};  public static class Pair22 {   int num, pos;   public Pair22(int x, int y) {    this.num = x;    this.pos = y;   }  }  public static long sumofdig(long n) {   long sum = 0;   while (n > 0) {    sum += n % 10;    n /= 10;   }   return sum;  }  public static void main(String[] args) throws Exception {     InputReader in = new InputReader(System.in);   FastWriter out = new FastWriter(System.out);       int t = in.readInt();    while (t-- > 0) {    int n = in.readInt();    Stack<Integer> s = new Stack<>();    System.out.println("1");    int i1 = in.readInt();    assert i1 == 1;    s.add(1);    for (int i = 1; i < n; ++i) {     int next = in.readInt();     if (next == 1) {     } else {      while ((s.peek() + 1) != next) {       s.pop();      }      s.pop();     }     s.add(next);     StringBuilder ans = new StringBuilder();     for (int c: s) {      ans.append(c).append(".");     }     out.println(ans.substring(0, ans.length() - 1));     out.flush();    }   }  }  private static void solvedd(int[] arr, int left, int right, int[] ans, int depth) {   if (left > right) return;   int maxInd = left;   for (int i = left; i <= right; ++i) {    if (arr[i] > arr[maxInd]) {     maxInd = i;    }   }   ans[maxInd] = depth;   solvedd(arr, left, maxInd - 1, ans, depth + 1);   solvedd(arr, maxInd + 1, right, ans, depth + 1);  }   private static void solved(List<List<Integer>> g, int node, int[][] dp, int last, int[] a) {   int donttake = 0;   int take = 0;   for (int i = 0; i < g.get(node).size(); ++i) {    int ntb = g.get(node).get(i);    if (ntb != last) {     solved(g, ntb, dp, node, a);     donttake += Math.max(dp[ntb][0], dp[ntb][1]);     take += dp[ntb][1];    }   }   dp[node][0] = a[node] + take;   dp[node][1] = donttake;  }   private static boolean solve(int n, List<Integer> nums, int cur, int pos, Boolean[][] dp) {   if (cur > n) return false;   if (cur == n) return true;   if (pos >= nums.size()) return false;   if (dp[cur][pos] != null) {    return dp[cur][pos];   }   boolean without = solve(n, nums, cur, pos + 1, dp);   boolean with = false;   int ogcur = cur;   for (int i = 1; i < 12; ++i) {    with |= solve(n, nums, cur + nums.get(pos), pos + 1, dp);    cur += nums.get(pos);   }   return dp[ogcur][pos] = with | without;  }            private static int dfs(HashMap<Pair, TreeSet<Pair>> grid, int x, int y, int ti, HashSet<Pair> vis, int r, int startX, int startY) {     int taken = ti - Math.abs(startX - x) - Math.abs(startY - y);   if (taken < 0) return 0;   if (x < 0 || y < 0 || x > r || y > r) return 0;   if (vis.contains(new Pair(x, y))) return 0;   int max = 0;   if (grid.containsKey(new Pair(x, y))) {    TreeSet<Pair> times = grid.get(new Pair(x, y));    for (Pair t : times) {     if (t.a <= taken) {      max = Math.max(t.b, max);     } else break;    }   }   vis.add(new Pair(x, y));   max = Math.max(dfs(grid, x + 1, y, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x, y + 1, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x - 1, y, ti, vis, r, startX, startY), max);   max = Math.max(dfs(grid, x, y - 1, ti, vis, r, startX, startY), max);   return max;  }  private static int solver(int[] nums, int pos, int[] dp) {   if (pos >= nums.length) return 0;   if (dp[pos] != Integer.MAX_VALUE) return dp[pos];   int min = solver(nums, pos + 2, dp) + nums[pos];   min = Math.min(solver(nums, pos + 3, dp) + nums[pos], min);   if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 3, dp));   if (pos + 1 < nums.length) min = Math.min(min, nums[pos] + nums[pos + 1] + solver(nums, pos + 4, dp));      return dp[pos] = min;  }   static int countFreq(String pattern, String text) {   int m = pattern.length();   int n = text.length();   int res = 0;   for (int i = 0; i <= n - m; i++) {    int j;    for (j = 0; j < m; j++) {     if (text.charAt(i + j) != pattern.charAt(j)) {      break;     }    }    if (j == m) {     res++;     j = 0;    }   }   return res;  }  private static void dfsR(List<List<Integer>> g, int node, int[] v) {   rIn[node] = counter;   flatten[counter++] = v[node];   for (int i = 0; i < g.get(node).size(); ++i) {    dfsR(g, g.get(node).get(i), v);   }   rOut[node] = counter;   flatten[counter++] = v[node] * -1;  }  private static void dfsL(List<List<Integer>> g, int node, int[] v) {   lIn[node] = counter;   lFlatten[counter++] = v[node];   for (int i = 0; i < g.get(node).size(); ++i) {    dfsL(g, g.get(node).get(i), v);   }   lOut[node] = counter;   lFlatten[counter++] = v[node] * -1;   TreeMap<String, Integer> map = new TreeMap<>();  }   private static void preprocess(int pos, int[][] pre, List<List<Integer>> tree, int[] traverse, int depth, int last, int[] tin, int[] tout) {   tin[pos] = counter++;   traverse[depth] = pos;   for (int i = 0; depth - (1 << i) >= 0; ++i) {    pre[pos][i] = traverse[depth - (1 << i)];   }   for (int i = 0; i < tree.get(pos).size(); ++i) {    if (tree.get(pos).get(i) != last)     preprocess(tree.get(pos).get(i), pre, tree, traverse, depth + 1, pos, tin, tout);   }   tout[pos] = counter++;  }  static long gcd(long a, long b) {   while (b != 0) {    long t = a;    a = b;    b = t % b;   }   return a;  }   static boolean submit = true;  static void debug(String s) {   if (!submit)    System.out.println(s);  }  static void debug(int s) {   LinkedHashSet<Integer> exist = new LinkedHashSet<>();     }   }
6	public class C {  public static void main(String[] args)  {  new C(new Scanner(System.in));  }  vect[] vs;  int N;  int oo = 987654321;  ArrayList<choice> cs;  choice[][] cg;  int MF;  int[] memo;  int[] next;  int go(int m)  {  if (m == MF)   return 0;  if (memo[m] != -1)   return memo[m];     int res = oo;  int nxt = -1;   int i=0;  for (i=0; i<N; i++)  {   if (((1<<i)&m) == 0)    break;  }   for (int j=0; j<N; j++)  {   choice cc = cg[i][j];   if ((m&cc.m) > 0)    continue;    int r2 = cc.cost+go(m|cc.m);   if (r2 < res)   {    res = r2;    nxt = cc.index;   }  }   memo[m] = res;  next[m] = nxt;  return res;  }  public C(Scanner in)  {  vect vt = new vect(in.nextInt(), in.nextInt());  N = in.nextInt();  vs = new vect[N+1];  vs[N] = vt;  for (int i=0; i<N; i++)   vs[i] = new vect(in.nextInt(), in.nextInt());     cs = new ArrayList<choice>();  cg = new choice[N][N];  for (int i=0; i<N; i++)  {   choice cc = new choice(cs.size(), 2*vs[i].dist(vt), 1<<i);   cc.add(i);   cs.add(cc);   cg[i][i] = cc;  }   for (int i=0; i<N; i++)  {   for (int j=i+1; j<N; j++)   {    int dist = vs[i].dist(vt);    dist += vs[i].dist(vs[j]);    dist += vs[j].dist(vt);    choice cc = new choice(cs.size(), dist, (1<<i)|(1<<j));    cc.add(i); cc.add(j);    cs.add(cc);    cg[i][j] = cc;    cg[j][i] = cc;   }  }   MF = (1<<N)-1;  next = new int[MF+1];  memo = new int[MF+1];   Arrays.fill(next, -1);  Arrays.fill(memo, -1);   int res = go(0);  System.out.println(res);   int m = 0;  StringBuilder sb = new StringBuilder();  while (m != -1)  {      sb.append(0);   sb.append(' ');   int i = next[m];   if (i == -1)    break;   choice cc = cs.get(i);   for (int j : cc.iv)   {    sb.append(f(j));    sb.append(' ');   }   m = m|cc.m;  }  System.out.println(sb.toString().trim());  }  int f(int i)  {  if (i == N)   return 0;  return i+1;  } }  class choice {  int cost;  int m;  int index;  ArrayList<Integer> iv;  public choice(int ii, int c, int mm)  {  index = ii;  cost = c;  m = mm;  iv = new ArrayList<Integer>(2);  }  void add(int i)  {  iv.add(i);  } }  class vect {  int x, y;  public vect(int i, int j)  {  x=i; y=j;  }  int dist(vect rhs)  {  int xx = x-rhs.x;  int yy = y-rhs.y;  return xx*xx+yy*yy;  } }
4	public class codeforces { public static void main(String[] args) throws Exception {  int t=sc.nextInt();  while(t-->0) {  int n=sc.nextInt();  int[]a=sc.nextIntArray(n);  LinkedList<Integer>ll=new LinkedList<Integer>();  for(int i=0;i<n;i++) {   if(a[i]==1) {   ll.addLast(a[i]);   }else if(ll.isEmpty()) {   ll.addLast(a[i]);      }else {   while(!(ll.getLast()==a[i]-1)) {    ll.removeLast();   }   ll.removeLast();   ll.addLast(a[i]);   }   int ii=0;   for(int j:ll) {   pw.print(j);   if(ii!=ll.size()-1){    pw.print('.');   }   ii++;   }   pw.println();  }    }        pw.close(); }  static class Scanner {  StringTokenizer st;  BufferedReader br;  public Scanner(InputStream s) {  br = new BufferedReader(new InputStreamReader(s));  }  public Scanner(FileReader r) {  br = new BufferedReader(r);  }  public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException {  return Integer.parseInt(next());  }  public long nextLong() throws IOException {  return Long.parseLong(next());  }  public String nextLine() throws IOException {  return br.readLine();  }  public double nextDouble() throws IOException {  String x = next();  StringBuilder sb = new StringBuilder("0");  double res = 0, f = 1;  boolean dec = false, neg = false;  int start = 0;  if (x.charAt(0) == '-') {   neg = true;   start++;  }  for (int i = start; i < x.length(); i++)   if (x.charAt(i) == '.') {   res = Long.parseLong(sb.toString());   sb = new StringBuilder("0");   dec = true;   } else {   sb.append(x.charAt(i));   if (dec)    f *= 10;   }  res += Long.parseLong(sb.toString()) / f;  return res * (neg ? -1 : 1);  }  public long[] nextlongArray(int n) throws IOException {  long[] a = new long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public Long[] nextLongArray(int n) throws IOException {  Long[] a = new Long[n];  for (int i = 0; i < n; i++)   a[i] = nextLong();  return a;  }  public int[] nextIntArray(int n) throws IOException {  int[] a = new int[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public Integer[] nextIntegerArray(int n) throws IOException {  Integer[] a = new Integer[n];  for (int i = 0; i < n; i++)   a[i] = nextInt();  return a;  }  public boolean ready() throws IOException {  return br.ready();  }  }  static class pair implements Comparable<pair> {  long x;  long y;  public pair(long x, long y) {  this.x = x;  this.y = y;  }  public String toString() {  return x + " " + y;  }  public boolean equals(Object o) {  if (o instanceof pair) {   pair p = (pair) o;   return p.x == x && p.y == y;  }  return false;  }  public int hashCode() {  return new Long(x).hashCode() * 31 + new Long(y).hashCode();  }  public int compareTo(pair other) {  if (this.x == other.x) {   return Long.compare(this.y, other.y);  }  return Long.compare(this.x, other.x);  } }  static class tuble implements Comparable<tuble> {  int x;  int y;  int z;  public tuble(int x, int y, int z) {  this.x = x;  this.y = y;  this.z = z;  }  public String toString() {  return x + " " + y + " " + z;  }  public int compareTo(tuble other) {  if (this.x == other.x) {   if (this.y == other.y) {   return this.z - other.z;   }   return this.y - other.y;  } else {   return this.x - other.x;  }  } }  static long mod = 1000000007; static Random rn = new Random(); static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); }
1	public class TaskA implements Runnable { private InputReader in; private PrintWriter out;  public static void main(String[] args) {  new Thread(new TaskA()).start();  }  public TaskA() {      in = new InputReader(System.in);  out = new PrintWriter(System.out); }  public void run() {   int n = in.readInt();  int k = in.readInt();  int last = 2;  for (int i = 3; i + last < n; i++) {  boolean good = true;  for (int j = 2; j * j <= i; j++) {   if (i % j == 0) {   good = false;   break;   }  }  if (good) {   int p = i + last + 1;   for (int j = 2; j * j <= p; j++) {   if (p % j == 0) {    good = false;    break;   }   }   if (good)   k--;   last = i;  }  }  if (k <= 0)  out.println("YES");  else  out.println("NO");  out.close(); }  private static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1000];  private int curChar, numChars;  public InputReader(InputStream stream) {  this.stream = stream;  }  private int read() {  if (numChars == -1)   throw new InputMismatchException();  if (curChar >= numChars) {   curChar = 0;   try {   numChars = stream.read(buf);   } catch (IOException e) {   throw new InputMismatchException();   }   if (numChars <= 0)   return -1;  }  return buf[curChar++];  }  public int readInt() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  int res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public long readLong() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  long res = 0;  do {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  } while (!isSpaceChar(c));  return res * sgn;  }  public String readString() {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuffer res = new StringBuffer();  do {   res.appendCodePoint(c);   c = read();  } while (!isSpaceChar(c));  return res.toString();  }  private boolean isSpaceChar(int c) {  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  private String readLine0() {  StringBuffer buf = new StringBuffer();  int c = read();  while (c != '\n' && c != -1) {   buf.appendCodePoint(c);   c = read();  }  return buf.toString();  }  public String readLine() {  String s = readLine0();  while (s.trim().length() == 0)   s = readLine0();  return s;  }  public String readLine(boolean ignoreEmptyLines) {  if (ignoreEmptyLines)   return readLine();  else   return readLine0();  }  public BigInteger readBigInteger() {  try {   return new BigInteger(readString());  } catch (NumberFormatException e) {   throw new InputMismatchException();  }  }  public char readCharacter() {  int c = read();  while (isSpaceChar(c))   c = read();  return (char) c;  }  public double readDouble() {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-') {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.') {   c = read();   double m = 1;   while (!isSpaceChar(c)) {   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  } } }
6	public class LookingForOrder { static int n; static int []x,y,memo; static StringBuilder sb; static int distance(int i,int j) { int dx=x[i]-x[j]; int dy=y[i]-y[j]; return dx*dx+dy*dy; } public static int dp(int msk) { if(msk==(1<<(n+1))-2)  return 0; if(memo[msk]!=-1)  return memo[msk]; int ans=10000000; boolean found=false; for(int i=1;i<=n && !found;i++)   for(int j=i;j<=n && (msk&1<<i)==0;j++)  if((msk&1<<j)==0)  {      found=true;   int newM=msk|1<<i;   newM|=1<<j;   ans=Math.min(ans, dp(newM)+Math.min(distance(0,i)+distance(i,j)+distance(j,0), distance(0,j)+distance(j,i)+distance(i,0)));  } return memo[msk]=ans;   } public static void print(int msk) { if(msk==(1<<(n+1))-2)  return ;  for(int i=1;i<=n;i++)   for(int j=i;j<=n && (msk&1<<i)==0;j++)  if((msk&1<<j)==0)  {      int newM=msk|1<<i;   newM|=1<<j;   int d1=distance(0,i)+distance(i,j)+distance(j,0);   int d2=distance(0,j)+distance(j,i)+distance(i,0);   if(dp(msk)== dp(newM)+Math.min(d1,d2))   {      if(i==j)       sb.append("0 "+i+" ");      else if(d1<d2)    sb.append("0 "+i+" "+j+" ");   else    sb.append("0 "+j+" "+i+" ");          print(newM);   return ;   }  }    } public static void main(String[] args) throws IOException {  Scanner sc=new Scanner(System.in);  int xS=sc.nextInt(),yS=sc.nextInt();  n=sc.nextInt();  x=new int [n+1];  y=new int [n+1];  x[0]=xS;y[0]=yS;  for(int i=1;i<=n;i++)  {   x[i]=sc.nextInt();  y[i]=sc.nextInt();   }  memo=new int [1<<(n+1)];  Arrays.fill(memo,-1);  sb=new StringBuilder();  sb.append(dp(0)+"\n");  print(0);  sb.append("0");  System.out.println(sb); } static class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(InputStream s)  {  br=new BufferedReader(new InputStreamReader(s));  }  public String nextLine() throws IOException  {  return br.readLine();  }  public String next() throws IOException  {  while(st==null || !st.hasMoreTokens())   st=new StringTokenizer(br.readLine());  return st.nextToken();  }  public int nextInt() throws IOException  {  return Integer.parseInt(next());    }  public double nextDouble() throws IOException  {  return Double.parseDouble(next());  }  public boolean ready() throws IOException  {  return br.ready();  }  public long nextLong() throws IOException  {  return Long.parseLong(next());  } } }
1	public class Noldbach { public static void main(String[] args) throws Exception {  Scanner sc = new Scanner(System.in);  int n=sc.nextInt();  int k=sc.nextInt();  boolean[] sieve=new boolean[1001];  sieve[2]=false;  ArrayList<Integer> primes=new ArrayList<Integer>();  for(int x=2;x<1001;x++)  if(!sieve[x])  {   primes.add(x);   for(int y=x;y<1001;y+=x)   sieve[y]=true;  }  int sum=0;  for(int x=2;x<=n;x++)  {  if(primes.contains(x))  {  int need=x-1;  for(int y=0;y<primes.size()-1;y++)  {   if(primes.get(y)+primes.get(y+1)==need)   {   sum++;   break;   }  }  }  if(sum==k)break;  }  if(sum==k)System.out.println("YES");  else System.out.println("NO");   }  }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Scanner in = new Scanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {  Scanner in;  PrintWriter out;  public void solve(int testNumber, Scanner in, PrintWriter out) {   this.in = in;   this.out = out;   run();  }  void run() {   int n = in.nextInt();   int a = in.nextInt();   int b = in.nextInt();   int[] is = in.nextIntArray(n);   Map<Integer, Integer> id = new HashMap<Integer, Integer>();   for (int i = 0; i < n; i++) {    id.put(is[i], i);   }   SCC.V[] vs = new SCC.V[n * 2];   for (int i = 0; i < vs.length; i++) vs[i] = new SCC.V();   for (int i = 0; i < n; i++) {    if (id.containsKey(a - is[i])) {     int j = id.get(a - is[i]);     vs[i].add(vs[j]);     vs[j + n].add(vs[i + n]);    } else {     vs[i].add(vs[i + n]);    }    if (id.containsKey(b - is[i])) {     int j = id.get(b - is[i]);     vs[i + n].add(vs[j + n]);     vs[j].add(vs[i]);    } else {     vs[i + n].add(vs[i]);    }   }   SCC.scc(vs);   for (int i = 0; i < n; i++) {    if (vs[i].comp == vs[i + n].comp) {     out.println("NO");     return ;    }   }   out.println("YES");   for (int i = 0; i < n; i++) {    if (vs[i].comp > vs[i + n].comp) {     out.print("0 ");    } else {     out.print("1 ");    }   }   out.println();  } } class Scanner {  BufferedReader br;  StringTokenizer st;  public Scanner(InputStream in) {   br = new BufferedReader(new InputStreamReader(in));   eat("");  }  private void eat(String s) {   st = new StringTokenizer(s);  }  public String nextLine() {   try {    return br.readLine();   } catch (IOException e) {    return null;   }  }  public boolean hasNext() {   while (!st.hasMoreTokens()) {    String s = nextLine();    if (s == null)     return false;    eat(s);   }   return true;  }  public String next() {   hasNext();   return st.nextToken();  }  public int nextInt() {   return Integer.parseInt(next());  }  public int[] nextIntArray(int n) {   int[] is = new int[n];   for (int i = 0; i < n; i++) {    is[i] = nextInt();   }   return is;  } } class SCC {  public static int n;  public static V[] us;  public static int scc(V[] vs) {   n = vs.length;   us = new V[n];   for (V v : vs) if (!v.visit) dfs(v);   for (V v : vs) v.visit = false;   for (V u : us) if (!u.visit) dfsRev(u, n++);   return n;  }  public static void dfs(V v) {   v.visit = true;   for (V u : v.fs) if (!u.visit) dfs(u);   us[--n] = v;  }  public static void dfsRev(V v, int k) {   v.visit = true;   for (V u : v.rs) if (!u.visit) dfsRev(u, k);   v.comp = k;  }  public static class V {   public boolean visit;   public int comp;   public List<V> fs = new ArrayList<V>();   public List<V> rs = new ArrayList<V>();   public void add(V u) {    fs.add(u);    u.rs.add(this);   }  } }
1	public class B {  static BufferedReader in;  static StringTokenizer st;  static String next() throws IOException {   while (st == null || !st.hasMoreTokens()) {    st = new StringTokenizer(in.readLine());   }   return st.nextToken();  }  static int nextInt() throws IOException {   return Integer.parseInt(next());  }  public static void main(String[] args) throws IOException {   in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   int n = nextInt();   int k = nextInt();   int[] a = new int[n + 1];   for (int i = 1; i <= n; i++) {    a[i] = nextInt();   }   Set<Integer> set_1 = new HashSet<Integer>();   for (int i = 1; i <= n; i++) {    set_1.add(a[i]);    if (set_1.size() == k) {     Set<Integer> set_2 = new HashSet<Integer>();     for (int j = i; j >= 1; j--) {      set_2.add(a[j]);      if (set_2.size() == k) {       out.print(j + " " + i);       out.close();       return;      }     }    }   }   out.print("-1 -1");   out.close();  } }
5	public class codeforces {  static int count =0;  static boolean f=false;  static int [] arr; static PrintWriter pw=new PrintWriter(System.out); static void solve(int index , int mask) {  if(index==arr.length) {  int sum1=0; int sum2=0;  for(int i=0;i<arr.length;i++) {   if((mask & 1<<i)!=0) sum1+=arr[i];     }  return;  }  solve(index+1, mask | 1<<index);  solve(index+1, mask); } public static void main(String [] args) throws IOException, InterruptedException {  Scanner sc=new Scanner(System.in);  int x=sc.nextInt();  int y=sc.nextInt();  pair [] arr=new pair[x];  for(int i=0;i<x;i++) arr[i]=new pair(i, sc.nextInt(),0);  for(int i=0;i<x;i++) arr[i].y=sc.nextInt();  Arrays.sort(arr);  PriorityQueue<Integer> qq=new PriorityQueue<>();   Long [] list=new Long [x];  long sum=0;  for(int i=0;i<x;i++) {  pair w=arr[i];  if(qq.size()<y) {   qq.add(w.y);   sum+=w.y;   list[w.i]=sum;   }else if(!qq.isEmpty()) {   sum+=w.y;   list[w.i]=sum;   int first=qq.poll();   if(w.y>first) {   sum-=first;   qq.add(w.y);   }else {   qq.add(first);   sum-=w.y;   }  } else list[w.i]=(long) w.y;    }  for(Long w:list) pw.print(w+" ");  pw.flush();  pw.close(); }   static class pair implements Comparable<pair>{  String name; int x,y,i ;  public pair(String name , int x) {  this.name=name; this.x=x;  }   public pair (int i,int x,int y) {  this.i=i; this.x=x; this.y=y;  }  public int compareTo(pair o) {  return x-o.x;  }  public int compareTo1(pair o) {  if(!name.equals(o.name))   return name.compareTo(o.name);  return x-o.x;  }  public String toString() {  return i+" "+x+" "+y;  } }  static class Scanner {  StringTokenizer st;  BufferedReader br;   public Scanner(InputStream system) {  br = new BufferedReader(new InputStreamReader(system));  }   public Scanner(String file) throws Exception {  br = new BufferedReader(new FileReader(file));  }   public String next() throws IOException {  while (st == null || !st.hasMoreTokens())   st = new StringTokenizer(br.readLine());  return st.nextToken();  }   public String nextLine() throws IOException {  return br.readLine();  }   public int nextInt() throws IOException {  return Integer.parseInt(next());  }   public double nextDouble() throws IOException {  return Double.parseDouble(next());  }   public char nextChar() throws IOException {  return next().charAt(0);  }   public Long nextLong() throws IOException {  return Long.parseLong(next());  }   public boolean ready() throws IOException {  return br.ready();  }   public void waitForInput() throws InterruptedException {  Thread.sleep(3000);  } } }
2	public class ReallyBigNums {   private static long[] factorArray(long s)  {   int d=0;   long n=s;   long f=1;   while(n>0)   {    n=n/10;    d++;    f = f*10;   }     long[] fact = new long[d+1];   n=s;   for(int i=d;i>=0;i--)   {    if(f==1)     fact[i] = n;    else    {     fact[i] = n/(f-1);     n = n%(f-1);     f=f/10;    }   }   int carry=0;   for(int i=0;i<=d;i++)   {    fact[i] = fact[i]+carry;    if(fact[i]>9 || (i==0 && fact[i]>0))    {     fact[i] = 0;     carry = 1;     for(int j=i-1;j>=0;j--)     {      fact[j] =0;     }    }    else    {     carry = 0;    }   }     return fact;  }   private static long bigNumCount(long n, long s)  {   if(s>=n)    return 0;   if(s==0)    return n;   long[] fact = factorArray(s);     long startNum = 0;   int len = fact.length;   long tenPow = 1;   for(int i=0;i<len;i++)   {    startNum = startNum+tenPow*fact[i];    tenPow = tenPow*10;   }     return(Math.max(0,n-startNum+1));  }  private static class FastReader  {   BufferedReader br;   StringTokenizer st;    public FastReader()   {    br = new BufferedReader(new      InputStreamReader(System.in));   }    String next()   {    while (st == null || !st.hasMoreElements())    {     try     {      st = new StringTokenizer(br.readLine());     }     catch (IOException e)     {      e.printStackTrace();     }    }    return st.nextToken();   }    int nextInt()   {    return Integer.parseInt(next());   }    long nextLong()   {    return Long.parseLong(next());   }    double nextDouble()   {    return Double.parseDouble(next());   }    String nextLine()   {    String str = "";    try    {     str = br.readLine();    }    catch (IOException e)    {     e.printStackTrace();    }    return str;   }  }  public static void main(String args[])  {   FastReader r = new FastReader();   long n = r.nextLong();   long s= r.nextLong();   System.out.println(bigNumCount(n,s));  }  }
1	public class Main {  private static StringTokenizer st;  private static BufferedReader br;  public static long MOD = 1000000007;  public static long tenFive = 100000;  public static int INF = 100000;  public static void print(Object x) {   System.out.println(x + "");  }  public static void printArr(long[] x) {   StringBuilder s = new StringBuilder();   for (int i = 0; i < x.length; i++) {    s.append(x[i] + " ");   }   print(s);  }  public static void printArr(int[] x) {   StringBuilder s = new StringBuilder();   for (int i = 0; i < x.length; i++) {    s.append(x[i] + " ");   }   print(s);  }  public static String join(Collection<?> x, String space) {   if (x.size() == 0) return "";   StringBuilder sb = new StringBuilder();   boolean first = true;   for (Object elt : x) {    if (first) first = false;    else sb.append(space);    sb.append(elt);   }   return sb.toString();  }  public static String nextToken() throws IOException {   while (st == null || !st.hasMoreTokens()) {    String line = br.readLine();    st = new StringTokenizer(line.trim());   }   return st.nextToken();  }  public static int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public static long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public static List<Integer> nextInts(int N) throws IOException {   List<Integer> ret = new ArrayList<Integer>();   for (int i = 0; i < N; i++) {    ret.add(nextInt());   }   return ret;  }  public static void solve(int a, int b, List<Integer> orig) {   boolean swap = false;   if (a > b) {    swap = true;    int tmp = a;    a = b;    b = tmp;   }   List<Integer> nums = new ArrayList<Integer>(orig);   Collections.sort(nums);   Collections.reverse(nums);   Set<Integer> all = new HashSet<Integer>(nums);   Set<Integer> done = new HashSet<Integer>();   Set<Integer> inB = new HashSet<Integer>();   for (int x : nums) {    if (done.contains(x)) continue;    if (all.contains(a - x) && !done.contains(a - x)) {     done.add(x);     done.add(a - x);        } else if (all.contains(b - x) && !done.contains(b - x)) {     done.add(x);     done.add(b - x);     inB.add(x);     inB.add(b - x);    } else {     print("NO");     return;    }   }   print("YES");   List<Integer> out = new ArrayList<Integer>();   for (int x : orig) {    if (inB.contains(x) ^ swap) out.add(1);    else out.add(0);   }   print(join(out, " "));  }  public static void main(String[] args) throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   int n = nextInt();   int a = nextInt();   int b = nextInt();   List<Integer> nums = nextInts(n);   solve(a, b, nums);  } }
6	public class CF008C {  public static void main(String[] args) {   Scanner s = new Scanner(System.in);   int x = s.nextInt();   int y = s.nextInt();   int n = s.nextInt();   int[] xx = new int[n+1];   int[] yy = new int[n+1];   for(int i = 0;i<n;i++){    xx[i] = s.nextInt();    yy[i] = s.nextInt();   }     xx[n] = x;   yy[n] = y;   int[][] dp = new int[n + 1][n + 1];   for (int i = 0; i <= n; i++)    for (int j = i + 1; j <= n; j++) {     int dx = xx[i] - xx[j];     int dy = yy[i] - yy[j];     dp[i][j] = dx * dx + dy * dy;    }    int[] aa = new int[1 << n];    int[] bb = new int[1 << n];    for (int k = 1; k < 1 << n; k++) {     int a = -1;     for (int b = 0; b < n; b++)      if ((k & 1 << b) > 0) {       a = b;       break;      }     int l = k ^ 1 << a;     int d = dp[a][n] + dp[a][n];     aa[k] = aa[l] + d;     bb[k] = l;     for (int b = a + 1; b < n; b++)      if ((k & 1 << b) > 0) {       l = k ^ 1 << a ^ 1 << b;       d = dp[a][n] + dp[b][n] + dp[a][b];       if (aa[l] + d < aa[k]) {        aa[k] = aa[l] + d;        bb[k] = l;       }      }    }    int k = (1 << n) - 1;    System.out.println(aa[k]);    StringBuilder sb = new StringBuilder();    sb.append(0);    while (k != 0) {     int l = bb[k];     int m = k ^ l;     for (int b = 0; b < n; b++)      if ((m & 1 << b) > 0)       sb.append(' ').append(b + 1);     sb.append(' ').append(0);     k = l;    }    System.out.println(sb);   }                                  private static int calculateDistanceBetweenIandJ(int[] xCoord, int[] yCoord, int i, int j) {   int length = (int) (Math.pow((xCoord[i] - xCoord[j]),2) + Math.pow(yCoord[i] - yCoord[j], 2));   return length;  } }
0	public class D {  public static void main(String[] args) {   Scanner in = new Scanner(System.in);   double a = in.nextDouble();   double v = in.nextDouble();   double l = in.nextDouble();   double d = in.nextDouble();   double w = in.nextDouble();   double ans = 0;   double maxSpeedBySign = Math.sqrt(2 * a * d);   double speedAtSign = -1;   if (v <= w) {    if (maxSpeedBySign <= v) {     ans += Math.sqrt(2 * d / a);     speedAtSign = maxSpeedBySign;    } else {     ans += v / a;     double distanceLeftTillSign = d - v * v / a / 2;     ans += distanceLeftTillSign / v;     speedAtSign = v;    }   } else {    if (maxSpeedBySign <= w) {     ans += Math.sqrt(2 * d / a);     speedAtSign = maxSpeedBySign;    } else {     double S = d / 2 - w * w / 4 / a;     double X = d - S;     double speed = Math.sqrt(2 * a * X);     if (speed <= v) {      ans += Math.sqrt(2 * X / a);      ans += (speed - w) / a;      speedAtSign = w;     } else {      double distanceToAc = v * v / a / 2;      double distanceToDe = (v * v - w * w) / a / 2;      ans += Math.sqrt(2 * distanceToAc / a);      ans += (d - distanceToAc - distanceToDe) / v;      ans += (v - w) / a;     }     speedAtSign = w;    }   }   l -= d;   double timeToGetMaxSpeed = (v - speedAtSign) / a;   double timeToReachEnd = (-2 * speedAtSign + Math.sqrt(4 * speedAtSign     * speedAtSign + 8 * a * l))     / 2 / a;   if (timeToGetMaxSpeed < timeToReachEnd) {    ans += timeToGetMaxSpeed;    double distanceCoveredToMaxSpeed = speedAtSign * timeToGetMaxSpeed      + 0.5 * a * timeToGetMaxSpeed * timeToGetMaxSpeed;    l -= distanceCoveredToMaxSpeed;    ans += l / v;   } else {    ans += timeToReachEnd;   }   System.out.println(ans);  } }
1	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskB solver = new TaskB();  solver.solve(1, in, out);  out.close(); } } class TaskB {   static nn[] B;  static int n,a,b;  public void solve(int testNumber, FastScanner in, FastPrinter out) {  n=in.nextInt();a=in.nextInt();b=in.nextInt();   int ccc=0;   if (a==b)ccc=1;  int[] A=in.readIntArray(n);  B=new nn[n];   for (int i = 0; i < n; i++) {    B[i]=new nn(A[i],i);   }   ArrayUtils.shuffle(B);   Arrays.sort(B);   int chk=1;   for (int i = 0; i < n; i++) {    if (B[i].assign>=0)continue;    int v=B[i].val;    int cc=0;    int pos1=Arrays.binarySearch(B,new nn(a-v,0));    if (pos1>=0&&B[pos1].assign==-1)cc++;    if (a!=b){    int pos2=Arrays.binarySearch(B,new nn(b-v,0));    if (pos2>=0&&B[pos2].assign==-1)cc++; }    if (cc==0){     chk=0;     break;    }    if (cc==1){    go(i);    }   }   if (chk==0){    out.println("NO");    return;   }   int[] ans= new int[n];   for (int i = 0; i < n; i++) {    ans[B[i].pos]=B[i].assign;   }   out.println("YES");   for (int i = 0; i < n; i++) {   out.print(ans[i] + " ");   }   out.println();   }  static void go (int i){   int v=B[i].val;   int pos1=Arrays.binarySearch(B,new nn(a-v,0));   if (pos1>=0&&B[pos1].assign==-1){    B[i].assign=0;    B[pos1].assign=0;    int vv=B[pos1].val;    int np=Arrays.binarySearch(B,new nn(b-vv,0));    if (np>=0)go(np);   }   if (a!=b){   int pos2=Arrays.binarySearch(B,new nn(b-v,0));   if (pos2>=0&&B[pos2].assign==-1){    B[i].assign=1;    B[pos2].assign=1;    int vv=B[pos2].val;    int np=Arrays.binarySearch(B,new nn(a-vv,0));    if (np>=0)go(np);   } }  } } class nn implements Comparable<nn> {   int val,pos;   public String toString() {    return "nn{" +      "val=" + val +      ", pos=" + pos +      ", assign=" + assign +      ", ct=" + ct +      '}';   }   int assign=-1;   int ct=0;   nn(int val, int pos) {    this.val = val;    this.pos = pos;   }   public int compareTo(nn o) {    return this.val-o.val;   } } class FastScanner extends BufferedReader {  public FastScanner(InputStream is) {   super(new InputStreamReader(is));  }  public int read() {   try {    int ret = super.read();      return ret;   } catch (IOException e) {    throw new InputMismatchException();   }  }  static boolean isWhiteSpace(int c) {   return c >= 0 && c <= 32;  }  public int nextInt() {   int c = read();   while (isWhiteSpace(c)) {    c = read();   }   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int ret = 0;   while (c >= 0 && !isWhiteSpace(c)) {    if (c < '0' || c > '9') {     throw new NumberFormatException("digit expected " + (char) c       + " found");    }    ret = ret * 10 + c - '0';    c = read();   }   return ret * sgn;  }  public String readLine() {   try {    return super.readLine();   } catch (IOException e) {    return null;   }  }  public int[] readIntArray(int n) {   int[] ret = new int[n];   for (int i = 0; i < n; i++) {    ret[i] = nextInt();   }   return ret;  } } class FastPrinter extends PrintWriter {  public FastPrinter(OutputStream out) {   super(out);  }  public FastPrinter(Writer out) {   super(out);  }  } class ArrayUtils {   static final long seed = System.nanoTime();  static final Random rand = new Random(seed);   public static <T> void shuffle(T[] a) {   for (int i = 0; i < a.length; i++) {    int j = rand.nextInt(i + 1);    T t = a[i];    a[i] = a[j];    a[j] = t;   }  } }
5	public class LittleElephant { public static void main(String[] args){  Scanner input = new Scanner(System.in);  int n = input.nextInt();  int temp;  ArrayList<Integer> a2 = new ArrayList<Integer>();  ArrayList<Integer> a1 = new ArrayList<Integer>();  int count = 0;  int temp1,temp2;   for(int i= 0; i < n ; i++){  temp = input.nextInt();  a2.add(temp);  a1.add(temp);  }  Collections.sort(a2);  input.close();  for(int i = 0; i < n; i++){  temp1 = a2.get(i);  temp2 = a1.get(i);  if(temp1 != temp2){   count++;  }  }  if(count==2 || count==0){  System.out.println("YES");  }else{  System.out.println("NO");  } } }
2	public class TestClass implements Runnable {  public static void main(String args[]) {  new Thread(null, new TestClass(),"TESTCLASS",1<<18).start(); } public void run() {   InputReader hb=new InputReader(System.in);  PrintWriter w=new PrintWriter(System.out);   long n=hb.nextLong();  long s=hb.nextLong();   long start=0;  long end=n;  long ans=0;  while(start<=end)  {  long mid=(start+end)/2;  if(mid-get(mid)>=s)  {   end=mid-1;   ans=mid;  }  else  {   start=mid+1;  }  }  if(ans<1)  w.print(0);  else  w.print(n-ans+1);  w.close(); }  public long get(long a) {  String str = Long.toString(a);  int ans = 0;  for(char ch : str.toCharArray())  ans += (ch-'0');  return ans; }   private void shuffle(int[] arr) {  Random ran = new Random();  for (int i = 0; i < arr.length; i++) {  int i1 = ran.nextInt(arr.length);  int i2 = ran.nextInt(arr.length);   int temp = arr[i1];  arr[i1] = arr[i2];  arr[i2] = temp;  } }  static class DSU {  int parent[];  int sizeParent[];  DSU(int n)  {  parent=new int[n];  sizeParent=new int[n];  Arrays.fill(sizeParent,1);  for(int i=0;i<n;i++)   parent[i]=i;  }   int find(int x)  {  if(x!=parent[x])   parent[x]=find(parent[x]);  return parent[x];  }   void union(int x,int y)  {  x=find(x);  y=find(y);  if(sizeParent[x]>=sizeParent[y])  {   if(x!=y)   sizeParent[x]+=sizeParent[y];   parent[y]=x;  }  else  {   if(x!=y)   sizeParent[y]+=sizeParent[x];   parent[x]=y;  }  } }  static class InputReader {  private InputStream stream;  private byte[] buf = new byte[1024];  private int curChar;  private int numChars;  private SpaceCharFilter filter;   public InputReader(InputStream stream)  {  this.stream = stream;  }   public int read()  {  if (numChars==-1)   throw new InputMismatchException();    if (curChar >= numChars)  {   curChar = 0;   try   {   numChars = stream.read(buf);   }   catch (IOException e)   {   throw new InputMismatchException();   }     if(numChars <= 0)     return -1;  }  return buf[curChar++];  }   public String nextLine()  {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  String str = "";  try  {   str = br.readLine();  }  catch (IOException e)  {   e.printStackTrace();  }  return str;  }  public int nextInt()  {  int c = read();    while(isSpaceChar(c))   c = read();    int sgn = 1;    if (c == '-')   {   sgn = -1;   c = read();  }    int res = 0;  do   {   if(c<'0'||c>'9')    throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));     return res * sgn;  }   public long nextLong()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  long res = 0;    do   {   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  while (!isSpaceChar(c));   return res * sgn;  }   public double nextDouble()  {  int c = read();  while (isSpaceChar(c))   c = read();  int sgn = 1;  if (c == '-')   {   sgn = -1;   c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.')   {   if (c == 'e' || c == 'E')   return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   res *= 10;   res += c - '0';   c = read();  }  if (c == '.')   {   c = read();   double m = 1;   while (!isSpaceChar(c))   {   if (c == 'e' || c == 'E')    return res * Math.pow(10, nextInt());   if (c < '0' || c > '9')    throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();   }  }  return res * sgn;  }   public String readString()  {  int c = read();  while (isSpaceChar(c))   c = read();  StringBuilder res = new StringBuilder();  do   {   res.appendCodePoint(c);   c = read();  }   while (!isSpaceChar(c));    return res.toString();  }   public boolean isSpaceChar(int c)  {  if (filter != null)   return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }   public String next()  {  return readString();  }   public interface SpaceCharFilter  {  public boolean isSpaceChar(int ch);  } }  static class Pair implements Comparable<Pair> {  int a;  int b;  String str;  public Pair(int a,int b)  {  this.a=a;  this.b=b;  str=min(a,b)+" "+max(a,b);  }   public int compareTo(Pair pair)  {  if(Integer.compare(a,pair.a)==0)   return Integer.compare(b,pair.b);   return Integer.compare(a,pair.a);  } }   }
1	public class codef8 {  public static void main(String[] args) {   Scanner sc = new Scanner(System.in);  int num = sc.nextInt();  int beacon[] = new int[1000001];  int pos[] = new int[num];  for (int i = 0; i < num; i++) {  int position = sc.nextInt();  beacon[position] = sc.nextInt();  pos[i] = position;  }  int dp[] = new int[1000001];  int max = 0;  if (beacon[0] != 0)  dp[0] = 1;   for (int i = 1; i <= 1000000; i++) {  if (beacon[i] == 0) {   dp[i] = dp[i-1];  }   else {   int j = i - beacon[i] - 1;   if (j < 0) {   dp[i] = 1;   }   else {   dp[i] = dp[j] + 1;   }  }  max = Math.max(max, dp[i]);  }   System.out.println(num-max); } }
0	public class a {  public static long mod = (long) Math.pow(10, 9) + 7;  private static class node implements Comparable<node> {  int x;  int y;  node(int x, int c) {  this.x = x;  this.y = c;  }  @Override  public int compareTo(node o) {  if (o.x < x)   return 1;  else if (o.x > x)   return -1;  else if (o.y < y)   return 1;  else if (o.y > y)   return -1;  else   return 0;  }  }  public static long gcd(long a, long b) {  if (b == 0)  return a;  else  return gcd(b, a % b); }  public static void main(String[] args) throws IOException {  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder qq = new StringBuilder();  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));    String y[] = in.readLine().split(" ");  long n = Long.parseLong(y[0]);  long m = Long.parseLong(y[1]);  if (m - n < 2) {  System.out.println(-1);  } else if (m - n == 2) {   if (gcd(n, m) != 1)   System.out.println(n + " " + (n + 1) + " " + (n + 2));   else   System.out.println(-1);  } else {  if (n % 2 == 0)   System.out.println(n + " " + (n + 1) + " " + (n + 2));  else   System.out.println((n + 1) + " " + (n + 2) + " " + (n + 3));  }  out.close();  } }
4	public class B {  public static void main(String[] args) throws IOException {   Reader scan = new Reader();  int t = scan.nextInt();  for(int tt = 0;tt<t;tt++) {    int n = scan.nextInt();  int arr[] = new int[n];  for(int i = 0;i<n;i++) arr[i] = scan.nextInt();    List<Integer> list = new ArrayList<>();  int j = -1;  StringBuilder s = new StringBuilder();  for(int i = 0;i<n;i++) {   if(list.isEmpty() || arr[i]==1) {    list.add(arr[i]);   j++;   }   else if(arr[i] == list.get(j)+1) {    list.set(j, arr[i]);   }   else {   for(int k = j;k>=0;k--) {    if(arr[i] == list.get(k)+1) {    list.set(k, arr[i]);    break;    }    else {    list.remove(k);    j--;    }   }   }   s.delete(0, s.length());   for(Integer p:list) {   s.append(p+".");   }   s.deleteCharAt(s.length()-1);   System.out.println(s.toString());  }  }  scan.close();   }  static class Reader  {  final private int BUFFER_SIZE = 1 << 16;  private DataInputStream din;  private byte[] buffer;  private int bufferPointer, bytesRead;   public Reader()  {   din = new DataInputStream(System.in);   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public Reader(String file_name) throws IOException  {   din = new DataInputStream(new FileInputStream(file_name));   buffer = new byte[BUFFER_SIZE];   bufferPointer = bytesRead = 0;  }   public String readLine() throws IOException  {   byte[] buf = new byte[64];   int cnt = 0, c;   while ((c = read()) != -1)   {   if (c == '\n')    break;   buf[cnt++] = (byte) c;   }   return new String(buf, 0, cnt);  }   public int nextInt() throws IOException  {   int ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do  {   ret = ret * 10 + c - '0';   } while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public long nextLong() throws IOException  {   long ret = 0;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (neg)   return -ret;   return ret;  }   public double nextDouble() throws IOException  {   double ret = 0, div = 1;   byte c = read();   while (c <= ' ')   c = read();   boolean neg = (c == '-');   if (neg)   c = read();   do {   ret = ret * 10 + c - '0';   }   while ((c = read()) >= '0' && c <= '9');   if (c == '.')   {   while ((c = read()) >= '0' && c <= '9')   {    ret += (c - '0') / (div *= 10);   }   }   if (neg)   return -ret;   return ret;  }   private void fillBuffer() throws IOException  {   bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);   if (bytesRead == -1)   buffer[0] = -1;  }   private byte read() throws IOException  {   if (bufferPointer == bytesRead)   fillBuffer();   return buffer[bufferPointer++];  }   public void close() throws IOException  {   if (din == null)   return;   din.close();  }  } }
3	public class USACO {  public static void main(String[] args) throws IOException {   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));   int n = Integer.parseInt(reader.readLine());   StringTokenizer st = new StringTokenizer(reader.readLine()," ");   int[] perm = new int[n];   int count=0;   for (int i=0;i<n;i++) {    perm[i]=Integer.parseInt(st.nextToken());    for (int j=0;j<i;j++) {     if (perm[j]>perm[i]) {      count++;     }    }   }   count=count%2;   int m = Integer.parseInt(reader.readLine());   for (int i=0;i<m;i++) {    StringTokenizer st2 = new StringTokenizer(reader.readLine()," ");    int a = Integer.parseInt(st2.nextToken());    int b = Integer.parseInt(st2.nextToken());    if ((b-a+1)%4==2||(b-a+1)%4==3) {     count++;     count=count%2;    }    if(count%2==0) {     System.out.println("even");    } else {     System.out.println("odd");    }   }  } }
5	public class c {  class IO {   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));   PrintWriter out = new PrintWriter(System.out);   StringTokenizer st;   Random rnd = new Random();;   String nextToken() throws IOException {    while (st == null || !st.hasMoreTokens()) {     String line = in.readLine();     if (line == null)      return null;     st = new StringTokenizer(line);    }    return st.nextToken();   }   int nextInt() throws IOException {    return Integer.parseInt(nextToken());   }   long nextLong() throws IOException {    return Long.parseLong(nextToken());   }   double nextDouble() throws IOException {    return Double.parseDouble(nextToken());   }  }   void run() throws IOException{   IO read=new IO();   int n=read.nextInt();   int a[]=new int[n],b[]=new int[n];   for(int i=0;i<n;i++)    a[i]=b[i]=read.nextInt();   Arrays.sort(b);   int cnt=0;   for(int i=0;i<n;i++)    if(a[i]!=b[i])     cnt++;   if(cnt==0||cnt==2)    read.out.println("YES");   else    read.out.println("NO");   read.out.close();  }  public static void main(String[] args) throws IOException {   new c().run();  } }
6	public class C {  static Point hand;  static int n;  static Point[] data;  static int[] next;  static int[] dp;  static int[][] pre;  public static void main(String[] args) {   Scanner in = new Scanner();   PrintWriter out = new PrintWriter(System.out);     hand = new Point(in.nextInt(), in.nextInt());   n = in.nextInt();   data = new Point[n];   for (int i = 0; i < n; i++) {    data[i] = new Point(in.nextInt(), in.nextInt());   }   pre = new int[n][n];   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     pre[i][j] = distance(data[i], data[j]);    }   }    next = new int[1 << n];   dp = new int[1 << n];   Arrays.fill(dp, -1);   out.println(cal(0));    int start = 0;   do {    int m = next[start];    int val = m - start;    out.print(0 + " ");    for (int i = 0; i < n; i++) {     if (((1 << i) & val) != 0) {      out.print((i + 1) + " ");     }    }       start = m;   } while (start != (1 << n) - 1);   out.println(0);   out.close();  }  public static int cal(int mask) {   if ((1 << n) - 1 == mask) {       return 0;   }   if (dp[mask] != -1) {    return dp[mask];   }   int result = Integer.MAX_VALUE;   for (int i = 0; i < n; i++) {    if (((1 << i) & mask) == 0) {     int dist = distance(hand, data[i]);         for (int j = i + 1; j < n; j++) {      if (((1 << j) & mask) == 0) {             int temp = dist + distance(hand, data[j]) + pre[i][j] + cal(mask | (1 << i) | (1 << j));             if (temp < result) {        result = temp;        next[mask] = (mask | (1 << i) | (1 << j));       }            }     }          int temp = 2 * dist + cal(mask | (1 << i));      if (temp < result) {       result = temp;       next[mask] = (mask | (1 << i));      }         break;    }   }   dp[mask] = result;   return result;  }  static int distance(Point a, Point b) {   int total = (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   return total;  }  static class Point {   int x, y;   public Point(int x, int y) {    this.x = x;    this.y = y;   }  }  static class Scanner {   BufferedReader br;   StringTokenizer st;   public Scanner() {       br = new BufferedReader(new InputStreamReader(System.in));   }   public String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (Exception e) {      throw new RuntimeException();     }    }    return st.nextToken();   }   public long nextLong() {    return Long.parseLong(next());   }   public int nextInt() {    return Integer.parseInt(next());   }   public double nextDouble() {    return Double.parseDouble(next());   }   public String nextLine() {    st = null;    try {     return br.readLine();    } catch (Exception e) {     throw new RuntimeException();    }   }   public boolean endLine() {    try {     String next = br.readLine();     while (next != null && next.trim().isEmpty()) {      next = br.readLine();     }     if (next == null) {      return true;     }     st = new StringTokenizer(next);     return st.hasMoreTokens();    } catch (Exception e) {     throw new RuntimeException();    }   }  } }
6	public class Main {   public static void main(String[] args) throws java.lang.Exception {  BufferedReader kek = new BufferedReader(new InputStreamReader(System.in));   PrintWriter outkek = new PrintWriter(System.out);  String[] input = kek.readLine().split(" ");  int X0 = Integer.parseInt(input[0]), Y0 = Integer.parseInt(input[1]), N = Integer.parseInt(kek.readLine());   int[] xCoords = new int[N + 1];  int[] yCoords = new int[N + 1];  int[][] distances = new int[N + 1][N + 1];  xCoords[N] = X0;  yCoords[N] = Y0;   for(int i = 0; i < N; i++){  input = kek.readLine().split(" ");  xCoords[i] = Integer.parseInt(input[0]);  yCoords[i] = Integer.parseInt(input[1]);  }   for(int i = 0; i <= N; i++){  for(int j = i + 1; j <= N; j++){   int temp = xCoords[i] - xCoords[j];   int temp2 = yCoords[i] - yCoords[j];   distances[i][j] = (temp * temp) + (temp2 * temp2);  }  }   int[] aa = new int[1 << N];  int[] bb = new int[1 << N];   for(int i = 1; i < 1 << N; i++){  int a = -1;  for(int j = 0; j < N; j++){   if((i & 1 << j) > 0){   a = j;   break;   }  }    int l = i ^ 1 << a;  int dist = distances[a][N] + distances[a][N];  aa[i] = aa[l] + dist;  bb[i] = l;    for(int k = a + 1; k < N; k++){   if((i & 1 << k) > 0) {   l = i ^ 1 << a ^ 1 << k;   dist = distances[a][N] + distances[k][N] + distances[a][k];   if(aa[l] + dist < aa[i]){    aa[i] = aa[l] + dist;    bb[i] = l;   }   }  }  }   int fin = (1 << N) - 1;  outkek.println(aa[fin]);  outkek.print('0');  while (fin != 0){  int temp1 = bb[fin];  int temp2 = fin ^ temp1;  for(int i = 0; i < N; i++){   if((temp2 & 1 << i) > 0){   outkek.print(" " + (i + 1));   }  }  outkek.print(" 0");  fin = temp1;  }  kek.close();  outkek.close(); }  }
0	public class bhaa {  InputStream is;  PrintWriter o;     boolean chpr(int n)  {  if(n==1)  {   return true;  }if(n==2)  {   return true;  }  if(n==3)  {   return true;  }  if(n%2==0)  {   return false;   }  if(n%3==0)  {   return false;  }    int w=2;  int i=5;  while(i*i<=n)  {   if(n%i==0)   {   return false;   }   i+=w;   w=6-w;  }  return true;  }   void solve() {    int n=ni();   int k=ni();   int rr=2*n;   int gr=5*n;   int br=8*n;   o.println((long)(Math.ceil(rr*1.0/k)+Math.ceil(gr*1.0/k)+Math.ceil(br*1.0/k)));      }                                       public static void main(String[] args) { new bhaa().run(); }  void run() {   is = System.in;   o = new PrintWriter(System.out);   solve();   o.flush();  }   byte input[] = new byte[1024];  int len = 0, ptr = 0;   int readByte() {   if(ptr >= len) { ptr = 0;    try { len = is.read(input); }    catch(IOException e) { throw new InputMismatchException(); }    if(len <= 0) { return -1; }   } return input[ptr++];  }  boolean isSpaceChar(int c) { return !( c >= 33 && c <= 126 ); }  int skip() {   int b = readByte();   while(b != -1 && isSpaceChar(b)) { b = readByte(); }   return b;  }   char nc() { return (char)skip(); }  String ns() {   int b = skip();   StringBuilder sb = new StringBuilder();   while(!isSpaceChar(b)) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  String nLine() {   int b = skip();   StringBuilder sb = new StringBuilder();   while( !(isSpaceChar(b) && b != ' ') ) { sb.appendCodePoint(b); b = readByte(); }   return sb.toString();  }  int ni() {   int n = 0, b = readByte();   boolean minus = false;   while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }   if(b == '-') { minus = true; b = readByte(); }   if(b == -1) { return -1; }   while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }   return minus ? -n : n;  }  long nl() {   long n = 0L; int b = readByte();   boolean minus = false;   while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')) { b = readByte(); }   if(b == '-') { minus = true; b = readByte(); }   while(b >= '0' && b <= '9') { n = n * 10 + (b - '0'); b = readByte(); }   return minus ? -n : n;  }  double nd() { return Double.parseDouble(ns()); }  float nf() { return Float.parseFloat(ns()); }  int[] nia(int n) {   int a[] = new int[n];   for(int i = 0; i < n; i++) { a[i] = ni(); }   return a;  }  long[] nla(int n) {   long a[] = new long[n];   for(int i = 0; i < n; i++) { a[i] = nl(); }   return a;  }  int [][] nim(int n)  {   int mat[][]=new int[n][n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     mat[i][j]=ni();    }   }   return mat;  }  long [][] nlm(int n)  {   long mat[][]=new long[n][n];   for(int i=0;i<n;i++)   {    for(int j=0;j<n;j++)    {     mat[i][j]=nl();    }   }   return mat;  }       char[] ns(int n) {   char c[] = new char[n];   int i, b = skip();   for(i = 0; i < n; i++) {    if(isSpaceChar(b)) { break; }    c[i] = (char)b; b = readByte();   } return i == n ? c : Arrays.copyOf(c,i);  }  void piarr(int arr[])  {   for(int i=0;i<arr.length;i++)   {    o.print(arr[i]+" ");   }   o.println();  }  void plarr(long arr[])  {   for(int i=0;i<arr.length;i++)   {    o.print(arr[i]+" ");   }   o.println();  }   void pimat(int mat[][])  {   for(int i=0;i<mat.length;i++)   {    for(int j=0;j<mat[0].length;j++)    {     o.print(mat[i][j]);    }    o.println();   }  }  void plmat(long mat[][])  {   for(int i=0;i<mat.length;i++)   {    for(int j=0;j<mat[0].length;j++)    {     o.print(mat[i][j]);    }    o.println();   }  }      }
0	public class A483 implements Runnable {  BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args) {  new Thread(null, new A483(), "", 256 * (1L << 20)).start(); }  public void run() {  try {  long t1 = System.currentTimeMillis();  if (System.getProperty("ONLINE_JUDGE") != null) {   in = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);  } else {   in = new BufferedReader(new FileReader("input.txt"));   out = new PrintWriter(System.out);  }  Locale.setDefault(Locale.US);  solve();  in.close();  out.close();  long t2 = System.currentTimeMillis();  System.err.println("Time = " + (t2 - t1));  } catch (Throwable t) {  t.printStackTrace(System.err);  System.exit(-1);  } }  String readString() throws IOException {  while (!tok.hasMoreTokens()) {  tok = new StringTokenizer(in.readLine());  }  return tok.nextToken(); }  int readInt() throws IOException {  return Integer.parseInt(readString()); }  long readLong() throws IOException {  return Long.parseLong(readString()); }  double readDouble() throws IOException {  return Double.parseDouble(readString()); }   int choose(int total, int choose){  if(total < choose)   return 0;  if(choose == 0 || choose == total)   return 1;  return choose(total-1,choose-1)+choose(total-1,choose); } void solve() throws IOException {  long l = readLong();  long r = readLong();  if(r-l>=3){  long c = l%2==0?l:l+1;  out.println(c+" "+(c+1)+" "+ (c+2));  }else if(r-l==2&&r%2==0){  out.println(l+" "+(l+1)+" "+(l+2));  }else{  out.println(-1);  } } }
5	public class A { int n, m, k; int[] a;  void run()throws IOException{  Scanner sc = new Scanner(new InputStreamReader(System.in));  n = sc.nextInt();  m = sc.nextInt();  k = sc.nextInt();  a = new int[n];  for(int i=0;i<n; i++) a[i] = sc.nextInt();  Arrays.sort(a);   if(m<=k){  System.out.println(0);  return;  }   int cnt = k;  int ind = a.length-1;  int ret = 0;  while(cnt<m && ind>=0){  cnt += a[ind]-1;  --ind;  ret++;    }   if(cnt>=m) System.out.println(ret);  else System.out.println(-1); }  public static void main(String[] args)throws IOException {  new A().run(); } }
4	public class Main { public static void main(String[] args) {  Scanner sc = new Scanner(System.in);  int t = sc.nextInt();  for (int tc = 0; tc < t; ++tc) {  int n = sc.nextInt();  int[] a = new int[n];  for (int i = 0; i < a.length; ++i) {   a[i] = sc.nextInt();  }   System.out.println(solve(a));  }  sc.close(); }  static String solve(int[] a) {  List<String> result = new ArrayList<>();  Stack<Integer> stack = new Stack<>();  for (int ai : a) {  if (ai != 1) {   while (stack.peek() + 1 != ai) {   stack.pop();   }   stack.pop();  }  stack.push(ai);   result.add(stack.stream().map(String::valueOf).collect(Collectors.joining(".")));  }  return String.join("\n", result); } }
3	public class Main {  public static void main(String[] args) {   InputStream inputStream = System.in;   OutputStream outputStream = System.out;   InputReader in = new InputReader(inputStream);   PrintWriter out = new PrintWriter(outputStream);   TaskA solver = new TaskA();   solver.solve(1, in, out);   out.close();  }  static class TaskA {   public void solve(int testNumber, InputReader in, PrintWriter out) {    int n = in.nextInt();    int l, r, sum = 0;    int[] a = new int[n+5];    for (int i = 0; i < n; i++) a[i] = in.nextInt();    for (int i = 0; i < n; i++)     for (int j = i+1; j < n; j++)      if (a[i] > a[j]) sum++;    int q = in.nextInt();    while (q-- > 0){     l = in.nextInt();     r = in.nextInt();     sum += (r-l+1)/2;     if (sum % 2 == 1) out.println("odd");     else out.println("even");    }   }  }  static class InputReader {   public BufferedReader reader;   public StringTokenizer tokenizer;   public InputReader(InputStream stream) {    reader = new BufferedReader(new InputStreamReader(stream), 32768);    tokenizer = null;   }   public String next() {    while (tokenizer == null || !tokenizer.hasMoreTokens()) {     try {      tokenizer = new StringTokenizer(reader.readLine());     } catch (IOException e) {      throw new RuntimeException(e);     }    }    return tokenizer.nextToken();   }   public int nextInt() {    return Integer.parseInt(next());   }  } }
4	public class C_1523 {  static Scanner input = new Scanner(System.in); static int n;  public static void main(String[] args) {  int t = input.nextInt();  for(int test = 0; test < t; test++){  n = input.nextInt();  int num = input.nextInt();  if(num == 1){   n--;   recur("");  }else{   System.out.println("ERROR");  }  } }  public static int recur(String before){  int num = 1;  System.out.println(before + num);  while(n > 0){  int val = input.nextInt();  n--;  if(val == 1){   val = recur(before + num + ".");  }  if(val == num + 1){   num++;   System.out.println(before + num);  }else{   return val;  }  }  return -1; } }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA { public void solve(int testNumber, InputReader in, OutputWriter out) {   int n = in.nextInt();   int[] a = in.nextIntArray(n);   int[] b = a.clone();   ArrayUtils.safeSort(b);   int diff = 0;   for (int i = 0; i < n; i++) {    if (a[i] != b[i])     diff++;   }   out.println(diff <= 2 ? "YES" : "NO");  } } class InputReader {  private InputStream stream;  private byte[] buf = new byte[1 << 16];  private int curChar;  private int numChars;  public InputReader(InputStream stream) {   this.stream = stream;  }  public int read() {   if (numChars == -1)    throw new InputMismatchException();   if (curChar >= numChars) {    curChar = 0;    try {     numChars = stream.read(buf);    } catch (IOException e) {     throw new InputMismatchException();    }    if (numChars <= 0)     return -1;   }   return buf[curChar++];  }  public int nextInt() {   int c = read();   while (isSpaceChar(c))    c = read();   int sgn = 1;   if (c == '-') {    sgn = -1;    c = read();   }   int res = 0;   do {    if (c < '0' || c > '9')     throw new InputMismatchException();    res *= 10;    res += c & 15;    c = read();   } while (!isSpaceChar(c));   return res * sgn;  }  public static boolean isSpaceChar(int c) {   return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;  }  public int[] nextIntArray(int count) {   int[] result = new int[count];   for (int i = 0; i < count; i++) {    result[i] = nextInt();   }   return result;  }  } class OutputWriter {  private PrintWriter writer;  public OutputWriter(OutputStream stream) {   writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream)));  }  public OutputWriter(Writer writer) {   this.writer = new PrintWriter(writer);  }  public void println(String x) {   writer.println(x);  }  public void close() {   writer.close();  }  } class ArrayUtils {   public static List<Integer> asList(int[] array) {   return new IntList(array);  }  private static class IntList extends AbstractList<Integer> implements RandomAccess {   int[] array;   private IntList(int[] array) {    this.array = array;   }   public Integer get(int index) {    return array[index];   }   public Integer set(int index, Integer element) {    int result = array[index];    array[index] = element;    return result;   }   public int size() {    return array.length;   }  }  public static void safeSort(int[] array) {   Collections.shuffle(asList(array));   Arrays.sort(array);  }  }
0	public class Main { final int INF = 1000000000; final int MAXN = 100100;   Scanner input = new Scanner(System.in); BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out);  public static void main(String[] args) throws IOException {  new Main().run(); }  double a, v; double l, d, w;  void run() throws IOException {  a = input.nextDouble();  v = input.nextDouble();  l = input.nextDouble();  d = input.nextDouble();  w = input.nextDouble();  if (v <= w) {  out.println(timeTravel(l, 0));  } else {  double tw = w / a;  double dw = dist(tw, 0);  if (dw >= d) {   out.println(timeTravel(l, 0));  } else {   double tSym = timeTravel((d - dw) / 2, w);   out.println(tw + 2 * tSym + timeTravel(l - d, w));  }  }  out.close(); }   double dist(double time, double speed) {  return speed * time + a * time * time / 2;  }  double timeTravel(double distance, double speed) {  double delta = speed * speed + 2 * a * distance;  double tAll = (Math.sqrt(delta) - speed) / a;  double tMax = (v - speed) / a;  if (tMax >= tAll) {  return tAll;  } else {  return tMax + (distance - dist(tMax, speed)) / v;  } } }
2	@SuppressWarnings("Duplicates") public class C817 {  private FastScanner in;  private PrintWriter out;  private long calcSum(long x) {   int ans = 0;   while (x > 0) {    ans += x % 10;    x /= 10;   }   return ans;  }  private long calcDiff(long x) {   return x - calcSum(x);  }  private long binSearch(long n, long s) {   long l = 0;   long r = n + 1;   while (r - l > 1) {    long m = (r + l) >> 1;    if (calcDiff(m) >= s) {     r = m;    } else {     l = m;    }   }   return l;  }  private void solve() throws IOException {   long n = in.nextLong();   long s = in.nextLong();   long ans = binSearch(n, s);   out.println(n - ans);  }  private void run() {   try {    in = new FastScanner(System.in);    out = new PrintWriter(System.out);    solve();    out.close();   } catch (IOException e) {    e.printStackTrace();   }  }  class FastScanner {   BufferedReader br;   StringTokenizer st;   FastScanner(InputStream f) {    br = new BufferedReader(new InputStreamReader(f));   }   FastScanner(File f) {    try {     br = new BufferedReader(new FileReader(f));    } catch (FileNotFoundException e) {     e.printStackTrace();    }   }   String next() {    while (st == null || !st.hasMoreTokens()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }  }  public static void main(String[] arg) {   new C817().run();  } }
5	public class r220a { public static void main(String args[]) {  Scanner in =new Scanner(System.in);  int N = in.nextInt();  ArrayList<Integer> list = new ArrayList<Integer>();  ArrayList<Integer> sort = new ArrayList<Integer>();  for(int i = 0; i < N; i++) {  int k = in.nextInt();  list.add(k);  sort.add(k);  }   Collections.sort(sort);   int count = 0;  for(int i = 0; i < N; i++) {  if(sort.get(i).intValue() != list.get(i).intValue())   count++;  }  if(count != 2 && count != 0)  System.out.println("NO");  else  System.out.println("YES"); } }
5	public class Round159ProblemA {  public static void main(String[] args) {  Reader r = new Reader();  int filters = r.nextInt();  int devices = r.nextInt();  int sockets = r.nextInt();   List<Integer> filtery = new ArrayList<>();  for (int i = 0; i < filters; i++) {  filtery.add(r.nextInt()-1);  }      if(devices <= sockets){  System.out.println(0);  return;  }else{  Collections.shuffle(filtery);  Collections.sort(filtery);  devices -= sockets;  int act = filtery.size()-1;  int result = 0;  while(devices > 0){     if(act < 0){   System.out.println(-1);   return;   }   devices -= filtery.get(act);   act--;   result++;  }  System.out.println(result);  } }  static class Reader {  StreamTokenizer in;  public Reader() {  in = new StreamTokenizer(new BufferedReader(new InputStreamReader(   System.in)));  }  public int nextInt() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return (int) in.nval;  }  public long nextLong() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return (long) in.nval;  }  public String next() {  try {   in.nextToken();  } catch (IOException e) {   e.printStackTrace();  }  return in.sval;  } } }
1	public class Solution {  Scanner in; PrintWriter out;  boolean isPrime(int x) {  for (int i = 2; i * i <= x; ++i) {  if (x % i == 0) {   return false;  }  }  return true; }  void solve() throws IOException {  in = new Scanner(System.in);   out = new PrintWriter(System.out);  int N = in.nextInt();  int K = in.nextInt();  List<Integer> primes = new ArrayList<Integer>();  for (int i = 2; i <= N; ++i) {  if (isPrime(i)) {   primes.add(i);  }  }  int c = 0;  for (int i = 2; i <= N; ++i) {  if (!isPrime(i)) continue;  for (int j = 0; j + 1 < primes.size(); ++j) {   int p1 = primes.get(j);   int p2 = primes.get(j + 1);   if (p1 + p2 + 1 == i) {   ++c;      break;   }  }  }  if (c >= K) out.println("YES");  else out.println("NO");  out.close();  }  public static void main(String args[]) throws IOException {  new Solution().solve(); } }
4	public class Codechef {     public static void main (String[] args) throws IOException {   BufferedReader br=new BufferedReader(new InputStreamReader(System.in));   int t=Integer.parseInt(br.readLine());   PrintWriter p=new PrintWriter(System.out);   while(t-->0)   {       int n=Integer.parseInt(br.readLine());    String a[]=new String[n];    for(int i=0;i<n;i++)    {     a[i]=br.readLine();    }    String pre="1";    for(int i=1;i<n;i++)    {     if(a[i].equals("1"))     {      a[i]=pre+".1";      pre=a[i];      continue;     }     int li=pre.lastIndexOf('.');     while(li!=-1 && Integer.parseInt(pre.substring(li+1))+1!=Integer.parseInt(a[i]))     {      pre=pre.substring(0,li);      li=pre.lastIndexOf('.');     }         if(li!=-1)     a[i]=pre.substring(0,li+1)+a[i];     pre=a[i];    }    for(int i=0;i<n;i++)    {     p.println(a[i]);    }    p.flush();   } } }
4	public class C {  static class FastReader {   BufferedReader br;   StringTokenizer st;   public FastReader() {    br = new BufferedReader(new      InputStreamReader(System.in));   }   String next() {    while (st == null || !st.hasMoreElements()) {     try {      st = new StringTokenizer(br.readLine());     } catch (IOException e) {      e.printStackTrace();     }    }    return st.nextToken();   }   int nextInt() {    return Integer.parseInt(next());   }   long nextLong() {    return Long.parseLong(next());   }   double nextDouble() {    return Double.parseDouble(next());   }   String nextLine() {    String str = "";    try {     str = br.readLine();    } catch (IOException e) {     e.printStackTrace();    }    return str;   }  }  static FastReader s = new FastReader();  static PrintWriter out = new PrintWriter(System.out);  private static int[] rai(int n) {   int[] arr = new int[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextInt();   }   return arr;  }  private static int[][] rai(int n, int m) {   int[][] arr = new int[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextInt();    }   }   return arr;  }  private static long[] ral(int n) {   long[] arr = new long[n];   for (int i = 0; i < n; i++) {    arr[i] = s.nextLong();   }   return arr;  }  private static long[][] ral(int n, int m) {   long[][] arr = new long[n][m];   for (int i = 0; i < n; i++) {    for (int j = 0; j < m; j++) {     arr[i][j] = s.nextLong();    }   }   return arr;  }  private static int ri() {   return s.nextInt();  }  private static long rl() {   return s.nextLong();  }  private static String rs() {   return s.next();  }  static long gcd(long a,long b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static int gcd(int a,int b)  {   if(b==0)   {    return a;   }   return gcd(b,a%b);  }  static boolean isPrime(int n) {     if (n % 2 == 0) return false;     for (int i = 3; i <= Math.sqrt(n); i += 2) {    if (n % i == 0)     return false;   }   return true;  }  static int MOD=1000000007;  static long mpow(long base,long pow)  {   long res=1;   while(pow>0)   {    if(pow%2==1)    {     res=(res*base)%MOD;    }    pow>>=1;    base=(base*base)%MOD;   }   return res;  }  public static void main(String[] args) {   StringBuilder ans = new StringBuilder();   int t = ri();   while (t-- > 0)   {    int n=ri();    int[] arr=rai(n);    List<Integer> list = new ArrayList<>();    for(int i:arr)    {     if(i==1)     {      list.add(i);     }     else     {      int ind = list.size()-1;      while(list.size()>0 && list.get(ind)+1!=i )      {       list.remove(list.size()-1);       ind=list.size()-1;      }      if(list.size()>0)      {       list.remove(list.size()-1);      }      list.add(i);     }     for(int j=0;j<list.size()-1;j++)     {      ans.append(list.get(j)).append(".");     }     ans.append(list.get(list.size()-1)).append("\n");    }   }   out.print(ans.toString());   out.flush();  }  }
1	public class Array implements Runnable {  void solve() throws IOException {   int n = readInt();   int k = readInt();   int a[] = new int[n];   int startIdx = 0;   int endIdx = -1;   Map<Integer,Integer> map = new HashMap<Integer,Integer>();   for(int i = 0; i < n; i ++) {    a[i] = readInt();    if(map.containsKey(a[i]))     map.put(a[i], map.get(a[i]) + 1);    else     map.put(a[i], 1);    if(map.size() == k && endIdx == -1) {     endIdx = i;     break;    }   }   if(endIdx != -1) {    while(startIdx < n && map.get(a[startIdx])>1) {     map.put(a[startIdx], map.get(a[startIdx]) - 1);     startIdx ++;    }    startIdx ++;    endIdx ++;   } else    startIdx = -1;   out.println((startIdx)+" "+(endIdx));   }   BufferedReader in;  PrintWriter out;  StringTokenizer tok = new StringTokenizer("");  public static void main(String[] args) {   new Array().run();  }  public void run() {   try {    long t1 = System.currentTimeMillis();    if (System.getProperty("ONLINE_JUDGE") != null) {     in = new BufferedReader(new InputStreamReader(System.in));     out = new PrintWriter(System.out);    } else {     in = new BufferedReader(new FileReader("/Users/shenchen/input.txt"));     out = new PrintWriter("/Users/shenchen/output.txt");    }    Locale.setDefault(Locale.US);    solve();    in.close();    out.close();    long t2 = System.currentTimeMillis();    System.err.println("Time = " + (t2 - t1));   } catch (Throwable t) {    t.printStackTrace(System.err);    System.exit(-1);   }  }  String readString() throws IOException {   while (!tok.hasMoreTokens()) {    tok = new StringTokenizer(in.readLine());   }   return tok.nextToken();  }  int readInt() throws IOException {   return Integer.parseInt(readString());  }  long readLong() throws IOException {   return Long.parseLong(readString());  }  double readDouble() throws IOException {   return Double.parseDouble(readString());  }  }
0	public class Main {  public static void main(String [] args) throws IOException {   BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));     StringTokenizer st = new StringTokenizer(f.readLine());  BigInteger l = new BigInteger(st.nextToken());  BigInteger r = new BigInteger(st.nextToken());     if (r.subtract(l).intValue()<2 || (r.subtract(l).intValue()==2 && r.mod(new BigInteger("2")).intValue()==1)) out.println(-1);  else out.println(l.add(l.mod(new BigInteger("2"))).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("1")).toString()+" "+l.add(l.mod(new BigInteger("2"))).add(new BigInteger("2")).toString());     out.close();  System.exit(0); } }
3	public class Main{  static ArrayList a[]=new ArrayList[200001]; static int Count(int a[][],int n) {  dsu d=new dsu(n);  for(int i=0;i<n;i++) {  for(int j=0;j<n;j++) {   if(a[i][j]==0) {   d.union(i, j);   }  }  }  int cnt=0;  boolean chk[]=new boolean [n];  for(int i=0;i<n;i++) {  int p=d.root(i);  if(!chk[p]) {   chk[p]=true;   cnt++;  }  }  return cnt; } public void solve () {  InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);   int n=in.nextInt();  int a=in.nextInt();  int b=in.nextInt();  if(a==1 || b==1) {   int ans[][]=new int [n][n];   int temp=(a==1)?b:a;   for(int i=1;i<=n-temp;i++) {   ans[i][i-1]=1;   ans[i-1][i]=1;   }   int freq=Count(ans,n);   if(freq!=1) {   pw.println("NO");   }   else {   pw.println("YES");   for(int i=0;i<n;i++) {    for(int j=0;j<n;j++) {    if(i==j) {     pw.print(0);    }    else     pw.print((ans[i][j]+((temp==b)?1:0))%2);    }    pw.println();   }   }  }  else {   pw.print("NO");  }  pw.flush();  pw.close(); } public static void main(String[] args) throws Exception {        new Thread(null,new Runnable() {   public void run() {    new Main().solve();   }   },"1",1<<26).start();       }  static void debug(Object... o) {  System.out.println(Arrays.deepToString(o));   }     static class InputReader   {   private final InputStream stream;   private final byte[] buf = new byte[8192];   private int curChar, snumChars;   private SpaceCharFilter filter;    public InputReader(InputStream stream)   {    this.stream = stream;   }   public int snext()   {    if (snumChars == -1)     throw new InputMismatchException();    if (curChar >= snumChars)    {     curChar = 0;     try     {      snumChars = stream.read(buf);     }     catch (IOException e)     {      throw new InputMismatchException();     }     if (snumChars <= 0)      return -1;    }    return buf[curChar++];   }    public int nextInt()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    int sgn = 1;    if (c == '-')    {     sgn = -1;     c = snext();    }    int res = 0;    do    {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public long nextLong()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    int sgn = 1;    if (c == '-')    {     sgn = -1;     c = snext();    }    long res = 0;    do    {     if (c < '0' || c > '9')      throw new InputMismatchException();     res *= 10;     res += c - '0';     c = snext();    } while (!isSpaceChar(c));    return res * sgn;   }    public int[] nextIntArray(int n)   {    int a[] = new int[n];    for (int i = 0; i < n; i++)    {     a[i] = nextInt();    }    return a;   }    public String readString()   {    int c = snext();    while (isSpaceChar(c))    {     c = snext();    }    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isSpaceChar(c));    return res.toString();   }    public String nextLine()   {    int c = snext();    while (isSpaceChar(c))     c = snext();    StringBuilder res = new StringBuilder();    do    {     res.appendCodePoint(c);     c = snext();    } while (!isEndOfLine(c));    return res.toString();   }    public boolean isSpaceChar(int c)   {    if (filter != null)     return filter.isSpaceChar(c);    return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;   }    private boolean isEndOfLine(int c)   {    return c == '\n' || c == '\r' || c == -1;   }    public interface SpaceCharFilter   {    public boolean isSpaceChar(int ch);   }  }   public static long mod = 1000000007;   public static int d;   public static int p;   public static int q;   public void extended(int a,int b) {   if(b==0) {    d=a;    p=1;    q=0;   }   else   {    extended(b,a%b);    int temp=p;    p=q;    q=temp-(a/b)*q;   }   }   public static long[] shuffle(long[] a,Random gen)   {    int n = a.length;    for(int i=0;i<n;i++)    {     int ind = gen.nextInt(n-i)+i;     long temp = a[ind];     a[ind] = a[i];     a[i] = temp;    }    return a;   }     public static void swap(int a, int b){    int temp = a;    a = b;    b = temp;   }     public static HashSet<Integer> primeFactorization(int n)   {    HashSet<Integer> a =new HashSet<Integer>();    for(int i=2;i*i<=n;i++)    {     while(n%i==0)     {      a.add(i);      n/=i;     }    }    if(n!=1)     a.add(n);    return a;   }     public static void sieve(boolean[] isPrime,int n)   {    for(int i=1;i<n;i++)     isPrime[i] = true;       isPrime[0] = false;    isPrime[1] = false;       for(int i=2;i*i<n;i++)    {     if(isPrime[i] == true)     {      for(int j=(2*i);j<n;j+=i)       isPrime[j] = false;     }    }   }     public static int GCD(int a,int b)   {    if(b==0)     return a;    else     return GCD(b,a%b);   }     static class pair implements Comparable<pair>   {    Integer x;    Long y;    pair(int x,long y)    {     this.x=x;     this.y=y;        }           public int compareTo(pair o) {     int result = x.compareTo(o.x);     if(result==0)      result = y.compareTo(o.y);         return result;    }        public String toString()    {     return x+" "+y;    }       public boolean equals(Object o)    {     if (o instanceof pair)     {      pair p = (pair)o;      return p.x == x && p.y == y ;     }     return false;    }       public int hashCode()    {     return new Long(x).hashCode()*31 + new Long(y).hashCode();    }   }     } class pair implements Comparable<pair> {  Integer x;  Long y;  pair(int x,long y)  {   this.x=x;   this.y=y;    }     public int compareTo(pair o) {   int result = x.compareTo(o.x);   if(result==0)    result = y.compareTo(o.y);     return result;  }    public String toString()  {   return x+" "+y;  }   public boolean equals(Object o)  {   if (o instanceof pair)   {    pair p = (pair)o;    return p.x == x && p.y == y ;   }   return false;  }   public int hashCode()  {   return new Long(x).hashCode()*31 + new Long(y).hashCode();  } } class dsu{ int parent[]; dsu(int n){  parent=new int[n+1];  for(int i=0;i<=n;i++)  {  parent[i]=i;  } } int root(int n) {  while(parent[n]!=n)  {   parent[n]=parent[parent[n]];  n=parent[n];  }  return n; } void union(int _a,int _b) {  int p_a=root(_a);  int p_b=root(_b);    parent[p_a]=p_b;     } boolean find(int a,int b) {  if(root(a)==root(b))  return true;  else  return false; }   }
3	public class Main { long MOD = 1000000007; InputReader in; BufferedReader br; PrintWriter out;  public static void main(String[] args) throws java.lang.Exception {  Main solver = new Main();  solver.in = new InputReader(System.in);  solver.br = new BufferedReader(new InputStreamReader(System.in));  solver.out = new PrintWriter(System.out);  solver.solve();  solver.out.flush();  solver.out.close(); }  public void solve() {  int tc = 1;  for (int cas = 1; cas <= tc; cas++) {  int N = in.readInt();  int[] A = new int[N];  in.readInt(A);   int res = 0;  for(int i=0;i<N;i++){   for(int j=i+1;j<N;j++){   if(A[i]>A[j])    res++;   }  }  res = res % 2;    int Q = in.readInt();  while(Q-->0){   int l = in.readInt();   int r = in.readInt();   int add = (r-l+1)/2;   res = res + add;   res%=2;   out.println(res%2==0?"even":"odd");  }  }  } } class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter;  public InputReader(InputStream stream) {  this.stream = stream; }  public int read() {  if (numChars == -1)  throw new InputMismatchException();  if (curChar >= numChars) {  curChar = 0;  try {   numChars = stream.read(buf);  } catch (IOException e) {   throw new InputMismatchException();  }  if (numChars <= 0)   return -1;  }  return buf[curChar++]; }  public int readInt() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  int res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public void readInt(int[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readInt(); }  public long readLong() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  long res = 0;  do {  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  } while (!isSpaceChar(c));  return res * sgn; }  public void readLong(long[] A) {  for (int i = 0; i < A.length; i++)  A[i] = readLong(); }  public double readDouble() {  int c = read();  while (isSpaceChar(c))  c = read();  int sgn = 1;  if (c == '-') {  sgn = -1;  c = read();  }  double res = 0;  while (!isSpaceChar(c) && c != '.') {  if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());  if (c < '0' || c > '9')   throw new InputMismatchException();  res *= 10;  res += c - '0';  c = read();  }  if (c == '.') {  c = read();  double m = 1;  while (!isSpaceChar(c)) {   if (c == 'e' || c == 'E')   return res * Math.pow(10, readInt());   if (c < '0' || c > '9')   throw new InputMismatchException();   m /= 10;   res += (c - '0') * m;   c = read();  }  }  return res * sgn; }  public char[] readCharA() {  return readString().toCharArray(); }  public String readString() {  int c = read();  while (isSpaceChar(c))  c = read();  StringBuilder res = new StringBuilder();  do {  res.appendCodePoint(c);  c = read();  } while (!isSpaceChar(c));  return res.toString(); }  public boolean isSpaceChar(int c) {  if (filter != null)  return filter.isSpaceChar(c);  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }  public String next() {  return readString(); }  public interface SpaceCharFilter {  public boolean isSpaceChar(int ch); } }
0	public class Solution implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer st; private Random rnd;  double Vend;  private double calcFirstSegment(double a, double Vmax, double Vend, double l) {  double Vl = 0, Vr = Vmax;   for(int it = 0; it < 256; it++) {  double Vm = (Vl + Vr) / 2.0;    double tFirst = Vm / a;    double tSecond = 0;  if(Vend < Vm) tSecond = (Vm - Vend) / a;    double firstPart = a * tFirst * tFirst / 2.0;  double secondPart = Vm * tSecond - a * tSecond * tSecond / 2.0;    double res = firstPart + secondPart;    if(res < l) Vl = Vm;  else Vr = Vm;  }   this.Vend = Math.min(Vl, Vend);   double res = 0.0;   {  double Vm = Vl;    double tFirst = Vm / a;  double tSecond = 0;  if(Vend < Vm) tSecond = (Vm - Vend) / a;        double firstPart = a * tFirst * tFirst / 2.0;  double secondPart = Vm * tSecond - a * tSecond * tSecond / 2.0;    double remain = l - firstPart - secondPart;    res = tFirst + tSecond + (remain / Vm);  }   return res; }  private double calcSecondPart(double a, double Vmax, double Vstart, double l) {  double Vl = Vstart, Vr = Vmax;      for(int it = 0; it < 256; it++) {  double Vm = (Vl + Vr) / 2.0;  double t = (Vm - Vstart) / a;    double s = Vstart * t + a * t * t / 2.0;    if(s < l) Vl = Vm;  else Vr = Vm;  }   double res = 0.0;   {  double Vm = (Vl + Vr) / 2.0;  double t = (Vm - Vstart) / a;    double s = Vstart * t + a * t * t / 2.0;    double remain = l - s;    res = t + (remain / Vmax);  }   return res; }  public void solve() throws IOException {  double a = nextDouble(), v = nextDouble(), l = nextDouble(), d = nextDouble(), w = nextDouble();   double res = calcFirstSegment(a, v, w, d);  res += calcSecondPart(a, v, Vend, l - d);   out.println(res); }   public static void main(String[] args) {  new Solution().run(); }   public void run() {  try {        in = new BufferedReader(new InputStreamReader((System.in)));  out = new PrintWriter(System.out);    st = null;  rnd = new Random();    solve();    out.close();  } catch(IOException e) {  e.printStackTrace();  }  }  private String nextToken() throws IOException, NullPointerException {  while(st == null || !st.hasMoreTokens()) {  st = new StringTokenizer(in.readLine());  }   return st.nextToken(); }  private int nextInt() throws IOException {  return Integer.parseInt(nextToken()); }  private long nextLong() throws IOException {  return Long.parseLong(nextToken()); }  private double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } }
4	public class C{  public static void main(String[] args) throws IOException {      read();  int t= RI();  while(t-->0) {  read();  int n = RI();  List<Integer> cur = new ArrayList<Integer>();  int[] lvl = new int[n+10];  while(n-->0) {   read();   int x = RI();     if (cur.size() == 0) {   cur.add(x);   lvl[cur.size()]=x;   }   else {   while (!cur.isEmpty()) {    if (x == 1+lvl[cur.size()]) {    int size = cur.size();    cur.remove(size-1);    cur.add(1+lvl[size]);    lvl[size] = x;    break;    }    else {        if (x == 1) {         cur.add(x);     lvl[cur.size()] = x;     break;    }    else {     lvl[cur.size()] = 0;     cur.remove(cur.size()-1);    }    }   }   if (cur.size() == 0) {    cur.add(x);    lvl[cur.size()]=x;   }   }        for (int i = 0; i < cur.size(); i++) {   out.print(cur.get(i));   if (i != cur.size()-1) out.print(".");   }   out.println();  }  }  out.close(); }  static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static StringTokenizer st; static void read() throws IOException{st = new StringTokenizer(br.readLine());}  static int RI() throws IOException{return Integer.parseInt(st.nextToken());} static long RL() throws IOException{return Long.parseLong(st.nextToken());} static double RD() throws IOException{return Double.parseDouble(st.nextToken());}  }
5	public class Main { public static void main(String[] args) {  InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA();  solver.solve(1, in, out);  out.close(); } } class TaskA {  public void solve(int testNumber, InputReader in, OutputWriter out) {   int n=in.nextInt(),m=in.nextInt(),k=in.nextInt();   int ans=-1;   int i;   int a[]=new int[n];   for(i=0;i<n;i++)    a[i]=in.nextInt();   Arrays.sort(a);   int p=k,c=0;   for(i=n-1;i>=0;i--)   {    if(p>=m)     break;    p+=a[i]-1;    c++;   }   if(p>=m)    out.printLine(c);   else out.printLine(-1);  } } class InputReader {  BufferedReader in;  StringTokenizer tokenizer=null;  public InputReader(InputStream inputStream)  {   in=new BufferedReader(new InputStreamReader(inputStream));  }  public String next()  {   try{    while (tokenizer==null||!tokenizer.hasMoreTokens())    {     tokenizer=new StringTokenizer(in.readLine());    }    return tokenizer.nextToken();   }   catch (IOException e)   {    return null;   }  }  public int nextInt()  {   return Integer.parseInt(next());  }  } class OutputWriter { private final PrintWriter writer;  public OutputWriter(OutputStream outputStream) {  writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); }  public OutputWriter(Writer writer) {  this.writer = new PrintWriter(writer); }  public void print(Object...objects) {  for (int i = 0; i < objects.length; i++) {  if (i != 0)   writer.print(' ');  writer.print(objects[i]);  } }  public void printLine(Object...objects) {  print(objects);  writer.println(); }  public void close() {  writer.close(); } }
0	public class Main {  public static void main(String[] args) {   new TaskA().solve(); } } class TaskA extends Base {  public static void solve () {  long l = in.nextLong();  long r = in.nextLong();    if (r - l < 2) {  System.out.println(-1);  return;  }   if (l % 2 == 0) {  System.out.println(l + " " + (l + 1) + " " + (l + 2));  return;  }   if (r - l > 2) {  System.out.println((l + 1) + " " + (l + 2) + " " + (l + 3));  return;  }   System.out.println(-1);  } } class Base { public static InputReader in = new InputReader(System.in); } class InputReader { BufferedReader reader; StringTokenizer tokenizer;  public InputReader (InputStream stream) {  reader = new BufferedReader(new InputStreamReader(stream), 32768);  tokenizer = null; }  public String next() {  while (tokenizer == null || !tokenizer.hasMoreTokens()) {  try {   tokenizer = new StringTokenizer(reader.readLine());  } catch (IOException e) {    e.printStackTrace();  }  }  return tokenizer.nextToken(); }  public int nextInt() {  return Integer.parseInt(next()); }  public long nextLong() {  return Long.parseLong(next()); } }
1	public class ProblemB3 {  Map<Integer, List<int[]>> dest;  private ProblemB3() throws IOException {   BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));   String h = rd.readLine();   String[] q = h.split("\\s+");   int a = Integer.parseInt(q[1]);   int b = Integer.parseInt(q[2]);   h = rd.readLine();   q = h.split(" ");   int n = q.length;   int[] p = new int[n];   for(int i=0;i<n;i++) {    p[i] = Integer.parseInt(q[i]);   }   Set<Integer> pset = new HashSet<>();   for(int x: p) {    pset.add(x);   }   dest = new HashMap<>();   boolean res = true;   for(int x: p) {    boolean aOk = pset.contains(a-x);    boolean bOk = pset.contains(b-x);    if(!aOk && !bOk) {     res = false;     break;    } else {     if(aOk) {      addEdgeAndBack(x,a-x,0);     }     if(bOk) {      addEdgeAndBack(x,b-x,1);     }    }   }   Set<Integer> aSet = new HashSet<>();   if(res && a != b) {    for(int x: p) {     List<int[]> e = getEdges(x);     if(e.size() == 1) {      int[] edge = e.get(0);      boolean odd = true;      int curA = edge[1];      int prev = x;      while(true) {       int cur = edge[0];       if(curA == 0 && odd) {        aSet.add(prev);        aSet.add(cur);       }       e = getEdges(cur);       if(e.size() == 1) {        if(!odd && e.get(0)[0] != cur) {         res = false;        }        break;       }       int other = e.get(0)[0] == prev?1:0;       edge = e.get(other);       if(edge[1] == curA) {        res = false;        break;       }       curA = 1-curA;       prev = cur;       odd = !odd;      }      if(!res) {       break;      }     }    }   }   out(res?"YES":"NO");   if(res) {    StringBuilder buf = new StringBuilder();    for(int i=0;i<n;i++) {     if(i>0) {      buf.append(' ');     }     buf.append(aSet.contains(p[i])?'0':'1');    }    out(buf);   }  }  private void addEdgeAndBack(int from, int to, int u) {   addEdge(from, to, u);   addEdge(to, from, u);  }  private void addEdge(int from, int to, int u) {   List<int[]> edges = getEdges(from);   for(int[] edge: edges) {    if(edge[0] == to) {     return;    }   }   edges.add(new int[]{to, u});  }  private List<int[]> getEdges(int from) {   List<int[]> ds = dest.get(from);   if(ds == null) {    ds = new ArrayList<>();    dest.put(from, ds);   }   return ds;  }  private static void out(Object x) {   System.out.println(x);  }  public static void main(String[] args) throws IOException {   new ProblemB3();  } }
1	public class B {  BufferedReader reader;  StringTokenizer tokenizer;  PrintWriter out;   public void solve() throws IOException {    int N = nextInt();   int A = nextInt();   int B = nextInt();   int[] nsA = new int[N];   int[] nsB = new int[N];   char[] ans = new char[N];   Arrays.fill(nsA, -1);   Arrays.fill(nsB, -1);   Arrays.fill(ans, 'C');   HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();   int[] P = new int[N];  for (int i = 0; i < N; i++) {    P[i] = nextInt();    map.put(P[i], i);   }      if (A == B) {    for (int i = 0; i < N; i++) {     if (!map.containsKey(A - P[i])) {      out.println("NO"); return;     }    }    out.println("YES");    for (int i = 0; i < N; i++) {     out.print(0 + " ");    }    out.println();    return;   }    for (int i = 0; i < N; i++) {    int oppA = A - P[i];    int oppB = B - P[i];    if (map.containsKey(oppA)) {     nsA[i] = map.get(oppA);    }    if (map.containsKey(oppB)) {     nsB[i] = map.get(oppB);    }   }   for (int i = 0; i < N; i++) {    if (nsA[i] == -1 && nsB[i] == -1) {     out.println("NO");     return;    }   }   for (int i = 0; i < N; i++) {    if (ans[i] != 'C') continue;    if (nsA[i] == -1) {     if (!go(i, 'B', ans, nsA, nsB) ){      out.println("NO"); return;     }    } else if (nsB[i] == -1) {     if (!go(i, 'A', ans, nsA, nsB) ){      out.println("NO"); return;     }    }   }   for (int i = 0; i < N; i++) {    if (ans[i] != 'C') continue;    if (nsA[i] == i || nsB[i] == i) {     if (nsA[i] == i) {      if (!go(i, 'B', ans, nsA, nsB) ){       out.println("NO"); return;      }     } else {      if (!go(i, 'A', ans, nsA, nsB) ){       out.println("NO"); return;      }     }    }   }   for (int i = 0; i < N; i++) {    if (ans[i] != 'C') continue;    if (!go(i, 'A', ans, nsA, nsB) ){     out.println("NO"); return;    }   }   for (int i = 0; i < N; i++) {    if (ans[i] == 'C') {     out.println("NO");     return;    }   }   out.println("YES");   for (int i = 0; i < N; i++) {    out.print(ans[i] == 'A'? 0: 1);    out.print(" ");   }   out.println(); }  public boolean go(int cur, char link, char[] ans, int[] nsA, int[] nsB) {   while (ans[cur] == 'C') {    int next = link == 'A'? nsA[cur]: nsB[cur];    if (next == -1) return false;    if (ans[next] != 'C') return false;    ans[cur] = link;    ans[next] = link;     int nextNext = link == 'A'? nsB[next]: nsA[next];    cur = nextNext;    if (cur == -1) return true;   }   return true;  }   public static void main(String[] args) {  new B().run(); }  public void run() {   try {    reader = new BufferedReader(new InputStreamReader(System.in));    tokenizer = null;    out = new PrintWriter(System.out);    solve();    reader.close();    out.close();   } catch (Exception e) {    e.printStackTrace();    System.exit(1);   }  }  int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  }  String nextToken() throws IOException {   while (tokenizer == null || !tokenizer.hasMoreTokens()) {    tokenizer = new StringTokenizer(reader.readLine());   }   return tokenizer.nextToken();  } }
2	public class Main{     private static InputStream stream;      private static byte[] buf = new byte[1024];      private static int curChar;      private static int numChars;      private static SpaceCharFilter filter;      private static PrintWriter pw;      private static long count = 0,mod=1000000007;           public final static int INF = (int) 1E9;             public static void main(String[] args) {       InputReader(System.in);      pw = new PrintWriter(System.out);        new Thread(null ,new Runnable(){        public void run(){         try{          solve();          pw.close();         } catch(Exception e){          e.printStackTrace();         }        }       },"1",1<<26).start();      }      public static void test(){       int t=nextInt();       while(t-->0){       solve();       }      }      public static long pow(long n, long p,long mod) {      if(p==0)      return 1;      if(p==1)      return n%mod;      if(p%2==0){      long temp=pow(n, p/2,mod);      return (temp*temp)%mod;      }else{       long temp=pow(n,p/2,mod);       temp=(temp*temp)%mod;       return(temp*n)%mod;             }     }      public static long pow(long n, long p) {      if(p==0)      return 1;      if(p==1)      return n;      if(p%2==0){      long temp=pow(n, p/2);      return (temp*temp);      }else{       long temp=pow(n,p/2);       temp=(temp*temp);       return(temp*n);             }     }      public static void Merge(long a[],int p,int r){       if(p<r){        int q = (p+r)/2;        Merge(a,p,q);        Merge(a,q+1,r);        Merge_Array(a,p,q,r);       }      }      public static void Merge_Array(long a[],int p,int q,int r){       long b[] = new long[q-p+1];       long c[] = new long[r-q];       for(int i=0;i<b.length;i++)        b[i] = a[p+i];       for(int i=0;i<c.length;i++)        c[i] = a[q+i+1];       int i = 0,j = 0;       for(int k=p;k<=r;k++){        if(i==b.length){         a[k] = c[j];         j++;        }        else if(j==c.length){         a[k] = b[i];         i++;        }        else if(b[i]<c[j]){         a[k] = b[i];         i++;        }        else{         a[k] = c[j];         j++;        }       }      }      public static long gcd(long x, long y) {      if (x == 0)       return y;      else       return gcd( y % x,x);      } public static boolean isPrime(int n) {          if (n <= 1)     return false;     if (n <= 3)     return true;                  if (n % 2 == 0 || n % 3 == 0)     return false;         for (int i = 5; i * i <= n; i = i + 6)     if (n % i == 0 || n % (i + 2) == 0)      return false;         return true;    }      static LinkedList<Integer> adj[];      static boolean Visited[];      static HashSet<Integer> exc;      static long oddsum[]=new long[1000001];      static int co=0,ans=0;            static int n,m;      static String s[];      static int ind;      public static void solve() {                    long n=nextLong();       long s=nextLong();       long low=1,high=n,ans=-1;       while(low<=high){       long mid=(low+high)/2;       if(check(mid,s)){        ans=mid;        high=mid-1;       }else       {        low=mid+1;       }               }       if(ans==-1)       pw.println(0);       else       pw.println(n-ans+1);          }      private static boolean check(long mid,long s){       long n=mid;       int sum=0;       while(mid>0){       sum+=(mid%10);       mid/=10;       }       if(n-sum >=s)       return true;       return false;              }            static int[] levl;      static int h_max=0;      public static void dfs(int curr,int lev){      Visited[curr]=true;      levl[curr]=lev;      h_max=Math.max(h_max, levl[curr]);      for(int x:adj[curr]){       if(!Visited[x]){       dfs(x,lev+1);       }      }      }            public static String reverseString(String s) {      StringBuilder sb = new StringBuilder(s);      sb.reverse();      return (sb.toString());     }                  private static void BFS(int sou,int dest){       Queue<Integer> q=new LinkedList<Integer>();       q.add(sou);       Visited[sou]=true;       while(!q.isEmpty()){       int top=q.poll();              for(int i:adj[top]){               if(!Visited[i])        {                q.add(i);        }               Visited[i]=true;        if(i==dest){        pw.println("Yes");        return;        }       }       }       pw.println("No");                   }            private static long ncr(int n,int k){      if (k < 0 || k > n) return 0;      if (n-k < k) k = n-k;          BigInteger x = BigInteger.ONE;      for (int i = 1; i <= k; i++) {       x = x.multiply(new BigInteger(""+(n-i+1)));       x = x.divide(new BigInteger(""+i));      }        return x.longValue();     }      private static long fact(long count){       long ans=1;       for(int i=1;i<=count;i++){       ans*=i;       }       return ans;      }                  static int state=1;      static long no_exc=0,no_vert=0;      static Stack<Integer> st;      static HashSet<Integer> inset;      private static void topo(int curr){             Visited[curr]=true;       inset.add(curr);       for(int x:adj[curr]){       if(adj[x].contains(curr) || inset.contains(x)){        state=0;        return;       }       if(state==0)        return;              }       st.push(curr);             inset.remove(curr);      }      static HashSet<Integer> hs;            private static void buildgraph(int n){      adj=new LinkedList[n+1];      Visited=new boolean[n+1];            for(int i=0;i<=n;i++){       adj[i]=new LinkedList<Integer>();            }           }                          public static void sort(long a[]){       Merge(a, 0, a.length-1);      }      public static void InputReader(InputStream stream1) {      stream = stream1;      }        private static boolean isWhitespace(int c) {      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;      }        private static boolean isEndOfLine(int c) {      return c == '\n' || c == '\r' || c == -1;      }        private static int read() {      if (numChars == -1)       throw new InputMismatchException();      if (curChar >= numChars) {       curChar = 0;       try {       numChars = stream.read(buf);       } catch (IOException e) {       throw new InputMismatchException();       }       if (numChars <= 0)       return -1;      }      return buf[curChar++];      }        private static int nextInt() {      int c = read();      while (isSpaceChar(c))       c = read();      int sgn = 1;      if (c == '-') {       sgn = -1;       c = read();      }      int res = 0;      do {       if (c < '0' || c > '9')       throw new InputMismatchException();       res *= 10;       res += c - '0';       c = read();      } while (!isSpaceChar(c));      return res * sgn;      }        private static long nextLong() {      int c = read();      while (isSpaceChar(c))       c = read();      int sgn = 1;      if (c == '-') {       sgn = -1;       c = read();      }      long res = 0;      do {       if (c < '0' || c > '9')       throw new InputMismatchException();       res *= 10;       res += c - '0';       c = read();      } while (!isSpaceChar(c));      return res * sgn;      }        private static String nextToken() {      int c = read();      while (isSpaceChar(c))       c = read();      StringBuilder res = new StringBuilder();      do {       res.appendCodePoint(c);       c = read();      } while (!isSpaceChar(c));      return res.toString();      }        private static String nextLine() {      int c = read();      while (isSpaceChar(c))       c = read();      StringBuilder res = new StringBuilder();      do {       res.appendCodePoint(c);       c = read();      } while (!isEndOfLine(c));      return res.toString();      }        private static int[] nextIntArray(int n) {      int[] arr = new int[n];      for (int i = 0; i < n; i++) {       arr[i] = nextInt();      }      return arr;      }        private static long[][] next2dArray(int n, int m) {      long[][] arr = new long[n][m];      for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {       arr[i][j] = nextLong();       }      }      return arr;      }      private static char[][] nextCharArray(int n,int m){      char [][]c=new char[n][m];      for(int i=0;i<n;i++){       String s=nextLine();       for(int j=0;j<s.length();j++){       c[i][j]=s.charAt(j);       }      }      return c;      }        private static long[] nextLongArray(int n) {      long[] arr = new long[n];      for (int i = 0; i < n; i++) {       arr[i] = nextLong();      }      return arr;      }        private static void pArray(int[] arr) {      for (int i = 0; i < arr.length; i++) {       pw.print(arr[i] + " ");      }      pw.println();      return;      }        private static void pArray(long[] arr) {      for (int i = 0; i < arr.length; i++) {       pw.print(arr[i] + " ");      }      pw.println();      return;      }        private static void pArray(boolean[] arr) {      for (int i = 0; i < arr.length; i++) {       pw.print(arr[i] + " ");      }      pw.println();      return;      }        private static boolean isSpaceChar(int c) {      if (filter != null)       return filter.isSpaceChar(c);      return isWhitespace(c);      }        private interface SpaceCharFilter {      public boolean isSpaceChar(int ch);      }       }              class Node{      int to;      long dist;      Node(int to,long dist){      this.to=to;      this.dist=dist;      }           }     class Dsu{     private int rank[], parent[] ,n;     private static int[] parent1;     Dsu(int size){      this.n=size+1;      rank=new int[n];           parent=new int[n];     makeSet();         }          void makeSet(){      for(int i=0;i<n;i++){      parent[i]=i;      }     }          int find(int x){      if(parent[x]!=x){            parent[x]=find(parent[x]);      }      return parent[x];     }               boolean union(int x,int y){      int xRoot=find(x);      int yRoot=find(y);           if(xRoot==yRoot)      return false;      if(rank[xRoot]<rank[yRoot]){      parent[xRoot]=yRoot;      }else if(rank[yRoot]<rank[xRoot]){      parent[yRoot]=xRoot;      }else{      parent[yRoot]=xRoot;      rank[xRoot]++;      }      return true;     }           }
2	public class Probram3 {  public static int get(long n) {  int sum = 0;  while(n != 0) {  sum += n % 10;  n = n / 10;  }  return sum; }  public static void main(String[] args) {  Scanner scanner = new Scanner(System.in);  long n = scanner.nextLong();  long s = scanner.nextLong();  long l = 1;  long r = Long.MAX_VALUE;  long index = 0;  while(l <= r) {  long mid = (l + r) / 2;  if(mid - get(mid) >= s) {   index = mid;   r = mid - 1;  }else{   l = mid + 1;  }  }  System.out.println(Math.max(0, n-index+1)); } }
1	public class ProblemA {  public void solve() {   boolean oj = true;   try {    Reader reader = oj ? new InputStreamReader(System.in) : new FileReader("A.in");    Writer writer = oj ? new OutputStreamWriter(System.out) : new FileWriter("A.out");    BufferedReader br = new BufferedReader(reader);    PrintWriter out = new PrintWriter(writer);    MyTokenizer tok = new MyTokenizer(br.readLine());    int n = (int)tok.getNum();    int k = (int)tok.getNum();    boolean[] isPrime = new boolean[n + 1];    for(int i=1;i<=n;i++)     isPrime[i] = true;    isPrime[1] = false;    isPrime[2] = true;    for(int i=2;i*i<=n;i++)     for(int j=2*i;j<=n;j+=i)      isPrime[j] = false;    int[] primes = new int[n];    int cur = 0;    for(int i=2;i<=n;i++)     if (isPrime[i]) {      primes[cur] = i;      cur++;     }    int count = 0;    for(int i=0;i<cur-1;i++) {     if (primes[i] + primes[i+1] + 1 <= n && isPrime[primes[i] + primes[i+1] + 1])      count++;    }    if (count >= k)     out.printf("YES");    else     out.printf("NO");        br.close();    out.close();    reader.close();    writer.close();   }   catch (Exception ex) {    ex.printStackTrace();   }   finally {   }  }  public static void main(String[] args) {   ProblemA f = new ProblemA();   f.solve();  }  private class MyTokenizer {   private String s;   private int cur;   public MyTokenizer(String s) {    this.s = s;    cur = 0;   }   public void skip() {    while (cur < s.length() && (s.charAt(cur) == ' ' || s.charAt(cur) == '\n')) {     cur++;    }   }   public double getNum() {    skip();    String snum = "";    while (cur < s.length() && (s.charAt(cur) >= '0' && s.charAt(cur) <= '9' || s.charAt(cur) == '.')) {     snum += s.charAt(cur);     cur++;    }    return Double.valueOf(snum);   }   public String getString() {    skip();    String s2 = "";    while (cur < s.length() && (s.charAt(cur) >= 'a' && s.charAt(cur) <= 'z')) {     s2 += s.charAt(cur);     cur++;    }    return s2;   }   public char getCurrentChar() throws Exception {    if (cur < s.length())     return s.charAt(cur);    else     throw new Exception("Current character out of string length");   }   public void moveNextChar() {    if (cur < s.length())     cur++;   }   public boolean isFinished() {    return cur >= s.length();   }  } }
3	public class Main { public static void main (String[] args) throws java.lang.Exception {  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));  int n=Integer.parseInt(br.readLine());  int[] A=new int[n];  String[] s=br.readLine().split(" ");  for(int i=0;i<n;i++){  A[i]=Integer.parseInt(s[i]);  }   int inv=0;  for(int i=0;i<n;i++){  for(int j=i+1;j<n;j++){   if(A[i]>A[j]){   inv++;   }  }  }  StringBuilder sb=new StringBuilder("");  int m=Integer.parseInt(br.readLine());  for(int i=0;i<m;i++){  s=br.readLine().split(" ");  int li=Integer.parseInt(s[0]);  int ri=Integer.parseInt(s[1]);  int tot=ri-li+1;  inv=inv+tot*(tot-1)/2;  if(inv%2==0){   sb.append("even\n");  }  else{   sb.append("odd\n");  }  }  System.out.print(sb); } }
1	public class Beta17PA {  boolean[] isPrime = new boolean[1001]; int[] prime = new int[200];  public static void main(String[] args) {   new Beta17PA().solve(); }  public void solve() {  Scanner scan = new Scanner(System.in);  int n, k;  n = scan.nextInt();  k = scan.nextInt();  init();  int m = 0;  for(int i=2; i<=n; i++) {  if(check(i)) m ++;  }  if(m>=k) System.out.println("YES");  else System.out.println("NO"); }  private boolean check(int n) {  if(n<6||!isPrime[n]) return false;  int d = n-1;  for(int i=0; i<199&&prime[i]+prime[i+1]<=d; i++) {  if(prime[i]+prime[i+1]==d) return true;  }  return false; }  private void init() {  Arrays.fill(isPrime, true);  isPrime[0] = isPrime[1] = false;  for(int i=2; i<1001; i++) {  if(!isPrime[i]) continue;  for(int j=i+i; j<1001; j+=i) {   isPrime[j] = false;  }  }  int count = 0;  for(int i=2; i<1001; i++) {  if(isPrime[i]) prime[count++] = i;  } } }
3	public class CFA {  BufferedReader br;  PrintWriter out;  StringTokenizer st;  boolean eof;  final long MOD = 1000L * 1000L * 1000L + 7;  int[] dx = {0, -1, 0, 1};  int[] dy = {1, 0, -1, 0};  void solve() throws IOException {   int n = nextInt();   int[] arr = nextIntArr(n);   int cnt = 0;   for (int i = 0; i < n; i++) {    for (int j = i + 1; j < n; j++) {     if (arr[i] > arr[j]) {      cnt++;     }    }   }   int m = nextInt();   boolean[] vis = new boolean[n];   for (int i = 0; i < m; i++) {    int l = nextInt() - 1;    int r = nextInt() - 1;    int len = r - l + 1;    if (len * (len - 1) / 2 % 2 != 0) {     cnt++;    }    if (cnt % 2 != 0) {     outln("odd");    }    else {     outln("even");    }   }  }  void shuffle(int[] a) {   int n = a.length;   for(int i = 0; i < n; i++) {    int r = i + (int) (Math.random() * (n - i));    int tmp = a[i];    a[i] = a[r];    a[r] = tmp;   }  }  long gcd(long a, long b) {   while(a != 0 && b != 0) {    long c = b;    b = a % b;    a = c;   }   return a + b;  }  private void outln(Object o) {   out.println(o);  }  private void out(Object o) {   out.print(o);  }  public CFA() throws IOException {   br = new BufferedReader(new InputStreamReader(System.in));   out = new PrintWriter(System.out);   solve();   out.close();  }  public static void main(String[] args) throws IOException {   new CFA();  }  public long[] nextLongArr(int n) throws IOException{   long[] res = new long[n];   for(int i = 0; i < n; i++)    res[i] = nextLong();   return res;  }  public int[] nextIntArr(int n) throws IOException {   int[] res = new int[n];   for(int i = 0; i < n; i++)    res[i] = nextInt();   return res;  }  public String nextToken() {   while (st == null || !st.hasMoreTokens()) {    try {     st = new StringTokenizer(br.readLine());    } catch (Exception e) {     eof = true;     return null;    }   }   return st.nextToken();  }  public String nextString() {   try {    return br.readLine();   } catch (IOException e) {    eof = true;    return null;   }  }  public int nextInt() throws IOException {   return Integer.parseInt(nextToken());  }  public long nextLong() throws IOException {   return Long.parseLong(nextToken());  }  public double nextDouble() throws IOException {   return Double.parseDouble(nextToken());  } }
1	public class Main {  public static void main(String[] args) throws IOException {  try {  if (new File("input.txt").exists())   System.setIn(new FileInputStream("input.txt"));  } catch (SecurityException e) {  }  new Thread() {  public void run() {   try {   new Main().run();   } catch (IOException e) {   e.printStackTrace();   }  }  }.start(); }  BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer("");  private void run() throws IOException {  in = new BufferedReader(new InputStreamReader(System.in));  out = new PrintWriter(System.out);   boolean[] pr = new boolean[1001];  for (int i = 2; i <= 1000; i++)  if (!pr[i]) {   int l = 2 * i;   while (l <= 1000) {   pr[l] = true;   l += i;   }  }  Set<Integer> set = new HashSet<Integer>();  for (int i = 2; i < 1000; i++) {  for (int j = i + 1; j <= 1000; j++) {   if (!pr[j]) {   set.add(j + i + 1);   i = j - 1;   break;   }  }  }  int n = nextInt();  int k = nextInt();  int res = 0;  for (int i = 2; i <= n; i++) {  if (set.contains(i) && !pr[i])   res++;  }  if (res >= k)  out.println("YES");  else  out.println("NO");   in.close();  out.close(); }  void chk(boolean b) {  if (b)  return;  System.out.println(new Error().getStackTrace()[1]);  exit(999); } void deb(String fmt, Object... args) {  System.out.printf(Locale.US, fmt + "%n", args); } String nextToken() throws IOException {  while (!st.hasMoreTokens())  st = new StringTokenizer(in.readLine());  return st.nextToken(); } int nextInt() throws IOException {  return Integer.parseInt(nextToken()); } long nextLong() throws IOException {  return Long.parseLong(nextToken()); } double nextDouble() throws IOException {  return Double.parseDouble(nextToken()); } String nextLine() throws IOException {  st = new StringTokenizer("");  return in.readLine(); } boolean EOF() throws IOException {  while (!st.hasMoreTokens()) {  String s = in.readLine();  if (s == null)   return true;  st = new StringTokenizer(s);  }  return false; } }
